Integrations

AutoGen Integration

AutoGen reply hooks and group chat audit integration.

AutoGen Integration

Overview

AgentTrust integrates with Microsoft AutoGen via AgentTrustReplyHook (per-message validation) and AgentTrustGroupChatMonitor (post-conversation audit).

Tier: Team+ for adapters · OSS for basic @harness wrapping

Why It Matters

AutoGen group chats involve multiple agents exchanging messages. Governance hooks validate each reply and audit the full conversation.

Prerequisites

pip install agentrust-sdk pyautogen

Step-by-Step Guide

Reply hook (per message)

from agentrust_sdk import AgentTrustReplyHook

hook = AgentTrustReplyHook(agent_id="autogen-assistant")

# Register as reply function hook in AutoGen agent config

Group chat monitor

from agentrust_sdk import AgentTrustGroupChatMonitor

monitor = AgentTrustGroupChatMonitor(agent_id="autogen-group")
# Attach to group chat for post-conversation audit

Alternative: @harness on wrapper

from agentrust_sdk import harness

@harness(agent_id="autogen-wrapper", framework="AutoGen")
def run_group_chat(user, input):
    result = group_chat.run(input)
    return {"conversation": result}

Examples

See examples/autogen_agent.py.

Best Practices

  • Use reply hook for real-time per-message governance
  • Use group monitor for conversation-level audit trail
  • Set distinct agent IDs per AutoGen agent role

Common Mistakes

  • Team adapter without API key
  • Validating only final message (miss intermediate risky outputs)

Troubleshooting

IssueFix
Hook not calledVerify hook registration in agent config
TierGateErrorTeam tier for adapter classes