Skip to content

AutoGen Integration

CapFence wraps AutoGen tools or callables with deterministic gate enforcement.

Installation

pip install capfence

Wrapping a tool

from capfence.framework.autogen import CapFenceAutoGenTool

def run_shell(command: str) -> str:
    return "ok"

safe_shell = CapFenceAutoGenTool(
    tool=run_shell,
    agent_id="autogen-agent",
    capability="shell.execute",
    policy_path="policies/shell.yaml",
)

Using the tool

safe_shell({"command": "ls -la"})