AI Agent Documentation: How to Write Runbooks That Keep Your Automations Running Without You
← Back to the journal

AI Agent Documentation: How to Write Runbooks That Keep Your Automations Running Without You

John Aspinall · · 16 min read

Six months ago I had 28 agents running across four businesses. Investor reports, Amazon listing audits, daily briefings, client onboarding sequences — the system was printing time. Then I went on holiday for a week. My ops manager sent me a message on day two: "The Amazon audit agent is throwing errors and I have no idea what it's supposed to do or what it connects to."

She wasn't wrong. I hadn't documented a single one.

I spent an hour on a beach troubleshooting over Slack what should have been a five-minute fix — she just needed to update an expired API token in the MCP config. But she didn't know which config, which token, or which agent was even responsible for the audit. Because none of that was written down anywhere except inside my head.

That week taught me something: an undocumented agent stack isn't a system. It's a liability disguised as automation. You haven't built leverage if you're the only person who understands how the machine works. You've built a trap.

Since then, I've documented every agent I run. The whole process took a single weekend for the initial pass and now costs me about 20 minutes when I ship a new agent. The return on that time has been enormous — my ops manager fixes issues without me, I onboard freelancers in hours instead of days, and I can actually take a vacation without my phone buzzing.

Here's the AI agent documentation system I use. It's not complicated. It just needs to exist.

What Is AI Agent Documentation?

AI agent documentation is the structured record of every automation in your business — what each agent does, what inputs and tools it depends on, how it runs, what to do when it breaks, and how to improve it. It's the operations manual for your AI workforce.

This is different from the agent's own instructions (your CLAUDE.md file or system prompt). Those tell the agent what to do. Documentation tells the humans around you what the agent does, why it exists, and how to keep it alive. One is for the machine. The other is for the people who manage the machine.

If you've built more than five agents, you need AI agent documentation. Not because it's a best practice or because some blog told you to. Because without it, you are a single point of failure for every automation in your business. The day you're sick, on a plane, or just busy with something more important, your entire agent stack is one unexpected error away from dead weight.

Why Most Operators Skip AI Agent Documentation (And Pay for It Later)

Nobody wakes up excited to write documentation. I get it. The agent works, it's producing value, and you want to build the next one. Documentation feels like overhead — the kind of thing a big company does because they have a compliance team, not something a lean operator needs.

Here's what actually happens when you skip it:

The forgetting problem. You built an agent six weeks ago. It runs on a cron job every morning. Today it breaks. Do you remember which MCP server it talks to? Which environment variables it needs? What the output format looks like when it's working correctly? If you're like me six months ago, you don't. You spend 30 minutes re-reading the skill file, checking logs, and reverse-engineering your own work. Multiply that by 30 agents and you're spending real hours every month rediscovering things you already knew.

The handoff problem. You hire a VA, bring on a freelancer, or partner with someone on a new venture. They need to understand your agent stack. Without documentation, "understanding your agent stack" means sitting on a video call while you explain each agent one by one. That's not scalable. That's a consulting session every time someone new touches your system.

The dependency problem. Agent 12 feeds data to Agent 17, which triggers Agent 23. You update Agent 12's output format and Agent 17 starts producing garbage. Without a dependency map, you don't even know Agent 17 is downstream. You debug Agent 17 for an hour before realizing the problem is upstream. Documentation would have shown the connection in 30 seconds.

The decay problem. An agent is running daily but its output quality has dropped because a tool it depends on changed its API response format. Nobody notices because nobody remembers exactly what the expected output should look like. The agent runs for weeks producing subtly wrong results. Documentation — specifically, a sample of known-good output — makes this detectable in minutes during a maintenance pass.

Every operator I talk to who's scaled past 15 agents has hit at least two of these problems. The ones who built documentation early caught them in minutes. The ones who didn't lost hours, money, or client trust.

The Five Layers of AI Agent Documentation

I've tried a lot of documentation approaches. Wiki pages, Notion databases, README files scattered across repos. What actually works is five layers, each serving a different purpose. You don't need all five on day one — start with layers one and two, add the rest as your stack grows.

Layer 1: The Agent Registry

This is your master inventory. One document (I use a Markdown table in my ops vault) that lists every agent with six fields:

Agent Name What It Does (one sentence) Schedule Status Owner Last Reviewed
Amazon Listing Auditor Audits active listings against brand guidelines daily Daily 6am UTC Active John 2026-09-15
Client Call Processor Extracts action items from Fathom transcripts, creates Todoist tasks On meeting end Active John 2026-09-10
Weekly Investor Brief Compiles KPI snapshots into a formatted report Monday 7am Active Sarah 2026-09-08

That's it. No detail. Just an index. The point is to answer one question: "What agents are running in this business?" If you can't answer that question from a single document, you don't have a system — you have a collection.

The "Last Reviewed" column is the most important one. It creates accountability. When I see an agent that hasn't been reviewed in six weeks, I know it's a candidate for drift. The registry makes the invisible visible.

I maintain this table manually, but you could automate it — a scheduled agent that reads your cron configs and skill directories and updates the registry. I haven't bothered because manual maintenance forces me to think about what's running. That's worth the five minutes per week.

Layer 2: Individual Agent Cards

Each agent gets its own one-page document. I keep mine as Markdown files in a /docs/agents/ directory in my ops repo. Here's the template I use:

# Agent: [Name]

## Purpose
One paragraph. What problem does this solve and for whom?

## Trigger
How does this agent run? (Cron schedule, webhook, manual, event-driven)

## Inputs
- What data does it need?
- Where does that data come from?
- What credentials/tokens/API keys does it use?

## Outputs
- What does it produce?
- Where does the output go?
- What does good output look like? (Include a sample)

## Dependencies
- MCP servers: [list]
- External APIs: [list]
- Other agents: [list any agents that feed into or consume from this one]
- Files/configs: [list key files with paths]

## Failure Modes
- What are the most common ways this breaks?
- What does the error look like for each?
- What's the fix for each?

## Cost
- Approximate token usage per run
- Monthly cost estimate
- Cost ceiling (alert if exceeded)

## Change Log
| Date | Change | Reason |
|---|---|---|

The critical sections are Dependencies and Failure Modes. Dependencies tell you what to check when something goes wrong. Failure modes tell you what to do about it. Everything else is context that makes those two sections usable.

The "good output sample" in the Outputs section is worth its weight in gold during maintenance. When you're reviewing an agent's output during your weekly pass, you need to know what "correct" looks like. Without a reference sample, you're guessing. With one, you can spot drift in seconds.

Layer 3: The Dependency Map

Once you have more than 10 agents, some of them feed into each other. Agent A produces a report that Agent B consumes. Agent C writes to a database that Agent D reads from. Agent E's CLAUDE.md references a prompt library that three other agents also use.

A dependency map shows these connections. Mine is a simple list in a single file:

amazon-listing-auditor
  → reads: product-catalog.csv (shared drive)
  → reads: brand-guidelines.md (ops repo)
  → writes: audit-report.md → consumed by weekly-investor-brief

client-call-processor
  → reads: Fathom API (via MCP)
  → writes: Todoist tasks (via MCP)
  → writes: meeting-notes/ → consumed by client-relationship-tracker

weekly-investor-brief
  → reads: audit-report.md (from amazon-listing-auditor)
  → reads: kpi-dashboard.json (from analytics-agent)
  → writes: investor-email → sent via email-agent

This isn't fancy. It's a text file with arrows. But it answers the question that costs operators the most debugging time: "What else might break if I change this agent?"

Before I had this map, I changed the output format of my analytics agent and broke three downstream agents. After the map, I check connections before making changes. Five seconds of reading saves an hour of debugging.

Layer 4: Failure Playbooks

This is the layer that lets someone other than you fix problems. A failure playbook is a step-by-step guide for the three to five most common failure scenarios in your agent stack.

Mine covers:

1. Agent produces no output (silent failure)

  • Check the cron/schedule log — did it run?
  • Check the agent's log output — did it error?
  • Check the input sources — is the data available?
  • Check credentials — have any tokens expired?
  • Resolution: [specific steps for each root cause]

2. Agent produces wrong output (drift)

  • Compare current output to the known-good sample in the agent card
  • Check if any input data has changed format
  • Check if any dependency has updated (API changes, MCP server updates)
  • Check the CLAUDE.md or skill file for stale instructions
  • Resolution: update the stale component and re-run

3. Agent runs but downstream agent breaks

  • Check the dependency map for connections
  • Compare the producing agent's current output format to what the consuming agent expects
  • Resolution: update the consuming agent's input parsing or the producing agent's output format

4. Cost spike

  • Check token usage in the billing dashboard
  • Compare to the cost ceiling in the agent card
  • Common causes: input data grew larger, model was upgraded, retry loop triggered
  • Resolution: depends on cause — truncate input, pin model version, or fix retry logic

5. Credential/access failure

  • Identify which credential failed from the error message
  • Check the agent card for the credential list
  • Rotate or refresh the credential
  • Test with a manual run before re-enabling the schedule

These playbooks are generic enough to cover 80% of failures across any agent stack. I've added a few agent-specific playbooks for my most complex automations, but the generic ones handle most situations.

The audience for these playbooks is not you. It's the person who isn't you — your VA, your ops manager, your future self at 11pm when you're tired and can't remember what connects to what. Write them for someone who's smart but has never seen this specific agent before.

Layer 5: The Change Log

Every time you modify an agent — update its prompt, change a dependency, adjust its schedule, modify its output format — you log it. One line per change, in the agent card's change log table.

| 2026-09-18 | Updated pricing threshold from $25 to $30 | New supplier agreement |
| 2026-09-02 | Switched from gpt-4o to claude-sonnet-5 | Cost optimization |
| 2026-08-15 | Added Shopify MCP server as input source | New data source for inventory |

This seems trivial until you're debugging an agent that broke "sometime in the last month." The change log narrows "sometime in the last month" to "one of these three changes." That alone can cut debugging time by 80%.

I keep change logs in each agent card, not in a central log. The reason: when I'm debugging a specific agent, I want its history right there, not buried in a shared log with 30 other agents.

How to Document Your Agent Stack in a Weekend

If you already have agents running and zero documentation, here's the build order I'd follow. This took me about six hours for 28 agents.

Hour 1-2: Build the registry. List every agent. Name, one-sentence description, schedule, status. Don't overthink it. The point is to have a complete inventory.

Hour 2-4: Write agent cards for your top 10. Start with the agents that run most frequently, handle the most critical work, or break most often. Use the template above. The dependencies and failure modes sections will take the longest — that's normal. For the known-good output sample, just grab the most recent successful output and paste it in.

Hour 4-5: Draw the dependency map. For each agent in your registry, ask: "What does this read from? What does it write to? Does any other agent touch those same resources?" Write it down in the arrow format above.

Hour 5-6: Write the generic failure playbooks. Use my five scenarios above as a starting point. Adapt them to your stack. If you use specific MCP servers or tools, add the relevant troubleshooting steps.

The remaining agent cards can be filled in over the next few weeks — do two or three per day until you're caught up. The registry, the top-10 cards, the dependency map, and the playbooks give you 80% of the value in one weekend.

Common AI Agent Documentation Mistakes

Writing too much. Documentation that nobody reads is the same as no documentation. Each agent card should fit on one page. If you're writing multiple pages per agent, you're explaining your business logic instead of documenting the agent. The agent's CLAUDE.md already holds the business logic — the card just needs to explain the operational context around it.

Documenting the happy path only. Agents break. The failure modes section exists because that's when documentation actually gets used. If your agent card only describes what happens when everything works, it's useless precisely when it's needed most.

Not including output samples. "The agent produces a report" tells you nothing about whether today's output is correct. A sample of known-good output is the fastest way to detect drift. Include one. Update it when the output format changes.

Treating documentation as a one-time project. Documentation decays just like agents do. The change log exists to keep documentation current. When you update an agent, update its card. When you add an agent, add it to the registry. When you change a dependency, update the map. Twenty seconds per change keeps the system honest.

Keeping documentation in your head. "I'll remember" is the most expensive phrase in operations. You won't remember. Or you'll be unavailable when someone needs to know. Or you'll be six months older and focused on something completely different. Write it down.

AI Agent Documentation FAQ

How detailed should each agent card be? Detailed enough that someone who has never seen the agent can understand what it does, verify it's working, and fix the three most common failures. That's usually one page of Markdown. If your card is longer than two pages, you're over-documenting.

Should I automate documentation generation? You can build an agent that reads your skill files, cron configs, and CLAUDE.md files to generate draft agent cards. I've done this and it saves time on the initial pass. But the failure modes and dependency sections need human input — the agent doesn't know what breaks in practice. Automate the skeleton, fill in the operational knowledge yourself.

Where should I store AI agent documentation? Wherever you'll actually maintain it. I use Markdown files in a Git repo because I'm already working in the terminal. Some operators prefer Notion, Obsidian, or a shared Google Drive. The format matters less than the habit. Pick one place, put everything there, and don't split documentation across three tools.

How often should I review documentation? Monthly for the full registry review — check that every agent is still active and every card is current. On every agent change for the individual card update. Quarterly for the dependency map, since connections change slowly. The failure playbooks only need updating when you discover a new failure mode.

What about agents I'm still experimenting with? Add them to the registry with a status of "Experimental." They don't need a full agent card until they've been running in production for two weeks. If you kill them before that, remove them from the registry. This keeps your documentation focused on what actually matters — production agents — without losing track of experiments.

The Three Actions That Make AI Agent Documentation Stick

AI agent documentation isn't hard. It's just easy to skip. These three practices make it a habit instead of a project:

  1. Build the registry this week. Open a new file, list every agent you're running, and commit it to your ops repo. This takes 30 minutes and immediately shows you agents you'd forgotten about. That visibility alone changes how you manage your stack.

  2. Write an agent card every time you ship a new agent. Make it part of the build process. I won't mark an agent as "shipped" until its card exists. The card takes 10-15 minutes to write while the build is still fresh in your mind. That's a fraction of the time you'll spend rediscovering these details later.

  3. Log every change. One line in the change log table. Date, what changed, why. Twenty seconds of writing that saves an hour of debugging three months from now. This is the highest-ROI habit in your entire operations practice.

Your agent stack is only as valuable as your ability to maintain it — and your ability to maintain it is only as good as your AI agent documentation. An undocumented system is a system that depends on one person's memory. A documented system is a system that anyone can run, fix, and improve. Build the second one.

Enlarged image preview