Skip to main content
AG2 (formerly AutoGen) is a framework for building multi-agent conversational AI systems. AgentOps provides seamless, automatic instrumentation for AG2 — just call agentops.init() and all agent interactions are tracked.

Installation

Setting Up API Keys

Before using AG2 with AgentOps, you need to set up your API keys. You can obtain: Then to set them up, you can either export them as environment variables or set them in a .env file.
Then load the environment variables in your Python code:

Usage

Initialize AgentOps at the beginning of your application to automatically track all AG2 agent interactions:

Examples

AG2 Async Agent Chat

AG2 Async Agent Chat with Automated Responses

Async Human Input

Demonstrates asynchronous human input with AG2 agents.

Wikipedia Search Tool

Example of AG2 agents using a Wikipedia search tool.

Multi-Agent Group Chat

Orchestrate a team of specialized agents (researcher, coder, critic) with full AgentOps tracing.

Resources

AG2 - AgentOps Ecosystem Docs

Official AG2 documentation on integrating with AgentOps.

AG2 OpenTelemetry Tracing

Full observability for multi-agent systems with AG2’s built-in tracing.