integrations/framework/AutoGen
AG

AutoGen + AIgateway

Microsoft's multi-agent conversation framework — point any agent at AIgateway.

AutoGen v0.4+ models the world as conversing agents. Each agent's LLM client accepts an OpenAI-compatible base URL, so AIgateway slots in transparently for every agent in the conversation graph.

AutoGen homepage →
Setup

Three steps or fewer.

STEP 01

Install

pip install autogen-agentchat autogen-ext[openai]
STEP 02

Configure the model client

OpenAIChatCompletionClient accepts base_url and api_key. Use AIgateway's endpoint and key — every agent that takes this client routes through us.

from autogen_ext.models.openai import OpenAIChatCompletionClient

client = OpenAIChatCompletionClient(
    model="anthropic/claude-opus-4.7",
    base_url="https://api.aigateway.sh/v1",
    api_key="sk-aig-...",
)
STEP 03

Use across an agent graph

Hand the client to AssistantAgent, UserProxyAgent, RoundRobinGroupChat — wherever AutoGen expects a model. Tool calls, structured output, and streaming all work.

from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.conditions import MaxMessageTermination

writer = AssistantAgent("writer", client, system_message="Draft.")
critic = AssistantAgent("critic", client, system_message="Critique.")
team = RoundRobinGroupChat(
    [writer, critic],
    termination_condition=MaxMessageTermination(6),
)
await team.run(task="Write a paragraph on edge inference.")
Notes
  • AutoGen v0.4 ships with native model_info passing — make sure model_info matches the AIgateway model's capabilities (tool calling, vision, json mode) for the right client behavior.
  • Different agents can use different AIgateway models — just instantiate multiple OpenAIChatCompletionClients with different model strings.
  • Pair with /v1/evals to grade an AutoGen pipeline across candidate models on real conversation traces.
More integrations

Same key. Every other tool.