Skip to main content
AutoGen (also distributed as ag2) is a framework for building multi-agent LLM applications where agents converse with each other to complete tasks. AutoGen accepts an OpenAI-compatible base_url in its config_list, so you can route all agent requests through the Portkey AI Gateway with minimal changes.

Installation

1

Start the gateway

The gateway listens at http://localhost:8787/v1.
2

Install dependencies

Basic setup

Set base_url inside each entry of config_list to point at the gateway.

Adding routing configs via headers

Pass gateway configs through default_headers inside each config list entry.

Real-world use case: multi-agent coding assistant

A three-agent group chat where each agent can use a different model, all routed through the gateway.
AutoGen uses the api_type field to determine how to format requests. Always set "api_type": "openai" when routing through the Portkey gateway, regardless of the underlying provider.
Each agent in a group chat can use a different model and provider. Route cost-sensitive agents to cheaper models and critical orchestration agents to more capable ones.