mirror of
https://github.com/MervinPraison/PraisonAI.git
synced 2026-11-08 08:11:07 -10:00
25 lines
775 B
Python
25 lines
775 B
Python
"""Agent Approval — delegate tool approvals to another AI agent."""
|
|
|
|
from praisonaiagents import Agent
|
|
from praisonaiagents.approval import AgentApproval
|
|
|
|
# Create a security reviewer agent
|
|
reviewer = Agent(
|
|
name="security-reviewer",
|
|
instructions=(
|
|
"You are a security reviewer. Only approve low-risk read operations. "
|
|
"Deny anything destructive like delete, remove, or write operations. "
|
|
"Respond with exactly one word: APPROVE or DENY"
|
|
),
|
|
)
|
|
|
|
# Create a worker agent that uses the reviewer for approvals
|
|
worker = Agent(
|
|
name="assistant",
|
|
instructions="Help users with system tasks",
|
|
tools=["execute_command"],
|
|
approval=AgentApproval(approver_agent=reviewer),
|
|
)
|
|
|
|
worker.start("List the files in the current directory")
|