Skip to main content

AutoGen

Microsoft AutoGen configures LLM access through llm_config dicts that accept any OpenAI-compatible endpoint. Ferro Labs AI Gateway is a drop-in.

Installโ€‹

pip install pyautogen

Configureโ€‹

import os
from autogen import ConversableAgent

config_list = [
{
"model": "claude-3-5-sonnet-20241022", # routed to Anthropic by Ferro
"api_key": os.environ["FERRO_API_KEY"],
"base_url": os.environ["FERRO_BASE_URL"] + "/v1",
}
]

agent = ConversableAgent(
name="assistant",
llm_config={"config_list": config_list},
)

reply = agent.generate_reply(messages=[{"role": "user", "content": "Hello from AutoGen"}])
print(reply)

To give different agents different providers, build per-agent config_lists with different model values.

Verifyโ€‹

curl http://localhost:8080/v1/chat/completions \
-H "Authorization: Bearer $FERRO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o","messages":[{"role":"user","content":"hi"}]}'

See alsoโ€‹

  • CrewAI โ€” alternative multi-agent framework
  • LangGraph โ€” explicit graph-based agents