How infy is measured
Framework overhead is isolated by porting real LangChain and LangGraph projects to infy and replacing the LLM call with a deterministic, offline leaf: no API keys, no GPU, no network. Only the orchestration differs between the two ports, so the difference is the framework. Every port is verified to produce byte-identical output before any timing is trusted.1
Start from a real project
Take an existing LangChain or LangGraph agent, not a toy written to flatter one side.
2
Port to both frameworks over a shared leaf
Produce two orchestrations, port A on LangGraph and port B on infy, that call the same deterministic mocked leaf.
3
Verify byte-identical output
Run both. If the outputs differ, fix the port. Do not measure a port that has not reached parity.
4
Measure the ratios
With output held identical, measure orchestration LOC, cold start, per-invoke latency, and RSS over a bare-interpreter baseline.
The ratios are the portable result, not the absolute milliseconds. Timings are machine-relative; ratios carry across machines.
What each metric means
Environment. Windows, CPython 3.13, virtualenv. Release build of the Rust core (
maturin develop --release). LangGraph 1.x and langchain-core 1.x.
The headline
Across a corpus of about 37 community agents, offline and with framework overhead isolated, the median result is:
The LOC story is the quiet one: most ports are the LangGraph file with a single import line changed, so parity is expected. A handful came out meaningfully smaller.
The full range across the 37 agents
The lighter graphs cluster high on cold start, most landing near 8 to 9x, because there is less per-graph work to dilute infy’s lean import. The honest low end is the smallest graph in the corpus, an academic task-planning agent, where the framework does the least: its cold-start edge shrinks to 2.5x and memory to 1.9x.
The conservative view
On seven heavier ported projects (finance fan-outs, ReAct loops, nested subgraphs, middleware stacks), the advantage is smaller but still decisive:
The latency advantage scales with how much framework machinery the incumbent layers on: pydantic state, LCEL structured output, nested subgraphs, and middleware stacks all widen the gap.
The seven heavier projects, per-project
The seven heavier projects, per-project
Ratios are infy-relative: higher is better, and for LOC,
>1.0x means infy is smaller.Project 04 (the browser-automation agent) is the honest counter-example: a per-step pydantic agent, not a LangGraph, where the incumbent’s fused
pydantic-core model_validate_json beat infy’s older two-pass parse. That gap has since been addressed. with_structured_output now delegates to pydantic-core.model_validate_json when given a pydantic model.The honest caveat
The per-invocation multiples (12x to 93x, and higher on the simplest agents) measure a real CPU cost, but they describe the framework’s time, not the request’s. Once a live model call is in the loop, a ~1 to 3 s network round-trip dominates, and end-to-end wall clock between frameworks is effectively at parity. What survives into production is cold start and memory footprint, costs paid on every request and per running agent. That is why infy targets serverless, edge, and high-density multi-tenant deployments, where those are the dominant terms.Coverage and what was excluded
The corpus was a public collection of roughly fifty community agent tutorials. Gaps are documented, not forced: no infy feature was added to win a port.- 37 ported and verified byte-identical, then measured.
- 12 documented as out of scope, built on a different framework, or driven by a live external service (web search, image or audio generation, a real vector store, or MCP servers) that cannot be reduced to a deterministic offline leaf.
- 2 did not reach byte-identical parity and were dropped rather than reported.
Governance, free enough to leave on
The governance layer runs in-process at the tool chokepoint, so the fair question is whether it is cheap enough to enable on every agent. Measured on a realcreate_agent loop issuing 5 tool calls, with all arms producing byte-identical output:
infy governance adds about 50 µs per tool call. Against the ~1 to 2 s real LLM call it guards, that is roughly 0.003% overhead. Governance is free enough to leave on for every agent.
Reproduction
The benchmark harness (ported projects plus measurement scripts) is kept out of the published package. The methodology above is enough to reproduce the shape of the results: port a project to both frameworks, share a deterministic leaf, verify byte-identical output, then measure LOC, subprocess cold start, per-invoke latency, and RSS over a bare-interpreter baseline. Ratios are portable across machines; absolute timings are not.Governance overview
The in-process control plane the governance benchmark measures.
The graph runtime
The superstep executor whose cold start and memory these numbers isolate.