AI Consultant Agent with Google ADK
A powerful business consultant powered by Google's Agent Development Kit that provides comprehensive market analysis, strategic planning, and actionab…
- Gemini
Advanced Agents ·Intermediate
Policy-Based Sandboxing: Define what your AI agent can and cannot do using declarative policies - Action Interception: Catch and validate agent actions before execution - Audit Logging: Full trail of agent actions for compliance and debugging - File System Guards: Restrict read/write to specific directories - Network Guards: Allowlist-only external API access - Rate Limiting: Prevent runaway agents with configurable limits
OPENAI_API_KEYLicense Apache-2.0 · content curated and maintained by Doutor AI.
Learn how to build a governance layer that enforces deterministic policies on AI agents, preventing dangerous actions before they execute.
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Agent │────▶│ Governance │────▶│ Tool │
│ (LLM) │ │ Layer │ │ Execution │
└─────────────┘ └──────────────┘ └─────────────┘
│
┌──────▼──────┐
│ Policy │
│ Engine │
└─────────────┘
requirements.txt)git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git
cd advanced_ai_agents/single_agent_apps/ai_agent_governance
pip install -r requirements.txt
export OPENAI_API_KEY=your-openai-api-key
python ai_agent_governance.py
policies:
filesystem:
allowed_paths: ["/workspace", "/tmp"]
denied_paths: ["/etc", "/home", "~/.ssh"]
network:
allowed_domains: ["api.openai.com", "api.github.com"]
block_all_others: true
execution:
max_actions_per_minute: 60
require_approval_for: ["delete_file", "execute_shell"]
tools:
allowed: ["read_file", "write_file", "web_search"]
denied: ["execute_code", "send_email"]
🛡️ AI Agent Governance Demo
============================
📋 Loading policy: workspace_sandbox.yaml
🤖 Agent request: "Read the contents of /etc/passwd"
❌ DENIED: Path '/etc/passwd' is outside allowed directories
🤖 Agent request: "Write analysis to /workspace/report.md"
✅ ALLOWED: Action permitted by policy
🤖 Agent request: "Make HTTP request to unknown-api.com"
❌ DENIED: Domain 'unknown-api.com' not in allowlist
🤖 Agent request: "Delete /workspace/temp.txt"
⏸️ PENDING: Action requires human approval
[Y/n]:
The policy engine evaluates actions against a set of rules:
class PolicyEngine:
def evaluate(self, action: Action) -> Decision:
# Check each policy rule
for rule in self.rules:
result = rule.evaluate(action)
if result.is_terminal:
return result
return Decision.ALLOW
Tools are wrapped with governance checks:
def governed_tool(func):
def wrapper(*args, **kwargs):
action = Action(name=func.__name__, args=args, kwargs=kwargs)
decision = policy_engine.evaluate(action)
if decision == Decision.DENY:
raise PolicyViolation(decision.reason)
elif decision == Decision.REQUIRE_APPROVAL:
if not get_human_approval(action):
raise PolicyViolation("Human denied the action")
# Log the action
audit_log.record(action, decision)
return func(*args, **kwargs)
return wrapper
All actions are logged with full context:
{
"timestamp": "2024-01-15T10:30:00Z",
"action": "write_file",
"args": {"path": "/workspace/report.md"},
"decision": "ALLOW",
"policy_matched": "filesystem.allowed_paths",
"agent_id": "research-agent-001"
}
A powerful business consultant powered by Google's Agent Development Kit that provides comprehensive market analysis, strategic planning, and actionab…
This Streamlit app implements an AI-powered customer support agent for synthetic data generated using GPT-4o. The agent uses OpenAI's GPT-4o model and…
A powerful research assistant that leverages OpenAI's Agents SDK and Firecrawl's deep research capabilities to perform comprehensive web research on a…
Need a tailor-made solution?
Not sure where to start with AI in your business? Get a free assessment and a tailored plan - no commitment.
Doutor AI gives you 1,859 ready-to-copy AI prompts, by industry and in plain English - plus a complete technical library for those who want to go further.