Integration Guide
AutoGen
Connect AutoGen to DashClaw and get your first governed action into /decisions in under 20 minutes.
Instance URL detected: https://your-dashclaw-instance.example.com
Deploy DashClaw
Get a running instance. Click the Vercel deploy button or run locally.
Already have an instance? Skip to Step 2.
Install the DashClaw Python SDK and AutoGen
Create a virtual environment and install the required packages.
Terminal
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install dashclaw "autogen-agentchat>=0.4.0" python-dotenv
Set environment variables
Create a .env file with your DashClaw connection details. No LLM API key required for the example.
.env
DASHCLAW_BASE_URL=https://your-dashclaw-instance.example.com DASHCLAW_API_KEY=oc_live_...
Wrap your tool in the 4-step governance loop
The tool checks DashClaw guard before executing, records the action, waits for approval when required, and reports the outcome.
main.py
import os
from dotenv import load_dotenv
from dashclaw import DashClaw
load_dotenv()
claw = DashClaw(
base_url=os.environ["DASHCLAW_BASE_URL"],
api_key=os.environ["DASHCLAW_API_KEY"],
agent_id="autogen-deploy-agent",
)
def governed_deploy_tool(environment: str) -> str:
"""Deploy to an environment. Governed by DashClaw policies."""
# 1. GUARD: Check policy before executing
result = claw.guard({
"action_type": "deploy",
"declared_goal": f"Deploy to {environment}",
"risk_score": 70 if environment == "production" else 30,
"systems_touched": [environment],
"reversible": environment != "production",
})
decision = result.get("decision", "allow")
if decision == "block":
return f"BLOCKED: {', '.join(result.get('reasons', []))}"
# 2. RECORD: Declare intent
action = claw.create_action(
"deploy",
f"Deploy to {environment}",
risk_score=70 if environment == "production" else 30,
systems_touched=[environment],
)
action_id = action["action_id"]
# 3. HITL: Wait for approval if required
if decision == "require_approval":
try:
claw.wait_for_approval(action_id, timeout=120, interval=5)
except Exception as e:
claw.update_outcome(action_id, status="cancelled", error_message=str(e))
return f"DENIED: {e}"
# 4. ASSUMPTION + EXECUTE + OUTCOME
claw.register_assumption(
action_id,
f"Tests pass on {environment}",
basis="CI pipeline green for current branch",
)
deploy_result = f"Successfully deployed to {environment}."
claw.update_outcome(action_id, status="completed", output_summary=deploy_result)
return deploy_resultThe guard decision drives the flow: 'block' returns early, 'require_approval' pauses for a human click on /approvals, 'allow' proceeds straight to execution.
Register the governed tool on your AutoGen agent
Pass the governed function in the tools list: AutoGen inspects the signature and docstring; the governance loop runs on every model-initiated call.
agent.py
# Register the governed function as an AutoGen tool — the governance
# loop runs identically when the model invokes it.
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
agent = AssistantAgent(
name="deploy_agent",
model_client=OpenAIChatCompletionClient(model="gpt-5.2"),
tools=[governed_deploy_tool],
system_message="You manage deployments. Use the deploy tool.",
)Run the governed example
Execute the example and watch the governance flow: a staging deploy (allowed) and a production deploy (may require approval).
Terminal
python main.py
No OPENAI_API_KEY needed: the example runs the governance flow directly. Only the DashClaw SDK calls are real.
Clone the full example
The complete runnable example is in the DashClaw repo.
Terminal
git clone https://github.com/ucsandman/DashClaw.git cd DashClaw/examples/autogen-governed pip install -r requirements.txt python main.py
What success looks like
Go to /decisions: you should see two actions in the ledger with action_type 'deploy', agent_id 'autogen-deploy-agent': the staging deploy completed, and the production deploy either completed (after approval) or pending.
Navigate to /decisions in your DashClaw instance. Your action should appear in the ledger within seconds of the agent run.
Governance as Code
guardrails.yml is a policy-as-code template. Import it into your instance — POST the YAML to /api/policies/importor call the Python SDK's import_policies — and DashClaw evaluates these rules at the guard step before any action executes.
guardrails.yml
version: 1
project: my-autogen-agent
description: >
Governance policy for an AutoGen deploy agent.
Production deploys require approval.
Staging deploys are auto-allowed.
policies:
- id: approve_production_deploys
description: Production deploys require human approval
applies_to:
action_types:
- deploy
systems:
- production
rule:
require: approval
- id: allow_staging
description: Staging deploys are low risk
applies_to:
systems:
- staging
rule:
allow: true