ModelRefs / Ship an Agentic System — Tutorial
Ship an Agentic System — Tutorial
A reference build of a production agentic system: tool schemas, planner, memory, circuit breakers, retries, and observability. Covers What is an AI Agent.
Overview
A reference build of a production agentic system: tool schemas, planner, memory, circuit breakers, retries, and observability.
Level: Expert. Estimated reading time: 70 minutes.
What is an AI Agent?
An AI agent is a system that uses an LLM as a reasoning engine to autonomously take sequences of actions — calling tools, gathering information, and working toward a goal — rather than just generating a single response.
The key difference from a standard LLM call: the model decides what to do next, not you. This is powerful (it can solve multi-step problems) and risky (it can make mistakes at each step, compounding errors).
The Agent Loop
A minimal agent runs a loop:
1. Receive user goal 2. Reason: given the goal + current state + available tools, what's the next action? 3. Act: call a tool (search, write file, call API, run code…) 4. Observe: read the tool's output 5. Check: is the goal achieved? If yes, return final answer. If no, go to step 2.
This is the ReAct pattern (Reason → Act). Most production agents add a maximum-steps guard and circuit breakers to prevent infinite loops.
Tool Schema Design
Tools are functions the agent can call. The schema (name, description, parameters) is what the LLM sees — quality here directly affects agent reliability.
Bad tool description: "search(query)" — the LLM doesn't know what it searches or what format the result is in.
Good tool description: name: "web_search" description: "Search the public web for current information. Returns the top 5 results with title, URL, and 200-char snippet. Use when you need facts not in your training data." parameters: { query: string, max_results: integer (1-10, default 5) }
Rules: • One tool per responsibility (don't build a god-tool) • Always describe the return format • Mark optional parameters clearly • Test tool calls in isolation before connecting to agent
Memory Systems
Agents need memory to avoid repeating work and to maintain context across steps.
Types: • In-context memory: the running list of thoughts + tool results in the current prompt. Cheap but limited by context window. • External memory: a vector store the agent can query. Persists across sessions. • Structured memory: a key-value store for facts ("user's preferred language: Python"). Fast and deterministic.
For most production agents, start with in-context memory + a structured store for user preferences. Add a vector store when you need agents to recall past conversations or documents.
Continue your research
Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Ship an Agentic System — Tutorial.