Antbase/Documentation

CrewAI Integration

Power CrewAI multi-agent workflows with Antbase. Each agent can use a different virtual model -- fast agents for triage, reasoning agents for analysis, and coding agents for implementation.

What this enables

  • Multi-agent crews with Antbase routing per agent role
  • Different virtual models for different agent specializations
  • Automatic failover -- agents keep working when providers go down
  • Cost optimization by using ant:fast for simple agents

Quick Start

1. Install dependencies

pip install crewai crewai-tools

2. Configure environment

# .env
OPENAI_API_BASE=https://antbase.ai/v1
OPENAI_API_KEY=your-ant-api-key

3. Create a crew

from crewai import Agent, Task, Crew, LLM

# Create an Antbase-backed LLM
llm = LLM(
    model="ant:auto",
    base_url="https://antbase.ai/v1",
    api_key="your-ant-api-key",
)

# Define agents
researcher = Agent(
    role="Research Analyst",
    goal="Find and analyze relevant information",
    backstory="Expert researcher with attention to detail",
    llm=llm,
)

writer = Agent(
    role="Content Writer",
    goal="Write clear, engaging content",
    backstory="Skilled writer who distills complex topics",
    llm=llm,
)

# Define tasks
research_task = Task(
    description="Research the latest trends in {topic}",
    expected_output="A detailed summary with key findings",
    agent=researcher,
)

writing_task = Task(
    description="Write a blog post based on the research",
    expected_output="A polished 800-word blog post",
    agent=writer,
)

# Run the crew
crew = Crew(agents=[researcher, writer], tasks=[research_task, writing_task])
result = crew.kickoff(inputs={"topic": "edge AI"})

Configuration

Assign different virtual models to agents based on their role:

fast_llm = LLM(model="ant:fast", base_url="https://antbase.ai/v1", api_key="your-ant-api-key")
best_llm = LLM(model="ant:best", base_url="https://antbase.ai/v1", api_key="your-ant-api-key")
reasoning_llm = LLM(model="ant:reasoning", base_url="https://antbase.ai/v1", api_key="your-ant-api-key")
coder_llm = LLM(model="ant:coder", base_url="https://antbase.ai/v1", api_key="your-ant-api-key")

# Triage agent -- fast, low cost
triage = Agent(role="Triage", goal="Classify incoming requests", llm=fast_llm)

# Analyst -- needs deep reasoning
analyst = Agent(role="Analyst", goal="Analyze data and draw conclusions", llm=reasoning_llm)

# Developer -- code generation
developer = Agent(role="Developer", goal="Write clean production code", llm=coder_llm)

# Reviewer -- high quality output
reviewer = Agent(role="Reviewer", goal="Review and polish final deliverable", llm=best_llm)

Usage Examples

Sequential crew with tools

from crewai_tools import SerperDevTool, ScrapeWebsiteTool

search_tool = SerperDevTool()
scrape_tool = ScrapeWebsiteTool()

researcher = Agent(
    role="Researcher",
    goal="Gather comprehensive information",
    tools=[search_tool, scrape_tool],
    llm=LLM(model="ant:best", base_url="https://antbase.ai/v1", api_key="your-ant-api-key"),
)

crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, writing_task],
    verbose=True,
)
result = crew.kickoff()

Virtual Models

ModelBest forNotes
ant:autoGeneral useClassifies prompt and picks optimal model
ant:fastTriage agents, classificationLowest latency and cost per agent call
ant:bestReview, synthesisFrontier models for high-quality output
ant:freeDevelopment, testingZero cost during crew development
ant:reasoningAnalysis, planningChain-of-thought for complex multi-step tasks
ant:coderCode generationCode-optimized models for developer agents

See Virtual Models for the full list.

Troubleshooting

Agent loops or repeated outputs

Try using ant:best for agents that get stuck in loops. Stronger models follow CrewAI's instruction format more reliably.

Rate limiting with many agents

Crews with many agents can generate bursts of concurrent requests. If you hit 429 errors, reduce crew concurrency or contact support for higher rate limits.