By Sagar Shankaran, Founder of CallSphere
The full stack of an agentic product on Claude: model loop, context assembler, tool layer, MCP servers, state separation, and guardrails.
Key takeaways
When a product team first wires Claude into a real application, the demo works on day one and then quietly falls apart in week three. The reason is almost never the model. It is that nobody drew the full picture of how requests flow, where state lives, which component owns retries, and what happens when a tool times out mid-task. An agentic product is a distributed system with a probabilistic core, and you have to architect it like one. This post walks the entire stack of an agentic product built on Claude — from the inbound request to the final committed action — and names the responsibility of each layer so you can reason about failure instead of being surprised by it.
An agentic system is software in which a language model decides which actions to take, in what order, to accomplish a goal — rather than following a fixed, hand-coded control flow. That single shift relocates your control flow from your code into a model loop, and everything downstream has to adapt. In a traditional service you know the call graph at compile time. In an agentic product, the call graph is generated at runtime, turn by turn, based on what Claude reads in context. Your job stops being "write the steps" and becomes "define the action space and the boundaries, then let the model navigate it."
Concretely, that means three new architectural concerns appear that a CRUD app never had. First, a context assembly layer that decides, on every turn, exactly what text Claude sees. Second, a tool execution layer that turns model-emitted tool calls into real side effects and feeds results back. Third, a loop controller that decides when the agent is done, when it has gone off the rails, and when to stop spending tokens. Get these three right and the model itself becomes the easy part.
Trace a single user goal — say, "reconcile this invoice against our purchase orders" — through the system. The request lands at an API gateway that authenticates the user and resolves their tenant and permissions. A session orchestrator loads or creates the agent's working state. The context assembler then builds the prompt: system instructions, the relevant subset of tool definitions, any loaded Agent Skills, retrieved documents, and the running message history. Claude responds with either a final answer or one or more tool calls. The tool layer executes those calls, captures structured results, appends them to history, and the loop runs again until the controller sees a stop condition.
flowchart TD
A["User goal + auth"] --> B["Session orchestrator: load state"]
B --> C["Context assembler: build prompt"]
C --> D["Claude model turn"]
D --> E{"Tool calls emitted?"}
E -->|No| F["Final answer + commit"]
E -->|Yes| G["Tool layer executes via MCP"]
G --> H["Append structured results to history"]
H --> I{"Stop condition met?"}
I -->|No| C
I -->|Yes| FThe detail that matters is the loop edge from H back to C. Each iteration re-assembles context from scratch rather than blindly accumulating. That is what lets you prune stale tool output, compress old turns, and keep the working set inside a sensible token budget even when the underlying conversation history is long. Treat context as a freshly rendered view of state on every turn, not an append-only log you shovel into the model.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
Agentic products have at least four distinct stores, and conflating them is a top source of bugs. The message history is the literal turn-by-turn transcript Claude needs to maintain coherence. Working memory is structured task state your code owns — the invoice ID, the POs found so far, the running total — which you can summarize into context rather than dumping raw. Long-term memory is durable knowledge across sessions, usually in a vector or relational store, retrieved on demand. And external system-of-record state lives in the databases and SaaS tools the agent acts on through MCP.
The architectural rule is that the model should never be the source of truth for anything that must be correct. If the agent computes a reconciliation total, that number is a proposal until your code re-derives it deterministically from the system of record. Claude is brilliant at planning, routing, and interpretation; it should not be the ledger. Push every commit through a typed, validated path so a hallucinated field can never silently corrupt a real record.
The Model Context Protocol gives you a clean seam here. Rather than hard-coding integrations into your agent, you expose capabilities as MCP servers — each one a self-contained process that advertises typed tools and returns structured results. Your agent runtime connects to the servers it needs for a given task and presents their tools to Claude. This keeps the model runtime thin and makes capabilities composable: the same "search-orders" server serves your reconciliation agent, your support agent, and your analytics agent without copy-paste.
At this boundary you enforce the non-negotiables: every tool call is authorized against the current user's scopes before execution, every write is idempotent so a retried call can't double-charge, and every result is schema-validated before it re-enters context. When a tool fails, the layer returns a structured error the model can read and reason about — "order not found, 404" — rather than throwing and crashing the loop. The agent then adapts, which is exactly the behavior you want.
The loop controller is the component most teams under-build, and it is what separates a toy from a product. It enforces a maximum turn count so a confused agent can't burn unlimited tokens. It watches for repeated identical tool calls, a classic sign the model is stuck, and breaks the cycle. It applies per-turn moderation on both inputs and outputs. And it knows when to escalate to a human — for high-value writes, ambiguous instructions, or low model confidence — rather than acting unilaterally.
Layer observability through the whole path. Log every prompt assembled, every tool call with its arguments and latency, every model decision, and every commit. When something goes wrong in production, you want to replay the exact context the model saw on the turn it made the bad call. Without that trace, debugging an agent is guesswork; with it, an agentic system becomes as auditable as any other service.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
Not necessarily. The Claude Agent SDK gives you the loop, tool plumbing, and MCP wiring out of the box, which is the fastest path for most teams. You can also build the loop yourself against the raw API if you need unusual control. Either way the architecture above — context assembler, tool layer, loop controller, separated state — stays the same.
The call graph is decided at runtime by the model, not at compile time by you. That means failure handling, idempotency, and observability must assume an unpredictable sequence of actions. You design the action space and the boundaries; the model fills in the path.
A subagent is just another node in the action space: the orchestrator calls it like a tool, it runs its own loop with its own context window, and returns a result. Multi-agent runs use several times more tokens than single-agent, so add them only when a task genuinely decomposes into parallel, independent work.
Treating message history as the only state. Teams append everything into the transcript, blow the token budget, and let the model become the source of truth. Separate working memory, long-term memory, and system-of-record state, and re-derive anything that must be correct.
CallSphere runs exactly this kind of architecture for voice and chat — a model loop with a context assembler, a tool layer, and a strict commit path, so AI agents can answer every call, pull up records mid-conversation, and book real work around the clock. See the architecture in action at callsphere.ai.
Source & attribution: This is an independent, original explainer inspired by Anthropic's coverage on the Claude blog. Claude, Claude Code, Claude Cowork, Claude Opus, and the Model Context Protocol are products and trademarks of Anthropic. CallSphere is not affiliated with or endorsed by Anthropic.

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
One reschedule text hits your scheduler, package balance, tutor shift and invoice. Here is what MCP changed for tutoring and test-prep center owners in 2026.
Anthropic's Claude Fable 5 and Mythos 5 explained: pricing, availability, frontier benchmarks, the dual-model safeguard architecture, and what they mean for AI agents.
Where Claude Code, MCP, and multi-agent systems are taking GTM engineering next, and how to prepare your team now for standing and multi-agent workflows.
Where Claude Cowork and the Claude agent ecosystem are heading next — standing agents, MCP, skills as a moat — and the concrete moves to prepare your team now.
The metrics, leading signals, and anti-metrics that prove Claude Cowork is working — acceptance rate, time-to-outcome, and why usage counts mislead.
Shipping an agentic GTM workflow is easy; proving it works is hard. The metrics, signals, and eval loops that show a Claude Code rebuild is paying off.
© 2026 CallSphere Inc. All rights reserved.
Made within San Francisco
Watch how CallSphere handles real customer calls, schedules appointments, and processes payments — live.
Try Live DemoBook a DemoCalculate Your ROI