A hands-on Python guide to building two independent AI agents — one using the Model Context Protocol (MCP), one using Agent2Agent (A2A) — that work together to keep your documentation honest, automatically.

Your Documentation Is Wrong Right Now — And It’s Nobody’s Fault

Somewhere in a repository you maintain, a README describes an endpoint that got renamed three sprints ago, a config flag that no longer exists, or a setup step nobody has needed since the project switched build tools. Nobody lied when they wrote it. The code simply moved on, the way code always does, and the sentence describing it stayed exactly where it was written — quietly getting less true with every merged pull request.

You’ve probably tried the obvious fix: point a script at the repository, open every file, and ask a language model to summarize what it finds. It works — once. Run it again next week and it regenerates the same documentation from scratch, discarding anything a human hand-tuned, blind to the one thing that actually matters: what changed since the last time anyone looked.

The 48-Hour Agent teaches you a better shape for this problem — one that doesn’t involve a single script trying to do everything. It shows you how to build two small, independent AI agent processes: one that reads your code and notices exactly what changed, and a second, completely separate one whose only job is to turn that change into a real, drafted documentation update. Neither one needs to be trusted with the other’s job — and that separation, not a cleverer prompt, is what makes the system trustworthy enough to run again and again, after every real commit.

This is a Python AI agent development book built around two of the most important emerging protocols in applied AI engineering: the Model Context Protocol (MCP), which standardizes how an agent reaches tools, and Agent2Agent (A2A), which standardizes how one independent agent hands off real work to another over HTTP. If you’ve heard these terms and want to actually build with them instead of reading a specification, this book is written for you.


What You’ll Build: CodeScribe

This isn’t a wrapped API call, and it isn’t a toy script. Over one weekend, you build CodeScribe — a real, two-process documentation agent designed to be genuinely useful after the book ends.

Node 1: The Workspace Scanner (package codescribe)

Runs entirely on your own machine. It reads your source files, your existing documentation, and your local git diff through two official MCP servers — and it never drafts a single sentence itself.

Node 2: The Technical Writer (package scribewriter)

Runs as its own independent process, reachable only over HTTP through A2A. It publishes a signed Agent Card, accepts a Task carrying your code and your diff, and hands back a drafted Markdown update — with no filesystem access of its own, ever.

By the end of the book, you run codescribe update against a real repository of your own and watch a Markdown file update itself, drafted by a second, independent AI agent process, over a genuine protocol handshake.


Why “48 Hours”?

This book carries the name The 48-Hour Agent for a reason that has nothing to do with marketing. Forty-eight hours is the real, honest time budget every chapter is written against, and it splits cleanly down the middle of the two protocols you build:

  • Day One hands you MCP — one process learning to reach its own local tools honestly, through a single consistent interface, instead of a pile of ad hoc file and subprocess code.
  • Day Two hands you A2A — that same process learning to reach a completely separate one, discovering what it can do from a published Agent Card, handing it a Task, and waiting for a real answer back.

Two protocols, two days, forty-eight hours — no filler.


Do You Need to Know MCP or A2A Already?

No. This is the only theory-first question this book needs to answer, so it answers it plainly. Some titles in The Weekend Developer Series ship an optional theory chapter — this one doesn’t, on purpose. The unfamiliar surface here is narrow: a second local process, a tool schema, and one HTTP-based agent handshake. That’s small enough to explain properly inside Chapter 1, alongside CodeScribe’s own product requirements document, with a second, focused A2A primer waiting in Chapter 6 right when you need it.

If you already know what MCP and A2A are, Chapter 1 still earns its place — it’s where CodeScribe’s actual specification lives. If you’ve never heard either acronym before this page, you’re exactly the reader this book was written for.


The Complete 10-Chapter Roadmap

ChapterWhat You Build and Learn
01 — Meet CodeScribeThe two-agent architecture, MCP vs. A2A in plain terms, CodeScribe’s full product requirements document, and a verified, weekend-ready machine
02 — Set Up Your Weekend Build EnvironmentVisual Studio Code, a shared virtual environment, Node.js, and a fully tested model provider (Ollama or Gemini), installed phase by phase
03 — Scaffold CodeScribe and Connect to the Filesystem MCP ServerA real, installable codescribe command, asyncio and the stdio transport, and your first live MCP connection reading real file names
04 — Read Your Codebase and Existing DocsA source-file allowlist, real files read through read_file, existing-docs detection, and a lean, guarded context object
05 — Read the Git Diff and Find What ChangedA second MCP server, git diff run through a jailed Command Execution path, and a complete, change-aware context object — Day One’s close
06 — Understand Agent2Agent Before You Build ItThe Agent Card, the Task lifecycle, and why A2A runs over plain HTTP — the one focused protocol primer this book allows itself
07 — Build the Technical Writer Agentscribewriter scaffolded from nothing, a real Agent Card and AgentSkill, bearer-token authentication, and Markdown drafted through Ollama or Gemini
08 — Wire the Round TripThe outbound A2A client, Task polling to a terminal state, and drafted Markdown written back through the Filesystem MCP server
09 — Ship codescribe update and Prove It for RealThe full command assembled with --dry-run and --yes, the safety net proven under real failure, and a run against a real external project and Gemini
10 — Understand CodeScribe and Plan What’s NextA guided tour of the code that makes MCP, A2A, security, and concurrency actually work, plus an honest map of what to build next

Engineering Skills You’ll Walk Away With

Beyond the code, this curriculum is calibrated to build the mental model of a developer who understands not just how to call an agent framework, but how two independent agents actually find each other, hand off work, and stay honest about what they do and don’t do.

Engineering SkillWhat It Means in Practice
MCP client architectureLaunch an MCP server as a subprocess over stdio, keep the connection clean with AsyncExitStack, and call tools by name instead of hand-rolling file or shell logic
Two-server MCP workflowsRun a Filesystem MCP server and a Command Execution MCP server side by side, both jailed to one configured workspace path
Context object designAssemble source, docs, and diff into one lean, guarded payload, with file-size and diff-line-count limits so a large repository never blows an A2A request
A2A agent constructionPublish a real Agent Card and AgentSkill, and move an incoming Task through submitted, working, and a terminal state with AgentExecutor, EventQueue, and TaskUpdater
Cross-process authenticationEnforce a shared bearer token as middleware, independent of the request-handling code it protects, so a caller is verified before a Task is ever touched
Provider-agnostic draftingSwap a local Ollama Gemma model for Gemini behind one small, swappable function, with no other code aware the change happened
Round-trip orchestrationDiscover a remote agent’s Agent Card, delegate a Task, poll it to completion, and hand the result back into your own MCP write path
Production-shaped safety habitsDry-run previews, confirmation prompts, and honest failure messages instead of stack traces — proven under conditions you deliberately break yourself

Who This Book Is For

This book is for builders who have outgrown beginner syntax tutorials and API-wrapper quickstarts but haven’t yet found a resource that guides them through a complete, real-world agent-to-agent build without skipping the hard parts.

  • You maintain a real codebase, alone or on a small team, and are tired of documentation that quietly stops being true.
  • You’ve used a hosted AI chat tool to summarize code and want to understand how a real, protocol-based agent system is actually built underneath that convenience.
  • You’re curious about MCP or A2A specifically, have read about them, and want one small, complete, working example instead of a specification to parse alone.
  • You’re a platform or developer-experience engineer evaluating whether an MCP + A2A pattern is viable for your own team’s internal tooling.
  • You’ve built with Streamlit, PyTorch, or plain Python scripts before and want to see what a genuinely multi-process, protocol-driven system looks like end to end.

You do not need prior MCP or A2A experience. You do not need a distributed-systems background. You need Python you’re comfortable with, a terminal you don’t fear, and one weekend.


Your Toolkit — 100% Free and Open-Source

Every tool in this book is free, open-source, and identical to what professional agent-engineering teams use daily.

  • Python 3.14+ — the language both codescribe and scribewriter are built in
  • Visual Studio Code — your primary cockpit, split into two terminal panels once both agents run side by side
  • Node.js and npm — needed to run the official Filesystem MCP server through npx, even though this is a Python project
  • Typer and Rich — turning both packages into real, installable CLI commands with readable terminal output
  • The official mcp Python SDK — talking to the Filesystem and Command Execution MCP servers over the stdio transport
  • The a2a-sdk — publishing and consuming Agent Cards and Tasks, and moving them through their lifecycle
  • Ollama running a local Gemma model — the free, zero-signup default for the Technical Writer’s drafting
  • google-genai — the documented Gemini alternative, one field and one key away
  • python-dotenv and PyYAML — configuration for codescribe.yaml and every secret this book needs
  • git — the source of every diff CodeScribe reads, and the reason it never regenerates the same documentation twice

Frequently Asked Questions

What is MCP (Model Context Protocol)? MCP is an open protocol that standardizes how an AI agent connects to external tools and data sources — like a filesystem, a database, or a command runner — through one consistent interface instead of custom, ad hoc integration code for every tool.

What is A2A (Agent2Agent)? A2A is an open protocol that lets one independent AI agent discover and delegate work to a completely separate agent over HTTP, using a published Agent Card and a Task lifecycle, without either agent needing to know the other’s internal implementation.

Do I need prior experience with AI agents to read this book? No. The book is written for Python developers who have never built an agent before. Chapter 1 covers everything you need to know about MCP and A2A in plain terms before any code is written.

What AI model do I need? None that cost money. The book defaults to a local Ollama model (Gemma) that runs entirely on your own machine, with Google Gemini shown as a documented drop-in alternative.

How long does it actually take to finish? The book is scoped and tested against a genuine 48-hour (one weekend) build budget, split evenly between the MCP-based Day One and the A2A-based Day Two.

Is this book part of a series? Yes, it’s the fifth title in The Weekend Developer Series, a line of execution-first, hands-on Python books that reject theoretical essays in favor of a complete, deployable build every weekend.


What’s Included

The complete codebase — every Python module in both codescribe and scribewriter, the sample scaffold workspace, and every configuration file is included as a free download with the book, ready for you to run, break, and rebuild.

Two agents. Two protocols. Zero manual Markdown. Start Saturday morning and by Sunday night, your codebase writes its own docs, and you’ll know exactly how.