The Post-Framework Era: Build Agents with an API Client and a While Loop
The most effective AI agents in production today look nothing like the framework demos. They are not directed acyclic graphs with seventeen node types. They are not multi-agent swarms coordinating through message buses. They are a prompt, a tool list, and a while loop — and they ship faster, break less, and cost less to maintain than their framework-heavy counterparts.
This is not a contrarian take for its own sake. It is the conclusion that team after team reaches after burning weeks on framework migration, abstraction debugging, and DSL archaeology. The pattern is so consistent it deserves a name: the post-framework era.
The Framework Trap
Every agent framework tells the same story: "You could write this yourself, but why would you?" The pitch is compelling. Frameworks handle tool parsing, retry logic, state management, and provider abstraction. They promise that you can swap models, add memory, and scale to multi-agent systems without touching your core logic.
The reality is different. The moment you need something slightly outside the framework's happy path — a custom retry policy, a non-standard tool response format, a provider-specific parameter — you find yourself spelunking through five layers of abstraction to change a single detail. One developer on Hacker News captured it perfectly: they replaced an entire LangChain pipeline with 80 lines of Python and gained debuggability, monitoring, and control in the process.
This is not a LangChain-specific problem. It is structural. Agent frameworks emerged during a period when LLMs were less capable and needed more scaffolding — explicit chain-of-thought prompting, manual output parsing, JSON schema enforcement. Modern models with native tool calling, expanded context windows, and improved instruction following have made many of those abstractions unnecessary. The scaffolding that was essential in 2023 is dead weight in 2026.
The Minimal Agent Architecture
Strip an agent down to its essential components and you get three things:
- A system prompt that defines goals, constraints, and behavior
- A set of tools that the model can call to interact with external systems
- A loop that sends messages to the model, executes tool calls, feeds results back, and repeats until the model signals completion
That is the entire architecture. In Python, it looks roughly like this: you instantiate an API client, set up a conversation with a system message, and enter a while loop. Each iteration sends the conversation to the model, checks whether the response includes tool calls, executes them, appends the results, and continues. When the model responds with text instead of tool calls, you are done.
This pattern handles a surprising range of production use cases: customer support bots that look up order status and issue refunds, code review agents that read diffs and post comments, data pipeline monitors that query metrics and trigger alerts. These are not toy examples. They are agents running in production at companies that tried frameworks first and switched back to the simple loop.
What Frameworks Actually Solve (and When You Need Them)
Acknowledging the power of simplicity does not mean frameworks have zero value. They solve real problems — but only three of them genuinely warrant the abstraction tax:
Persistent state across sessions. If your agent needs to resume a conversation days later with full context, you need durable state management. Serializing conversation history to a database is straightforward, but checkpointing mid-execution state (which tools were called, which subtasks completed, what the agent was planning to do next) is genuinely hard. LangGraph's state graph model solves this well.
Human-in-the-loop workflows. When an agent needs human approval before executing high-stakes actions — transferring money, deleting data, sending external communications — you need interruption points, approval queues, and timeout handling. This is workflow orchestration, and frameworks like Temporal or even LangGraph handle it better than hand-rolled solutions.
Multi-agent coordination. When multiple specialized agents need to discover each other, negotiate task ownership, share intermediate results, and handle partial failures, you are building a distributed system. Message passing, state checkpointing, handoff protocols, and failure recovery are genuine engineering challenges that benefit from shared infrastructure.
For everything else — which covers roughly 80% of production agent deployments — the while loop wins. Most agents do not need persistent multi-session state. Most do not need human approval gates. Most are single agents with a clear task and a fixed tool set. Adding a framework to these agents is like using Kubernetes for a cron job.
The Abstraction Tax
Every layer of abstraction between you and the LLM API imposes costs that compound over the lifecycle of a project:
Debugging opacity. When your agent produces a bad output, you need to understand what happened. With a direct API call, you can log the exact messages sent and received, inspect tool call arguments, and reproduce the issue with a curl command. With a framework, you are tracing through chain executors, callback handlers, and state transformers to reconstruct what the model actually saw.
Upgrade fragility. Frameworks ship breaking changes because the underlying models change. When a provider adds a new parameter, changes tool call format, or deprecates an endpoint, the framework must adapt — and your code must adapt to the framework's adaptation. With direct API calls, you read the changelog and update one line.
Cognitive overhead. Every framework introduces its own vocabulary: chains, runnables, graphs, nodes, edges, agents, crews, flows. New team members must learn the framework before they can understand the agent. The while loop pattern is self-documenting. A junior engineer can read it and understand what is happening in minutes.
Performance drag. Frameworks add latency through serialization, deserialization, middleware execution, and callback invocations. For a single tool call, this is negligible. For an agent that makes 20 tool calls in a loop, the overhead adds up — in both latency and token cost when the framework injects its own system prompts or formatting.
Patterns That Make Simple Agents Production-Ready
The while loop is the foundation, but production agents need a few patterns layered on top:
Structured error handling. When a tool call fails, append the error as a tool result and let the model decide what to do. Models are surprisingly good at recovering from errors — retrying with different parameters, trying an alternative tool, or asking the user for clarification. Do not build a retry framework; let the model be the retry logic.
Token budget management. Long-running agents can exhaust context windows. Track token usage per iteration and implement a simple strategy: when approaching the limit, summarize the conversation so far and continue with a compressed context. This is a few lines of code, not a memory subsystem.
Explicit tool documentation. The quality of your tool descriptions matters more than any framework feature. Treat tool descriptions like API documentation for an external developer. Include parameter types, expected formats, example inputs, and failure modes. A well-documented tool with a simple loop outperforms a poorly documented tool with a sophisticated orchestrator.
Execution traces. Log every model call, tool invocation, and result. Not in a framework-specific format — in plain structured JSON that you can grep, filter, and analyze with standard tools. This trace is your debugger, your profiler, and your audit log.
Cost guards. Set a maximum number of iterations and a maximum token spend per agent run. When either limit is hit, return whatever partial result the agent has and flag the run for review. This prevents the infinite-loop failure mode that haunts autonomous agents.
The Best Agent Code Looks Like Boring Application Code
There is a reason the most successful agent deployments do not make conference talks exciting. They look like ordinary backend services: a request comes in, some API calls happen in a loop, results are returned. The business logic is in the prompts and tools, not in the orchestration layer.
This is the key insight. The intelligence is in the model, not in the framework. Your job as the developer is to give the model clear instructions, useful tools, and a simple execution loop. Everything else is ceremony.
The post-framework era does not mean frameworks disappear. It means they retreat to the narrow set of problems they genuinely solve — persistent state, human-in-the-loop, multi-agent coordination — and stop pretending to be general-purpose agent infrastructure. For the vast majority of agents, the right architecture is the one you can fit in your head: a prompt, some tools, and a while loop.
Start there. Add complexity only when you have a specific problem that simplicity cannot solve. You will be surprised how rarely that happens.
- https://www.anthropic.com/research/building-effective-agents
- https://news.ycombinator.com/item?id=40739982
- https://langfuse.com/blog/2025-03-19-ai-agent-comparison
- https://www.mindstudio.ai/blog/llm-frameworks-replaced-by-agent-sdks
- https://47billion.com/blog/ai-agents-in-production-frameworks-protocols-and-what-actually-works-in-2026/
- https://zircon.tech/blog/agentic-frameworks-in-2026-what-actually-works-in-production/
- https://huggingface.co/blog/smolagents
