Skip to content
Benchmarks

Benchmarking agent instantiation

Serving agents in production requires a new agent per request. Here is the cost, and how to verify every number yourself.

3.2 microseconds per instantiation5.2 KiB per agent1,000 iterations / framework

Why a new agent per request

In production, one process serves many users, and agents complicate that arrangement because they hold state: conversation history, memory and whatever their tools cached along the way. Share a single agent between users and user A's context surfaces in user B's session. The failure is a data leak, and it is silent; nothing warns you when it happens. Isolation has to be structural: a new agent per request.

The common workaround is to externalize state and share one object. That holds only while every tool you ever write remains stateless, an invariant no framework can enforce and few codebases preserve. Web frameworks settled this long ago: FastAPI gives each request its own database session, and nothing leaks because nothing is shared. Agents warrant the same discipline.

What remains is the question of cost. With Agno, a fresh agent costs 3.2 microseconds and 5.2 KiB: one CPU core creates roughly 300,000 agents a second, and a gigabyte of memory holds roughly 200,000. At that price the pattern is free. At 18 milliseconds per agent it is not, and the natural remedy, pooling agents to save time, reintroduces precisely the sharing the pattern exists to prevent.

The measurements

FrameworkVersionInstantiation (median)Memory (median)Time vs AgnoMemory vs Agno
Agno2.8.73.2 µs5.2 KiB
LangGraph1.2.101.1 ms145.4 KiB342×27.8×
CrewAI1.15.1418.3 ms23.6 KiB5,736×4.5×

Median of 1,000 iterations per framework, 10 warmup runs, each framework in its own process. Measured 2026-08-09 on Apple M4 Max · macOS 15.7 · Python 3.12.8, against published PyPI releases. The measured function instantiates one agent with one tool and a model binding in each framework.

Run it yourself

These results are reproducible. The harness lives in the Agno repository and each script is a page of code: it builds the framework's own quickstart agent and times it. No API keys, no model calls, nothing to wait on.

One distinction matters here: these benchmarks measure construction, not inference. Model calls dominate any real workload, and a faster constructor will not make an agent answer faster. What these numbers decide is whether a fresh agent per request is negligible or expensive.

There are also cases where they carry no weight. With a single tenant, or a shared object you can prove holds no state, the cost rounds to zero. The moment you serve a second user, you pay it on every request.

Frequently asked questions

Because agents hold state: conversation history, memory and whatever a tool cached along the way. Share one agent between users and that state travels with it, which is how user A’s data ends up in user B’s session. Externalizing state helps only if every tool you ever write remains stateless, an invariant no framework can verify for you. The sound approach is the one FastAPI takes with database sessions: give every request its own. An object cannot leak state it never shared. The open question is whether instantiation is cheap enough to repeat on every request, and that is what these numbers measure.

Each script instantiates one agent with one tool and a model binding; we record the median time and memory over 1,000 runs, with every framework in its own process. The harness is open source in the Agno repository. It measures construction alone. Inference is a separate question, and model calls dominate it in every framework.

With a single tenant, they do not. With a shared object you can prove holds no state, they do not either. They begin to matter the moment you serve more than one user, because from then on you pay the instantiation cost on every request, multiplied by your request rate.