AutoGen

Screen every code block before the Docker executor runs it.

Step 1: Set up A2A TrustGate

Run the quickstart wizard — prints API key setup, MCP config, CLAUDE.md snippet, and wrapper generators:

npx a2a-trustgate quickstart

# Then run the interactive setup:
npx a2a-trustgate setup

Step 2: Install and integrate

pip install pyautogen requests

import requests
from autogen.coding import DockerCommandLineCodeExecutor

class SafeExecutor(DockerCommandLineCodeExecutor):
    def execute_code_blocks(self, code_blocks):
        for lang, code in code_blocks:
            r = requests.post("https://a2ainfrastructure.com/v1/evaluate",
                headers={"Authorization": "Bearer " + API_KEY},
                json={"command": code})
            if r.json()["decision"] != "allow":
                raise ValueError("Blocked by TrustGate")
        return super().execute_code_blocks(code_blocks)
Help

Help

Need help? Here are some quick links: