anoman
Agent Integration Guides
Python

Connect CrewAI to Anoman AI

Configure CrewAI agents to route all LLM calls through Anoman using the OpenAI-compatible base URL. Guardrails and policy enforcement apply to every crew task with zero changes to your crew definition.

Prerequisites

  • An Anoman AI account with an active API key
  • Python 3.10+
  • CrewAI installed

Step 1: Install dependencies

pip install crewai crewai-tools

Step 2: Configure the LLM with Anoman

Create a LLM instance pointing to Anoman's OpenAI-compatible endpoint. Pass this as the llm parameter on each agent.

from crewai import Agent, Crew, Task
from crewai import LLM

# Configure Anoman as the LLM backend
anoman_llm = LLM(
    model="gpt-4o-mini",
    api_key="anm-sk-your-key-here",
    base_url="https://api.anoman.io/v1",
)

Step 3: Define agents with Anoman LLM

Pass the anoman_llm instance to each agent. Your crew definition stays unchanged — every LLM call routes through Anoman automatically.

researcher = Agent(
    role="Research Analyst",
    goal="Find and summarize relevant information",
    backstory="You are an expert at finding and synthesizing information.",
    llm=anoman_llm,
    verbose=True,
)

writer = Agent(
    role="Content Writer",
    goal="Produce clear, accurate reports",
    backstory="You transform research into well-structured documents.",
    llm=anoman_llm,
    verbose=True,
)

research_task = Task(
    description="Research the latest developments in AI safety.",
    agent=researcher,
    expected_output="A summary of key findings.",
)

write_task = Task(
    description="Write a report based on the research.",
    agent=writer,
    expected_output="A 500-word report.",
)

crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, write_task],
    verbose=True,
)

result = crew.kickoff()
print(result)

Alternative: environment variables

If you prefer not to pass api_key and base_url explicitly, set them as environment variables. CrewAI reads these when OPENAI_API_KEY is set.

export OPENAI_API_KEY=anm-sk-your-key-here
export OPENAI_BASE_URL=https://api.anoman.io/v1

When a guardrail triggers

If a task prompt is blocked by the guardrail pipeline, the API returns a 403. CrewAI surfaces this as an exception on the affected task.

{
  "error": {
    "code": "guardrail_triggered",
    "message": "Request blocked by guardrail pipeline",
    "guardrail": "injection",
    "score": 0.91
  }
}

Check docs/openapi/ for the current error schema.

Need help with your integration?

Join the Founding 50 for early access and direct support from the Anoman team.

Join Founding 50