↑ Contents Chapter 12 of 12

Chapter 12: Ship It β€” Your First Real Agent

Rosa's bookshop has changed. The agent β€” the one TomΓ‘s built, chapter by chapter, tool by tool β€” is live. It searches the inventory, answers policy questions from the RAG store, calculates totals, remembers regular customers, and asks for approval before sending emails. Rosa checks the eval dashboard every morning: 92% pass rate, holding steady. A customer walks in. "Do you have Le Guin's latest, and can I return it if I don't like it?" Rosa smiles and points to the tablet on the counter. "Ask the agent." The customer types. The agent searches, retrieves, answers β€” in seconds. The customer buys the book. TomΓ‘s, watching from behind the counter, feels something he didn't expect: pride. He built that. From a loop in a Python file to a real thing, serving real people, in a real shop. "You're not done, though," Priya says, appearing beside him. "You're never done. But you shipped. That's the part most people never reach."

Why This Matters

This is the last chapter, and it's different from the rest. There's no new concept here β€” you've learned them all. Instead, we're going to bring everything together into one complete agent, deployed and running, and then talk about what comes next. By the end, you'll have a blueprint for shipping a real agent, and a map for where to go from here.

The Agent You've Built

Let's take stock. Across twelve chapters, you've built:

Your Agent, Assembled The Agent Loop (Ch 3) LLM Brain (Ch 2) Tools (Ch 4) Memory (Ch 5) Planning (Ch 6) RAG (Ch 7) LangChain (Ch 8) Multi-Agent (Ch 9) Guardrails (Ch 10) Evals (Ch 11)
Twelve chapters, one agent. Every piece you built has a place in the final system.

That's a complete agent system. Not a toy β€” a real, production-ready architecture. The loop is the heart. The brain, tools, and memory are the body. Planning and RAG are the intelligence. LangChain is the wiring. Multi-agent is the scale. Guardrails are the brakes. Evals are the instrument panel. You built every piece.

The Deployment Checklist

Here's what "shipping" looks like, concretely. This is the checklist TomΓ‘s worked through before the agent went live in Rosa's shop:

# DEPLOYMENT CHECKLIST [ ] The agent works - Runs the loop correctly (Ch 3) - Tools are defined and tested (Ch 4) - Memory persists across sessions (Ch 5) - Planning prompt handles multi-step tasks (Ch 6) - RAG retrieves relevant passages (Ch 7) [ ] It's safe - System prompt sets boundaries (Ch 10) - Dangerous tools require approval (Ch 10) - Turn limits are set: max_turns, max_tool_calls (Ch 10) - Injection patterns are flagged (Ch 10) - Output validation catches hallucinations (Ch 10) [ ] It's measured - Golden dataset of 10+ cases (Ch 11) - Eval harness runs after every change (Ch 11) - Observability logs every call (Ch 11) - You know the current pass rate (Ch 11) [ ] It's deployed - API key is in environment variables, not code - The agent runs behind a web endpoint - It has a simple UI (chat interface) - It's monitored for errors and latency - There's a rollback plan if it breaks
// The checklist. Every line maps to a chapter. You've built the skills for every one.

A Minimal Web Deployment

Here's the simplest way to put your agent behind a web endpoint, using Flask. This is the bridge from "runs on my laptop" to "runs on the internet":

# app.py β€” a minimal web endpoint for your agent from flask import Flask, request, jsonify from agent import run_agent # your agent from chapters 3-11 app = Flask(__name__) @app.route("/chat", methods=["POST"]) def chat(): user_message = request.json.get("message") if not user_message: return jsonify({"error": "No message provided"}), 400 try: response = run_agent(user_message) return jsonify({"response": response}) except Exception as e: return jsonify({"error": str(e)}), 500 if __name__ == "__main__": app.run(host="0.0.0.0", port=5000)
// A POST endpoint. Send a message, get the agent's response. That's the whole web layer.

A simple HTML chat interface sends messages to /chat and displays the response. You don't need anything fancy β€” a text input, a send button, a div for the conversation. The agent does the work; the web layer is just plumbing.

Watch it! This minimal setup is for learning. For real production, you'd add: authentication (who can use the agent?), rate limiting (how often?), a proper WSGI server (gunicorn, not Flask's dev server), error monitoring (Sentry), and a queue for long-running agent tasks (the loop can take seconds, not milliseconds). But the shape is the same: an endpoint that calls run_agent and returns the result.

What Comes Next

You've built a real agent. But the field doesn't stand still, and neither should you. Here's a map of where to go from here:

Go deeper on what you've learned

- LangGraph β€” for complex, stateful multi-agent workflows. If your agent needs to branch, loop, or maintain complex state across many steps, LangGraph models it as a graph. It's the natural next step after Chapter 9.

- Structured outputs β€” forcing the LLM to return valid JSON or a specific schema. This makes tool calls more reliable and output parsing trivial. Most providers now support this natively.

- Fine-tuning β€” when prompting isn't enough, you can fine-tune a model on your specific data. It's not always needed (RAG often suffices), but for specialised domains or consistent style, it's a powerful tool.

Explore the wider ecosystem

- CrewAI and AutoGen β€” alternative multi-agent frameworks with different philosophies. CrewAI focuses on role-based "crews"; AutoGen on conversational agents that talk to each other.

- Vector databases β€” Chroma is great for starting; Pinecone, Weaviate, and pgvector scale to production. The concepts from Chapter 7 are the same; the infrastructure grows.

- Observability platforms β€” LangSmith, Langfuse, Phoenix. If you're running agents in production, you need one of these. They turn the logging from Chapter 11 into a dashboard.

Build something real

The best way to cement what you've learned is to build an agent for a problem you actually have. Not a tutorial problem β€” a real one. Your email. Your notes. Your team's documentation. Your small business. Pick something annoying, something repetitive, something that would be better if a smart assistant could help. Build the agent. Ship it. Use it. Iterate.

There Are No Dumb Questions
Q: I've finished the book. Am I an agent expert now?
A: You're an agent builder. You can build, deploy, and maintain a real agent β€” which puts you ahead of most people who've only used frameworks without understanding them. Expertise comes from building real things, hitting real problems, and iterating. The book gave you the foundation; the expertise comes from practice.
Q: Should I use LangChain or build from scratch going forward?
A: Both, depending on the project. For quick prototypes and standard patterns, LangChain saves time. For agents where you need full control or minimal dependencies, the hand-rolled loop is cleaner. Now that you understand both, you can choose. The framework is a tool, not a commitment.
Q: What's the one thing most agent builders get wrong?
A: They skip the evals. They build, tweak by vibes, ship, and then have no idea if changes help or hurt. If you take one habit from this book, make it: build a golden dataset early, run it after every change, and let the numbers guide you. Everything else is secondary to knowing whether you're actually improving.

The Closing Challenge

This isn't an exercise. It's an invitation.

Build an agent for something real. Not the bookshop β€” that was our shared example. Something from your life. A problem you have. A task you hate doing. A thing that would be better with a smart assistant that can act.

Use the loop. Give it tools. Give it memory. Give it knowledge with RAG. Wire it with LangChain if that helps. Add guardrails. Set up evals. Ship it behind a web endpoint. Use it. Watch it. Improve it.

Then tell someone: "I built an agent." Not "I used an agent." Not "I played with an agent." Built one. From the loop up. You know how it works β€” every piece, because you built each one yourself.

Chapter Summary

  • You've built a complete agent system: the loop (Ch 3), brain (Ch 2), tools (Ch 4), memory (Ch 5), planning (Ch 6), RAG (Ch 7), LangChain wiring (Ch 8), multi-agent (Ch 9), guardrails (Ch 10), and evals (Ch 11). Every piece has a place.
  • Shipping means working through a deployment checklist: the agent works, it's safe, it's measured, and it's deployed behind a web endpoint.
  • A minimal web deployment is just an endpoint that calls run_agent and returns the result. The agent does the work; the web layer is plumbing.
  • What comes next: LangGraph for complex workflows, structured outputs for reliability, fine-tuning for specialised domains, and the wider ecosystem of multi-agent frameworks, vector databases, and observability platforms.
  • The most important habit: build a golden dataset early, run it after every change. Knowing whether you're improving is more valuable than any single technique.
  • You're an agent builder now. The expertise comes from building real things, hitting real problems, and iterating. Go build something real.
The Final Challenge

Build an agent for something real in your life.

Not a tutorial. Not the bookshop. Something you need. An agent that reads your email and drafts replies. An agent that summarises your meeting notes. An agent that searches your team's docs and answers questions. An agent that tracks your tasks and reminds you. Anything β€” as long as it's real, and it's yours.

Use everything from this book. Build the loop. Add tools. Add memory. Add RAG if it needs knowledge. Add guardrails. Set up evals. Ship it behind a web endpoint. Use it. Improve it.

Then, when someone asks "what did you build?" β€” you'll have an answer. Not "I followed a tutorial." Not "I used a framework." You built an agent. From the loop up. And you know exactly how it works, because you built every piece yourself.

Now go build.

← Previous