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

1

Deploy DashClaw

Get a running instance. Click the Vercel deploy button or run locally.

Already have an instance? Skip to Step 2.

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
3

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_...
4

Wrap the deploy effect with run_governed

The helper binds the exact command to one persisted action, waits when required, claims one execution attempt, runs the callback, 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."""
    command = f"deploy --environment {environment}"
    return claw.run_governed(
        {"kind": "shell", "command": command},
        {
            "action_type": "deploy",
            "declared_goal": f"Deploy to {environment}",
            "risk_score": 70 if environment == "production" else 30,
            "systems_touched": [environment],
            "reversible": environment != "production",
        },
        lambda: f"Successfully deployed to {environment}.",
    )

The callback runs only after DashClaw confirms protocol-1 execution authority for this action, agent, and scrubbed act.

5

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.",
)
6

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.

7

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/import or 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