examples/autogen.mdRaw

AutoGen Integration Playbook

Secure AutoGen multi-agent systems with AISentinel SDK governance.

Installation

pip install aisentinel autogen

Register Hooks

from autogen import AssistantAgent, UserProxyAgent
from aisentinel.integrations.autogen import SentinelAutoGenGuard

guard = SentinelAutoGenGuard.from_env()
assistant = AssistantAgent("assistant", llm_config={"model": "gpt-4o"})
user = UserProxyAgent("operator", code_execution_config=False)

assistant.register_reply(guard.preflight_hook)
assistant.register_post_run(guard.post_execution_hook)

Industry Scenarios

Healthcare Research Automation

guard = SentinelAutoGenGuard(rulepack_path="rulepacks/hipaa.yml", tenant_id="healthcare")
  • Ensures PHI is redacted and escalates critical violations to human reviewers

Financial Automation

guard = SentinelAutoGenGuard(rulepack_path="rulepacks/finra.yml", tenant_id="finance")
  • Blocks transfers above thresholds without multi-factor confirmation

Offline Mode

guard = SentinelAutoGenGuard(
    tenant_id="airgap",
    rulepack_path="rulepacks/offline.yml",
    cache_path=".cache/aisentinel.sqlite",
)

Performance Benchmarks

from aisentinel.testing import benchmark_autogen

stats = benchmark_autogen(assistant, guard, cases="./benchmarks/autogen.jsonl")
print(stats.latency_p95)

Multi-Tenant Sessions

guard = SentinelAutoGenGuard.from_pool([
    {"tenant_id": "research", "rulepack": "rulepacks/research.yml"},
    {"tenant_id": "support", "rulepack": "rulepacks/customer_service.yml"},
])

Select tenant per conversation using guard.for_tenant("support").