Use Xantly with CrewAI

CrewAI's multi-agent framework routes through LiteLLM, so any OpenAI-compatible endpoint plugs in. Xantly pairs perfectly, semantic cache is disproportionately valuable for multi-agent workloads.

CrewAI is a multi-agent orchestration framework, define agents with roles, assemble them into a crew, run a task. Under the hood it uses LiteLLM, which means any OpenAI-compatible endpoint plugs in. Xantly fits natively, and the semantic cache is disproportionately valuable for multi-agent workloads where agents re-ask similar questions.

Prerequisites

Setup

CrewAI reads standard OpenAI env vars. Set two:

export OPENAI_API_BASE=https://api.xantly.com/v1
export OPENAI_API_KEY=xantly_sk_...
export OPENAI_MODEL_NAME=xantly/auto-quality

Every Agent, Task, Crew now routes through Xantly. No code changes.

In-code config

from crewai import Agent, Task, Crew, LLM

llm = LLM(
    model="openai/xantly/auto-quality",  # crewai/litellm prefix
    base_url="https://api.xantly.com/v1",
    api_key="xantly_sk_...",
)

researcher = Agent(
    role="Senior Research Analyst",
    goal="Find key facts about {topic}",
    backstory="You cross-reference sources and cite them.",
    llm=llm,
)

writer = Agent(
    role="Technical Writer",
    goal="Write a concise summary",
    backstory="You turn dense research into 3-paragraph explainers.",
    llm=llm,
)

research = Task(
    description="Research {topic}.",
    expected_output="A bulleted list of 10 key facts with sources.",
    agent=researcher,
)

summarize = Task(
    description="Write a summary based on the research.",
    expected_output="A 3-paragraph explainer in plain English.",
    agent=writer,
)

crew = Crew(agents=[researcher, writer], tasks=[research, summarize])
result = crew.kickoff(inputs={"topic": "vector databases"})
print(result)

Per-agent model assignment

Different agents for different roles, use different Xantly tiers:

researcher = Agent(
    role="Researcher",
    llm=LLM(
        model="openai/xantly/auto-quality",
        base_url="https://api.xantly.com/v1",
        api_key="xantly_sk_...",
    ),
    # ...
)

summarizer = Agent(
    role="Summarizer",
    llm=LLM(
        model="openai/xantly/auto-value",
        base_url="https://api.xantly.com/v1",
        api_key="xantly_sk_...",
    ),
    # ...
)

Tools

CrewAI's tool system works unchanged:

from crewai.tools import tool

@tool("search_web")
def search_web(query: str) -> str:
    """Search the web for a query."""
    return "<search results for " + query + ">"

researcher = Agent(
    role="Researcher",
    tools=[search_web],
    llm=llm,
    # ...
)

Use anthropic/claude-sonnet-4.6 as the model for tool-heavy agents, reliable tool-calling is critical in multi-agent flows.

Model choice

Model IDWhen
xantly/auto-qualityOrchestrator / researcher agents, default.
xantly/auto-valueSummarizers, writers, cheaper.
xantly/auto-speedSimple classifier agents.
anthropic/claude-sonnet-4.6Tool-heavy agents, delegation patterns.
openai/gpt-5.4Structured output agents.

Verify

from crewai import Agent, Task, Crew, LLM

llm = LLM(
    model="openai/xantly/auto-speed",
    base_url="https://api.xantly.com/v1",
    api_key="xantly_sk_...",
)
agent = Agent(role="Pinger", goal="Respond", backstory="You say pong.", llm=llm)
task = Task(description="Say pong.", expected_output="pong", agent=agent)
crew = Crew(agents=[agent], tasks=[task])
print(crew.kickoff())

What you get

Gotchas

The openai/ prefix is litellm-required. CrewAI routes through LiteLLM, which requires a provider prefix. Use openai/xantly/auto-quality (OpenAI is the protocol, not the model). Full slug: openai/<xantly-model-id>.

/v1 required in base_url.

Long crew runs exceed default timeouts. Set llm=LLM(..., timeout=300) for crews that run for minutes.

Parallel agent execution. CrewAI supports async crews (Crew(async_execution=True)). Xantly handles the concurrency, but watch your per-minute rate limits, upgrade your plan if you run big crews.

Next steps