Write an agent runbook for partial completion
In this article (5 sections)
Multi-step work rarely fits “success” or “failed.” A run may validate, retrieve and draft successfully before ticket creation fails. Operators need exact side effects and a safe resume path.
Produce a complete partial record
The agent controls lab creates an authored run.
from agent_cases import runbook_case
result = runbook_case()
assert result["complete"] is True
assert result["partial_visible"] is True
assert result["safe_to_resume"] is True
assert result["run"]["failed"] == "create_ticket"
assert result["run"]["side_effects"] == []Resume requires repairing permission and reusing RUN-5:create-ticket. No rollback is needed because no side effect occurred.
Record operational facts
Include run/config ID, user scope, completed/failed/unstarted steps, tool receipts, side effects, data written, approvals, error codes, remaining budgets, resume and rollback instructions, owner and evidence links. Keep secrets out of the report.
If write outcome is uncertain, say so and verify by idempotency key before retry. If completed actions cannot be reversed, name compensating steps and the authorized decision owner.
Rehearse recovery
Simulate each step failing before/after its side effect. Give the runbook to someone unfamiliar and test whether they can diagnose, resume or stop safely. Version it with the workflow.
The Generative & Agentic AI course makes partial completion part of capstone operations rather than hiding it behind a final answer.
Exercise
Write a runbook for a six-step workflow with two writes. Inject an uncertain timeout and approval expiry, then perform recovery from the document alone.
Continue learning
This article is part of the Agent workflows and state sequence. Use the neighbouring tasks when you need the prerequisite or the next application.
- Review the preceding task in Compare orchestration frameworks using the same acceptance tests.
- Return to the cluster foundation in Agent versus workflow: choose the least complex reliable design.
Reference: Google SRE incident response.
Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.
This article is part of our Generative & Agentic AI programme — 3 months. Add practical GenAI, retrieval and agent-building skills to your existing toolkit.
Explore Generative & Agentic AI