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

Use Hanzo AI with CrewAI

Use CrewAI to build collaborative AI agent teams powered by Hanzo AI models. CrewAI's role-based agents work with any OpenAI-compatible provider.

Get API key — Free
CrewAI with Hanzopython
pip install crewai
 
import os
os.environ["OPENAI_API_KEY"] = "your-hanzo-api-key"
os.environ["OPENAI_API_BASE"] = "https://api.hanzo.ai/v1"
os.environ["OPENAI_MODEL_NAME"] = "zen4-pro"
 
from crewai import Agent, Task, Crew
 
researcher = Agent(
    role="Researcher",
    goal="Find accurate information on AI trends",
    backstory="Expert AI researcher with deep knowledge",
)
 
writer = Agent(
    role="Writer",
    goal="Write compelling summaries",
    backstory="Technical writer specializing in AI",
)
2 of 16 lines point at Hanzo

Tasks and Crew

python

Tasks and Crewpython
task1 = Task(
    description="Research the latest LLM benchmarks",
    expected_output="A list of top 5 models and their scores",
    agent=researcher,
)
 
task2 = Task(
    description="Write a blog post based on the research",
    expected_output="500-word blog post in markdown",
    agent=writer,
)
 
crew = Crew(agents=[researcher, writer], tasks=[task1, task2])
result = crew.kickoff()

Custom LLM config

python

4 of 12 lines point at Hanzo
Custom LLM configpython
from crewai import LLM
 
hanzo_llm = LLM(
    model="zen4-pro",
    api_key="your-hanzo-api-key",
    base_url="https://api.hanzo.ai/v1",
)
 
agent = Agent(
    role="Analyst",
    goal="Analyze data",
    backstory="Data analyst",
    llm=hanzo_llm,
)

Quick start

bash

2 of 4 lines point at Hanzo
Quick startbash
pip install crewai
export OPENAI_API_KEY="your-hanzo-api-key"
export OPENAI_BASE_URL="https://api.hanzo.ai/v1"
crewai create my-crew

Hanzo AI is OpenAI-compatible, so existing CrewAI code works with zero refactoring. We deeply appreciate the CrewAI / João Moura 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.