By Sagar Shankaran, Founder of CallSphere
A concrete build sequence for your first production Claude agent: the loop, tools, MCP wiring, guardrails, compaction, and evals — for startup engineers.
Key takeaways
Reading about agent architecture is one thing; getting a Claude agent running against real user input is another. This is the hands-on companion: a sequenced build you can follow from an empty repo to something you would put behind a feature flag for early users. I will keep it concrete — what to create, in what order, and what tends to bite you at each step. The example agent is a support assistant that answers customer questions and can look up order data, because that shape generalizes to most startup needs.
Start with the smallest thing that calls Claude and runs a tool. Create a project, add the Anthropic SDK, and write a single function that sends a message list to Claude and returns the response. Resist the urge to add tools, memory, or a framework yet. You want to confirm credentials, model selection, and round-trip latency in isolation. Pick Sonnet 4.6 as your default model for development — it is the cost-versus-capability sweet spot — and keep Opus 4.8 in mind for steps that need heavier reasoning later.
Once a plain message round-trips, wrap it in the loop: send messages, inspect the response for tool_use blocks, and if there are none, return the text. This skeleton is your whole agent. Everything from here is filling in tools and context, not rewriting structure. Verify the skeleton handles an empty tool list cleanly before moving on.
Add one tool: get_order_status. Give it a clear name, a one-sentence description Claude can reason about, and a JSON input schema with a single required order_id string. Wire the harness so that when Claude emits a tool_use for it, your code calls a stub that returns a fixed fake order, appends the result as a tool_result, and re-enters the loop. Test that Claude calls the tool when asked "where is order 1234" and answers directly when asked "what are your hours."
The schema is doing real work here. A vague description like "gets order info" leads Claude to call the tool at the wrong moments; a precise one — "Look up the current shipping status of a customer order by its numeric order ID" — sharply improves when it fires. Treat tool descriptions as prompt engineering, because they are.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent for home services in your browser — 60 seconds, no signup.
flowchart TD
A["Scaffold bare loop"] --> B["Add one tool with tight schema"]
B --> C["Swap stub for MCP server"]
C --> D["Add system prompt & guardrails"]
D --> E["Add compaction & turn cap"]
E --> F{"Eval suite green?"}
F -->|No| D
F -->|Yes| G["Ship behind feature flag"]Now connect to real data. Rather than hand-rolling database access inside the tool, stand up an MCP server that exposes your order system, or point at an existing one. Your agent connects to the server, and its tools — get_order_status, list_recent_orders — appear in Claude's tool list automatically. The win is that the same MCP server backs every future agent you build, and the integration is declarative rather than copy-pasted.
At this step, error handling stops being optional. Real lookups fail: the order does not exist, the database times out, the ID is malformed. Return these as structured tool results — { "error": "not_found", "order_id": "1234" } — rather than throwing. Claude reads the error and recovers gracefully, asking the user to re-check the ID instead of hallucinating a status. An agent that never sees its own failures cannot reason about them.
With tools working, shape behavior. The system prompt sets the agent's role, tone, boundaries, and escalation rules: who it is, what it must never do, and when to hand off to a human. Keep it specific and operational — "If a customer asks for a refund, do not promise one; collect the order ID and say a teammate will follow up" beats vague instructions to "be helpful." State the tools' purpose in the prompt too, so Claude has a mental model of its own capabilities.
Guardrails live in your harness, not just the prompt. Validate tool inputs before executing them, enforce allow-lists on any write actions, and add a turn limit so a confused agent cannot loop forever. The prompt is a strong suggestion; the harness is the enforced contract. Security-sensitive decisions — can this user see this order? — belong in code, where they cannot be talked around by a clever input.
Make it survive long conversations. Track the message list across turns so the agent remembers the current thread. When that list grows past a threshold, compact it: summarize older turns into a short synopsis that preserves decisions and the open question, then drop the raw history. This keeps token cost flat and reasoning sharp on long support chats. Pair compaction with a hard turn cap so a stuck agent exits with a clear handoff message instead of grinding.
For returning users, persist a short episodic summary keyed to their account and reload it at the start of the next session. This is the difference between an agent that feels like a goldfish and one that remembers the customer mentioned a damaged package yesterday. Store the durable facts in your database; reload only the distilled summary into context.
Before users touch it, build a small eval set: fifteen to thirty real-ish transcripts with expected behaviors — "asks for order ID," "refuses to promise a refund," "escalates on legal threats." Run the agent against them on every change and gate deploys on the results. This is your regression net; without it, fixing one behavior silently breaks another. Evals do not need to be fancy — a script that checks for the right tool calls and refusal patterns catches most regressions.
Still reading? Stop comparing — try CallSphere live.
See the home services AI agent handle a real call — complete, industry-specific, and live in your browser. No signup.
Ship to a small cohort behind a feature flag, log every transcript, and watch the first hundred real conversations closely. Real users will phrase things your evals never imagined, and those transcripts become your next eval cases. Expand the cohort as the failure rate drops. The loop from production transcript to eval case to fix is the engine that turns a demo into a dependable product.
The bare loop plus one tool is an afternoon. A version you would put behind a flag — real MCP-backed tools, guardrails, compaction, a small eval set — is typically a week or two for one engineer. The architecture is simple; the reliability work is where the time goes.
Build the bare loop on the raw messages API once so you understand it, then adopt the Claude Agent SDK for anything real. The SDK gives you tested tool execution, subagents, MCP, and hooks so you are not maintaining your own harness.
Default to Sonnet 4.6 for its balance of cost and capability. Drop to Haiku 4.5 for cheap, frequent classification-style steps and reserve Opus 4.8 for the hardest reasoning. You can mix models across steps in one agent.
Give it tools to fetch real data and a system prompt that says to use them rather than guess, return tool errors as structured results so it can recover, and add evals that catch fabrication. Grounding in tool results is the single biggest lever against hallucination.
The same build sequence — loop, tools, MCP, guardrails, evals — is how CallSphere ships voice and chat agents that answer every call and message, pull up records mid-conversation, and book jobs day and night. Watch one work 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