Skip to content
Try Hanzo
Language: English (United States)

Use Hanzo AI with AutoGen

Build multi-agent systems with Microsoft AutoGen. Set base_url to api.hanzo.ai/v1 in the AutoGen config, name a Hanzo model, and the agents run on it.

Get API key — Free
AutoGen setuppython
pip install pyautogen
 
import autogen
 
config_list = [{
    "model": "zen4-pro",
    "api_key": "your-hanzo-api-key",
    "base_url": "https://api.hanzo.ai/v1",
}]
 
assistant = autogen.AssistantAgent(
    name="assistant",
    llm_config={"config_list": config_list},
)
 
user_proxy = autogen.UserProxyAgent(
    name="user_proxy",
    human_input_mode="NEVER",
)
 
user_proxy.initiate_chat(assistant, message="Write a Python script to sort a list.")
2 of 16 lines point at Hanzo

Multi-agent conversation

python

Multi-agent conversationpython
coder = autogen.AssistantAgent(
    name="coder",
    llm_config={"config_list": config_list},
    system_message="You write clean Python code.",
)
 
reviewer = autogen.AssistantAgent(
    name="reviewer",
    llm_config={"config_list": config_list},
    system_message="You review code for bugs.",
)
 
groupchat = autogen.GroupChat(agents=[user_proxy, coder, reviewer], messages=[])
manager = autogen.GroupChatManager(groupchat=groupchat, llm_config={"config_list": config_list})

Code execution agent

python

Code execution agentpython
user_proxy = autogen.UserProxyAgent(
    name="user_proxy",
    human_input_mode="NEVER",
    code_execution_config={"work_dir": "coding", "use_docker": False},
)

Environment setup

bash

2 of 3 lines point at Hanzo
Environment setupbash
export HANZO_API_KEY="your-hanzo-api-key"
# AutoGen picks up OAI_CONFIG_LIST or inline config
# No extra env vars needed — just point base_url to Hanzo

Hanzo AI is OpenAI-compatible, so existing AutoGen code works with zero refactoring. We deeply appreciate the Microsoft Research team for building and maintaining this open-source project.

Ready to get started?

Create a free account and get your API key. The Free plan includes free model requests and Kai decisions, no card.