Agent Reliability Playbook
Ship agents that work in production. The 7-layer reliability stack.
7
Skills
15
Anti-patterns
5
Tool adapters
12
Pre-launch items
What you'll be able to do
Concrete outcomes, not vague promises.
Your first production AI agent
You've built an agent prototype. It works on 3 test cases. Now you need to ship it to real users without breaking everything. The 7 layers are the discipline.
Debugging a familiar failure
Agent booked 38 hotel rooms. Or sent an email to the wrong person. Or forgot the original goal after 20 turns. The anti-patterns skill is the catalog.
Training your team on agent design
New engineers joining your AI team. They need to learn the discipline before they ship. The playbook is the onboarding curriculum.
Pre-launch review for AI features
Every AI feature ships through a review checklist. The pack is the review checklist — 12 items for the orchestrator, 15 for the anti-patterns.
Built for
If any of these are you, this is for you.
Why this playbook works
Three things that make this different from a wall of prompts.
7 layers, one pack
Orchestration, tool design, state, error recovery, observability, stopping, anti-patterns. Skip one and the agent breaks. The pack teaches all 7.
Prevents the $400 bill
The runaway loop anti-pattern (AP-01) caught every AI builder. The pack teaches the cost caps, loop detection, and confirmation gates that stop it before users get charged.
Discipline in code, not prompts
Every 'be efficient' / 'stop when done' / 'be safe' instruction in a prompt is a bug. The pack teaches the code-level patterns that actually enforce the discipline.
Quick start
Drop the package into your project and start using the commands.
What's in the box
- 7 skillsone per reliability layer
- 5 tool adapterspi-agent, Claude Code, Cursor, Cline, generic
- 2 worked examplestool rewrite + runaway loop fix
- Pre-launch checklist12 items
- Anti-patterns catalog15 failure modes
- Cost math per model tierknow your bounds
- Routing tablewhich skill to load when
- Decision treesworkflow vs. agent vs. hybrid
Everything in the pack
What you get the moment your payment clears.
Adapters included
These skills were authored for pi-agent, but we include drop-in adapters for the major AI coding tools.
| Tool | Adapter location | What you get |
|---|---|---|
| pi-agent | adapters/pi-agent/ | SKILL.md drop-in |
| Claude Code | adapters/claude-code/ | .claude/commands/*.md + CLAUDE.md fragments |
| Cursor | adapters/cursor/ | .cursorrules rule sets |
| Cline / Continue | adapters/cline/ | System-prompt rules |
| Aider / generic | adapters/generic/ | INSTRUCTIONS.md snippets |
Same playbook, different packaging. The adapters translate the methodology into the format each tool expects. Install once, swap agents without re-learning the method.
Full documentation
Everything in the package, every prop, every pattern.
Agent Reliability Playbook
The 7-layer reliability stack for shipping AI agents that work in production.
Built and battle-tested. 7 skills covering orchestration, tool design, state management, error recovery, observability, stopping conditions, and the catalog of 15 anti-patterns. Adapters for pi-agent, Claude Code, Cursor, Cline, and any tool that reads a system-prompt file.
What's Inside
| Skill | Purpose |
|---|---|
| agent-reliability | Master orchestrator — the 7-layer reliability stack, pre-launch checklist, routing to specialists |
| tool-design | The agent-computer interface discipline — schemas, descriptions, parameter naming |
| agent-state | State management — context window budget, message trim, checkpoint/restore |
| error-recovery | Error handling — retry strategies, structured errors, idempotency keys |
| agent-observability | Observability — structured logging, traces, replay, vendors |
| stopping-conditions | The 8 hard caps — when to halt a run (cost, time, loops, side effects) |
| anti-patterns | The catalog of 15 failure modes — symptoms, root cause, fix, detection |
Quick Start
# 1. Extract
tar -xzf agent-reliability-playbook-0.1.0.tgz
cd agent-reliability-playbook-0.1.0
# 2. Pick your agent host
ls adapters/
# pi-agent (recommended)
mkdir -p ~/.pi/agent/skills
cp -r skills/* ~/.pi/agent/skills/
# /reload in pi to pick them up
# Claude Code
mkdir -p .claude/commands
cp -r adapters/claude-code/commands/* .claude/commands/
cat adapters/claude-code/CLAUDE.md >> CLAUDE.md
# Cursor / Cline / Aider
# See INSTALL.md for per-tool setup
The Core Idea
The single sentence that ties this whole pack together:
A reliable agent has 7 layers. Skip one and it breaks in production.
| # | Layer | Failure mode it addresses |
|---|---|---|
| 1 | Orchestration | "Workflow built as agent" — wasted cost, slow |
| 2 | Tool design | "Model calls the wrong tool" — vague interface |
| 3 | Agent state | "Model forgets the goal after 20 turns" |
| 4 | Error recovery | "Single 500 takes down the whole agent" |
| 5 | Observability | "I can't reproduce the bug" |
| 6 | Stopping conditions | "Agent burns $500 in a loop" |
| 7 | Anti-patterns | "We made the same mistake 5 times" |
The Pre-Launch Checklist
Before shipping any agent to real users, walk this list. Bold items are non-negotiable.
- Orchestration chosen deliberately — workflow vs. agent vs. hybrid
- Tool definitions have descriptions the model can read — what/when/when-not/examples
- Tool calls validated before execution — schema, permissions, rate limits
- State management strategy defined — in-context, working, persistent
- Error recovery policy for every tool call — retry, fallback, escalate
- Observability is logging — LLM calls, tool calls, state changes
- Stopping conditions in code — MAX_ITERATIONS, MAX_COST_USD, MAX_DURATION_MS
- Eval set covers happy path + 3 adversarial cases
- Cost estimate per session — token cost × expected sessions
- Latency budget per turn — p50 and p95 targets
- Rollback plan — what to do if the agent misbehaves in prod
- Sample of 5 prod transcripts reviewed end-to-end
The Architectures
Workflow = orchestrated via code paths. The LLM is called from specific places. The control flow is yours.
- ✅ Predictable, testable, deterministic, cheaper
- ❌ Rigid — can't handle novel inputs
- Use for: customer support routing, structured data extraction, multi-step forms
Agent = LLM-driven process. The model decides what to do next.
- ✅ Flexible, natural for tool-using tasks
- ❌ Unpredictable, expensive, hard to debug
- Use for: research tasks, open-ended exploration, non-deterministic steps
Hybrid = workflow at the outer layer, agent at the inner layer.
- ✅ Best of both
- ❌ More design work upfront
- Default for production
Cost Discipline (Real Numbers)
| Model | Per 20 iterations |
|---|---|
| Small LLM (Haiku, GPT-4o-mini) | ~$0.30 |
| Medium LLM (Sonnet, GPT-4o) | ~$1.50 |
| Max-thinking LLM (Opus w/ tools) | ~$12.00 |
A loop with no cost cap on a max-thinking model = $12+/session. Cost caps are not optional. They live in code.
Adapters Included
Works in every major AI coding tool:
| Tool | Adapter location | What you get |
|---|---|---|
| pi-agent | adapters/pi-agent/ | SKILL.md drop-in |
| Claude Code | adapters/claude-code/ | .claude/commands/*.md + CLAUDE.md fragments |
| Cursor | adapters/cursor/ | .cursorrules rule sets |
| Cline / Continue | adapters/cline/ | System-prompt rules |
| Aider / generic | adapters/generic/ | INSTRUCTIONS.md snippets |
Updates
Free for life. Re-download for new anti-patterns, new vendor patterns, new LLM tier cost data.
What This Isn't
- Not a framework — works with LangChain, LangGraph, CrewAI, raw OpenAI SDK, anything
- Not prompt-only — the patterns live in code, not in the system prompt
- Not academic — every pattern comes from a real production failure
What's in the download
agent-reliability-playbook-0.1.0/
├── README.md ← setup guide
├── OVERVIEW.md ← positioning
├── METHODOLOGY.md ← the longer write-up
├── INSTALL.md ← per-tool setup walkthrough
├── LICENSE.md
├── package.json
├── skills/ ← 7 SKILL.md files (one per layer)
│ ├── agent-reliability/
│ ├── tool-design/
│ ├── agent-state/
│ ├── error-recovery/
│ ├── agent-observability/
│ ├── stopping-conditions/
│ └── anti-patterns/
├── adapters/ ← drop-in for AI coders
│ ├── pi-agent/
│ ├── claude-code/
│ ├── cursor/
│ ├── cline/
│ └── generic/
├── examples/ ← 2 real worked examples (tool rewrite, runaway loop)
└── docs/ ← diagrams + decision trees
Common questions
Things people ask before buying.
Is this just prompt engineering with extra steps?
No. The pack teaches the discipline of putting it in code, not the prompt. MAX_ITERATIONS in code, not 'be efficient'. Confirmation gates in code, not 'ask before sending'. Idempotency keys in code, not 'be careful with retries'. The patterns are about what your agent code does, not what your agent prompt says.
Does it work with my framework? (LangChain / LangGraph / CrewAI / raw OpenAI SDK)
Yes. The pack is methodology, not framework code. It works with LangChain, LangGraph, CrewAI, Vellum, raw OpenAI SDK, or anything else. The skills are pure markdown — they teach patterns you apply to whatever you're building on.
What's the difference vs. LangSmith / Langfuse / Helicone?
Those are observability tools — they help you see what's happening. This pack is the methodology — what to log, what to do when errors happen, when to stop. You can use the pack + an observability vendor together. The pack tells you what to instrument; the vendor helps you view it.
Will this prevent all my agent bugs?
No. The 7 layers address the most common, expensive, familiar failure modes. They don't address novel bugs, model-specific quirks, or genuinely new patterns. The pack is discipline, not magic. But it catches 80%+ of the bugs that hit production agents.
I'm building a single-prompt LLM feature, not an agent. Do I need this?
Probably not. The 7 layers are for agents (multi-step, tool-using, stateful). Single-prompt features have their own discipline (prompt engineering, eval, cost control), which is a different skill set. The pack is honest about this — if you don't have tools or state, you don't need the 7 layers.
£45 — lifetime
One purchase. Yours forever.
Pay once via Stripe. Get the complete package instantly. Free updates for the same major version. Commercial license included.
Secure payment via Stripe · Instant download · 30-day money-back if it doesn't save you time