Skip to content

CrewAI

CrewAI builds role-playing multi-agent systems. It uses LiteLLM under the hood, which natively supports OpenAI-compatible providers — so ai& works by setting two env vars.

Terminal window
pip install crewai
Terminal window
export OPENAI_API_KEY="sk-your-aiand-api-key"
export OPENAI_API_BASE="https://api.aiand.com/v1"
from crewai import Agent, Task, Crew, LLM
llm = LLM(model="openai/openai/gpt-oss-120b")
researcher = Agent(
role="Researcher",
goal="Find accurate information",
backstory="An experienced research analyst.",
llm=llm,
)
writer = Agent(
role="Writer",
goal="Write a clear summary",
backstory="A concise technical writer.",
llm=llm,
)
research_task = Task(
description="Research the city of Tokyo — population, history, notable features.",
expected_output="Bullet points covering the key facts.",
agent=researcher,
)
write_task = Task(
description="Write a 100-word summary based on the research.",
expected_output="A 100-word paragraph.",
agent=writer,
)
crew = Crew(agents=[researcher, writer], tasks=[research_task, write_task])
print(crew.kickoff())
from crewai.tools import tool
@tool("get_weather")
def get_weather(city: str) -> str:
"""Get current weather for a city."""
return f"Sunny in {city}, 22°C"
researcher = Agent(
role="Weather Reporter",
goal="Answer weather questions",
backstory="A meteorologist.",
llm=llm,
tools=[get_weather],
)