-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathagent_approval.py
More file actions
31 lines (25 loc) · 783 Bytes
/
Copy pathagent_approval.py
File metadata and controls
31 lines (25 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
Agent Approval Example
======================
Uses an AI agent as an automated reviewer to approve/deny tool calls.
Requires:
pip install praisonaiagents
export OPENAI_API_KEY=sk-...
"""
from praisonaiagents import Agent
from praisonaiagents.approval import AgentApproval
from praisonaiagents.tools.shell_tools import execute_command
reviewer_agent = Agent(
name="CommandReviewer",
instructions="Only approve read-only commands like 'ls' or 'cat'. Deny destructive commands.",
)
reviewer = AgentApproval(
approver_agent=reviewer_agent,
)
agent = Agent(
name="DevOps",
instructions="You are a DevOps assistant. Use shell tools when asked.",
tools=[execute_command],
approval=reviewer,
)
agent.start("List files in the current directory")