n4nAI

How much does running a CrewAI crew cost in tokens

Practical analysis of CrewAI token cost: how multi-agent overhead multiplies LLM spend, where tokens hide, and levers to cut cost without losing capability.

n4n Team5 min read1,094 words

Audio narration

Coming soon — every post will get a voice note here.

CrewAI token cost is rarely what you expect from reading the framework’s quickstart. The moment you orchestrate two or more agents, the token ledger stops looking like a sequence of chat completions and starts looking like a broadcast system where every agent re-reads shared context, appends its own instructions, and often repeats the entire task spec on each call.

The hidden multiplier in multi-agent systems

Multi-agent frameworks trade raw token efficiency for separation of concerns. That trade is justified when a task truly needs specialized reasoning, but CrewAI’s defaults lean toward verbosity. Each agent carries a role, goal, and backstory. Each task carries a description and expected output. CrewAI stitches these into a system prompt and a user message for every LLM call the agent makes.

If you run a linear crew of three agents, each handling one task, you might assume three LLM calls. In practice, each agent may call the model multiple times: once to plan, once to act, once to reflect, plus additional calls if the agent uses tools or delegates. CrewAI’s verbose mode exposes this; disable it in production but log the underlying API requests.

The multiplier is not just call count. It is context duplication. Agent A’s output becomes part of Agent B’s prompt. Agent B’s prompt now contains A’s system text, A’s task, A’s output, B’s system text, B’s task. With a third agent, the context snowballs.

Anatomy of a minimal crew

Consider a two-agent crew that researches and writes.

from crewai import Agent, Task, Crew

researcher = Agent(
    role="Researcher",
    goal="Find recent benchmarks for vector databases",
    backstory="You are a meticulous analyst with 10 years in data infra.",
    verbose=False,
)
writer = Agent(
    role="Writer",
    goal="Summarize findings into a blog post",
    backstory="You are a senior tech writer who hates fluff.",
    verbose=False,
)

task1 = Task(
    description="List 3 vector DBs and their claimed throughput.",
    expected_output="Bullet list with sources.",
    agent=researcher,
)
task2 = Task(
    description="Turn the list into a 200-word intro.",
    expected_output="Markdown paragraph.",
    agent=writer,
)

crew = Crew(agents=[researcher, writer], tasks=[task1, task2])
result = crew.kickoff()

This looks like two tasks, two agents. Under the hood, the researcher likely makes 2–4 completions: a planning step, a tool call (if you add a search tool), a synthesis step. The writer then receives the researcher’s full output plus its own role text.

Token accounting for the naive run

Assume the following per-call shape (numbers are illustrative, derived from typical prompt construction, not a benchmark):

  • Static agent system prompt: ~250 tokens (role+goal+backstory)
  • Task description: ~80 tokens
  • Prior agent output passed in: ~200 tokens after first task
  • Completion: ~150 tokens average

Researcher: 3 calls × (250+80+0 prior) prompt ≈ 990 prompt tokens, 450 completion. Writer: 2 calls × (250+80+200 prior) prompt ≈ 1,060 prompt tokens, 300 completion. Total: ~2,050 prompt, ~750 completion. About 2.8k tokens for a trivial job.

Scale that to a crew of five agents with delegation enabled and you easily cross 15–20k tokens per run, most of it redundant context.

Where tokens actually go

System prompts and backstories

CrewAI does not compress agent definitions. If you write a 60-word backstory, that is ~100 tokens repeated in every call for that agent. Multiply by number of calls. A common mistake is crafting novel-length backstories “for personality”. In a cost-sensitive deployment, treat backstory as a cacheable prefix and keep it under 30 words.

Inter-agent handoffs

By default, task outputs are passed as full text to downstream agents. If the researcher returns 500 tokens of bullet points, the writer sees all 500. If you then feed the writer’s output to an editor agent, the editor sees researcher + writer. Use Task.output_json or explicit summarization to cap handoff size.

Memory and delegation

CrewAI’s memory=True adds a retrieval step that injects relevant past runs into context. Useful for stateful agents, but each retrieval adds tokens. Delegation (allow_delegation=True) lets an agent spawn sub-tasks to peers, which multiplies calls and context. Disable both unless the workflow proves they pay for themselves.

Tool call overhead

Every tool invocation is a separate completion cycle: the agent emits a function call, the framework returns the observation, and the model is called again to ingest it. A search tool that returns 1k tokens of page text can double a single agent’s prompt for that step. Constrain tool output with max length or summarization wrappers.

Sequential vs hierarchical process

CrewAI supports process="sequential" and process="hierarchical". Sequential passes task outputs downstream linearly. Hierarchical introduces a manager agent that coordinates workers, meaning the manager reads every worker’s output and issues new instructions. That manager is another system prompt in every worker’s loop.

In a hierarchical crew of four workers, expect each worker call to include manager instructions plus peer outputs. Token cost can double versus sequential for the same end result. Use hierarchical only when dynamic task assignment is required; for fixed pipelines, sequential is cheaper.

Measuring instead of guessing

You cannot optimize what you do not meter. Wrap your LLM endpoint so every request logs usage from the response. If you point CrewAI at an OpenAI-compatible gateway such as n4n.ai, you get per-token usage metering across 240+ models from one endpoint, and the gateway forwards provider cache-control hints so repeated prefixes cost less. That turns guesswork into a line item.

Example response snippet from any OpenAI-compatible call:

{
  "usage": {
    "prompt_tokens": 1180,
    "completion_tokens": 320,
    "total_tokens": 1500
  }
}

Aggregate these per crew run, tagged by agent name (you can inject a custom header or use the gateway’s routing directives). Without this, teams discover cost spikes only when the monthly bill arrives.

Concrete optimization levers

Model routing per agent

Not every agent needs a frontier model. The researcher gathering facts can run on a small model; the writer polishing prose may need a stronger one. CrewAI lets you set llm per agent:

from langchain_openai import ChatOpenAI

researcher.llm = ChatOpenAI(model="gpt-4o-mini")
writer.llm = ChatOpenAI(model="gpt-4o")

If your gateway supports client routing directives, you can send cheaper traffic to a specific provider without code changes.

Trimming context

Rewrite tasks to be output-contract first. Instead of “Write a detailed report”, use “Return JSON with fields: summary (50 words), risks (3 bullets)”. Smaller outputs shrink downstream context. Strip backstories in production. Set verbose=False.

Limiting iterations

CrewAI agents can loop. Set max_iter on the agent to a small number (e.g., 3). Unbounded iteration is the fastest way to a $10 trivial answer.

Disable what you don’t use

Set memory=False unless you have measured a quality gain. Set allow_delegation=False on agents that should not spawn peers. Use sequential process unless dynamic orchestration is required. Each disabled feature removes a class of token amplification.

Tradeoffs: capability vs cost

Tighter prompts reduce token count but can degrade agent autonomy. A researcher with no backstory may miss nuance. Delegation costs tokens but can solve tasks a single agent fails. The decisive factor is task complexity: for well-scoped pipelines, disable memory and delegation, use small models, and you will cut CrewAI token cost by 3–10x versus defaults. For open-ended research, accept the multiplier but meter ruthlessly.

Takeaway

CrewAI token cost is dominated by duplicated context and verbose defaults, not by the raw number of agents. Measure every run, route sub-tasks to smaller models, and cap handoffs. Do that and a multi-agent crew stays within an order of magnitude of a single well-prompted call—instead of two orders beyond it.

Tagscrewaipricingtokens

Written by

n4n Team

The team building n4n — a single OpenAI-compatible API in front of 240+ models, with automatic fallback, load balancing and pay-per-token metering.

More from n4n Team →

All crewai multi-agent systems posts →