Frameworks: What They Abstract and What It Costs
Agent frameworks package prompt templates, tool registries, loops, state graphs, memory and tracing; the abstraction saves boilerplate and costs visibility, and the right choice depends on which you need more.
What a framework actually provides
Strip the marketing and every agent framework is a bundle of six things you would otherwise write yourself. Knowing the list lets you evaluate a framework by asking, for each item, whether its version is better than the fifty lines you would write and whether you need it at all.
- Prompt templates: composing system prompts, few-shot examples and variable substitution; sometimes with versioning.
- Tool registries: turning functions into JSON schemas, dispatching model tool calls to code, validating arguments (Tool Schemas).
- The loop: the model → tool → model iteration from The Agent Loop, with retries and step limits of varying quality.
- State graphs: explicit nodes and edges for Workflow State Graph designs, with persistence and resumption.
- Memory: conversation buffers, summarisation, vector-backed recall (Memory Architectures).
- Tracing: spans for model and tool calls, usually integrated with the vendor’s observability product (Tracing Agents).
Abstraction levels
Frameworks sit at three levels, and the level matters more than the brand. Low-level libraries (typed model clients, schema helpers, the Vercel AI SDK, Pydantic AI) give you primitives and leave the loop to you; you see every prompt. Mid-level graph runtimes (LangGraph, Google ADK, Microsoft Agent Framework) give you an explicit state machine with persistence; the control flow is yours, the plumbing is theirs. High-level agent frameworks (CrewAI, LangChain agents, OpenAI Agents SDK in its default mode) give you roles, tasks and an autonomous loop; you write descriptions and the framework writes the prompts.
The higher the level, the faster the demo and the harder the production incident. Each level is the right choice for some team; the failure is picking a high-level framework for a system that needs low-level control, or writing a graph runtime from scratch when one exists. The Framework Explorer at /agentic/frameworks compares the individual frameworks along these axes with code samples.
The cost of abstraction
Hidden prompts. High-level frameworks inject their own system prompt text: role descriptions, formatting instructions, tool-use scaffolding. You did not write it, you cannot easily see it, and it changes between versions. When the agent misbehaves, the cause may be a sentence you have never read. When you tune your prompt, you are tuning a fraction of what the model sees.
Hard-to-debug loops. A framework’s loop has its own retry logic, its own termination condition and its own error handling. When it loops or stops early, the trace shows framework internals, and the fix may require monkey-patching. The bounded loop from Budgets, Limits and Termination is trivial to write and to reason about; a framework’s equivalent is a configuration flag whose semantics you must look up.
Version churn. The field moves fast and frameworks move with it: renamed modules, deprecated agent classes, breaking changes in minor versions. A system built on a high-level abstraction inherits an upgrade treadmill; pinning versions inherits a security and model-support freeze. Low-level libraries churn less because they wrap fewer opinions.
Lock-in of concepts, not just code. Once the team thinks in “crews” and “tasks”, redesigning as a plain workflow feels like a rewrite even when it is a simplification. Choose abstractions you could remove.
How to choose
Start from the architecture, not the framework (Choosing the Right Abstraction). If the design is a single LLM call, structured output or a short tool loop, Option 0: No Framework applies and a framework adds only cost. If the design is a persistent, resumable state graph with human approval steps and parallel branches, a mid-level runtime saves real engineering. If you need a demo tomorrow and will throw it away, a high-level framework is fine, as long as everyone agrees it will be thrown away.
Whatever you pick, insist on three properties: you can print every prompt the model receives, you can set hard step and cost limits, and traces show your own tool names rather than framework internals. A framework that fails any of these will fail you in production.
Key points
- A framework is six things: prompt templates, tool registries, a loop, state graphs, memory, tracing; evaluate each against writing it yourself.
- Low-level libraries give primitives and visibility; mid-level runtimes give state graphs; high-level frameworks give autonomy and hide prompts.
- Abstraction costs: hidden prompts, opaque loops, version churn, and conceptual lock-in.
- Choose the architecture first, then the lowest abstraction level that implements it.
- Non-negotiables: printable prompts, hard limits, traces with your own tool names.
When to use — and when not to
- Mid-level graph runtimes for persistent, resumable workflows with approval steps and parallel branches.
- Low-level SDKs and schema helpers for almost every tool-calling system.
- High-level frameworks for disposable prototypes and internal demos.
- Do not adopt a high-level framework for a system with security or compliance requirements you must be able to explain.
- Do not pick a framework before the architecture is decided.
- Do not use a framework’s memory or RAG defaults in production without evaluating them against a plain implementation.
Failure modes
- A hidden framework prompt tells the model to “be helpful and complete the task at all costs”, overriding your refusal rules.
- The framework loop has no cost cap; a demo pattern ships and one request costs $40.
- A minor version upgrade renames the agent class and breaks production on deploy day.
- Traces show
AgentExecutor.stepforty times and nobody can tell which tool ran. - The team cannot answer “what exactly did the model see?” during an incident.
Tradeoffs
Ratings for a typical high-level framework; low-level libraries score close to no-framework.