AutoGen AgentChat tracing with Future AGI
Trace an existing AutoGen AgentChat team and plan your migration to Microsoft Agent Framework.
Trace an existing AutoGen AgentChat team’s conversation in Future AGI while you plan its migration.
Warning
Microsoft no longer maintains AutoGen and does not provide bug fixes, security fixes, or support. New projects should use Microsoft Agent Framework. For existing applications, assess the security risks of continuing to use AutoGen and follow Microsoft’s AutoGen migration guide.
Plan your migration
Microsoft Agent Framework is not a drop-in replacement for AutoGen. Follow the migration guide to update your agents, model clients, tools, and multi-agent orchestration. Before switching an existing application, check its task results, tool calls, errors, and privacy settings, then check the resulting traces in Future AGI. Do not assume the new framework produces the same spans or attributes.
The pinned setup below is for applications that still use autogen_agentchat, not the legacy autogen.UserProxyAgent API or AG2. You can keep using the published traceAI-autogen package while migrating; this does not restore upstream AutoGen maintenance or security support.
1. Install
Use Python 3.10–3.13. Install the published AutoGen instrumentor with matching AgentChat and extension versions:
pip install "traceAI-autogen==0.2.1" "autogen-agentchat==0.7.5" "autogen-ext[openai]==0.7.5"
2. Configure credentials and capture
Set credentials in your shell, not in source code:
export OPENAI_API_KEY="your-openai-api-key"
export FI_API_KEY="your-futureagi-api-key"
export FI_SECRET_KEY="your-futureagi-secret-key"
Warning
Use non-sensitive sample data for this recipe. The AutoGen instrumentor records task text and can record messages, tool data and errors in autogen.* attributes. Do not rely on FI_HIDE_INPUTS or FI_HIDE_OUTPUTS to suppress these integration-specific fields. If your workload requires content suppression, leave AutogenInstrumentor disabled for that workload.
3. Initialize tracing
Keep the provider local to this instrumentor, as shown below. Do not combine this setup with AutoGen native tracing or another AutoGen instrumentor exporting to the same project; overlapping instrumentation can record the same operation more than once. Put both Python blocks in the same script.
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
from traceai_autogen import AutogenInstrumentor
trace_provider = register(
project_type=ProjectType.OBSERVE,
project_name="autogen_agents",
set_global_tracer_provider=False,
)
AutogenInstrumentor().instrument(tracer_provider=trace_provider)
4. Run a short conversation
This example uses a round-robin team with one assistant. It does not configure a code executor or execute model-generated code.
import asyncio
import os
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.conditions import MaxMessageTermination
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_ext.models.openai import OpenAIChatCompletionClient
async def main():
model_client = OpenAIChatCompletionClient(
model="gpt-4o",
api_key=os.environ["OPENAI_API_KEY"],
)
try:
assistant = AssistantAgent(
name="assistant",
model_client=model_client,
system_message="Answer concisely in one sentence.",
)
team = RoundRobinGroupChat(
participants=[assistant],
termination_condition=MaxMessageTermination(max_messages=2),
)
result = await team.run(task="What is the capital of France?")
print(result.messages[-1].content)
finally:
await model_client.close()
try:
asyncio.run(main())
finally:
trace_provider.force_flush()
trace_provider.shutdown()
Choose a model available to your OpenAI account and supported by the AutoGen model client. The instrumentor wraps team operations; it does not guarantee a span for every internal framework operation.
5. View the trace
Open Observe, select autogen_agents, and open the team-run trace to inspect its duration and captured conversation. If a short script exits without exporting its last spans, ensure it flushes the trace provider as shown above.
Questions & Discussion