← ~/pillars / multi-agent-orchestration / designing-for-agent-operations
Designing for agent operations
Runbooks as skills, two-phase investigate/remediate with pre-execution validation, telemetry agents can query, and the regression nets that make agent-made changes safe.
updated 2026-06-12 ~4 min read pattern 06/06 Architecture & Orchestration
on this page
Context. Agents are becoming operators of services, not just authors of them: triaging incidents, reading telemetry, proposing remediations. Whether that is safe is mostly an architecture question: what the service exposes, how operational knowledge is encoded, and what catches a bad change.
Forces. Incident response needs write access, and an LLM’s judgment is not a safety layer. Runbooks live in wikis agents never load. Telemetry is designed for dashboards, not queries an agent can compose. And an agent that refactors confidently will regress behaviour nobody wrote down.
Resolution. Adopt the Anthropic Cookbook SRE agent pattern: runbooks as on-demand skills, a two-phase investigate/remediate workflow, and tool-level scoping with pre-execution validation (SRE agent cookbook), on top of telemetry that follows the OTel GenAI conventions, with characterisation tests and golden sets as the regression net.
Runbooks as skills
The cookbook encodes each runbook in a SKILL.md: frontmatter description for
discovery, symptom signatures (db_connections_active > 90, “too many
connections” in logs) mapped to runbooks, then phased steps. This exploits
progressive disclosure: the frontmatter is level 1 (the agent decides
whether to load the skill), the body is level 2, referenced files are
level 3, so runbooks cost nothing until an incident matches
(agent skills).
The cookbook demonstrates the full loop (detection, two-phase investigation,
and approved remediation) as a scripted end-to-end example; a
vendor-published demonstration, not an independent benchmark, but the
mechanism is reproducible. The
incident runbook artifact is this
pattern adapted to a Java service on ECS and CloudWatch.
The cookbook’s sharpest insight: tool descriptions drive agent behaviour more than system prompts. A tool description stating when and how to use it outperforms elaborate prompt engineering. Budget your writing effort accordingly.
Two-phase response and pre-execution validation
Investigation is read-only; remediation is write-enabled and gated by human review between phases, with the agent presenting options and reasoning rather than acting. Write tools are constrained mechanically, not rhetorically:
- Path restriction: config directories only, never root.
- Exact-match edits: old value plus new value; reject if not found, replace only one occurrence.
- Command allowlists: specific prefixes, not arbitrary shell.
- PreToolUse hooks that validate content: a hook script checks the value being written (a pool size within 5–50), not just the path. This layer operates outside the LLM’s judgment entirely, the same principle as hooks as hard gates.
The AWS translation is direct: Prometheus queries become CloudWatch metric queries, container restarts become ECS service redeployments, config files become SSM Parameter Store entries, and log tailing becomes CloudWatch Logs Insights.
Observability agents can read
The OpenTelemetry GenAI semantic conventions define the vocabulary for
agent-operated and agent-running systems
(OTel blog):
four span operation types (create_agent, invoke_agent, invoke_workflow,
execute_tool), two mandatory metrics
(gen_ai.client.operation.duration and gen_ai.client.token.usage), and
attributes for model, token counts, and finish reasons; OTel v1.39+ adds MCP
attributes on execute_tool spans
(implementation guide).
Two production notes. Message content is opt-in with three capture modes:
where traces may carry personal data, use external storage with reference URLs so
traces stay navigable without PII in the pipeline. And the spec is still in
development: attribute names can change without major version bumps, so pin
your OTel agent version and diarise a quarterly conventions review.
For the Spring Boot service itself: Micrometer metrics, Actuator health
endpoints, structured JSON logs to CloudWatch, and tracing via
micrometer-tracing-bridge-otel: queryable surfaces, in that an agent can
compose a Logs Insights query against JSON fields where it cannot parse
free-text log lines.
Regression nets: characterisation tests and golden sets
Before an agent refactors brownfield code, capture current behaviour as characterisation tests: snapshot HTTP responses, post-operation database state, and event sequences, and require all snapshots green before the task completes. The agent then changes implementation, not observable behaviour.
For AI features the equivalent is a golden test set (Shaped): sample real inputs, run them through the known-good pipeline, store outputs with metadata in version control, and compare with tolerance thresholds rather than exact match: embedding similarity for text, position deltas for rankings. Failures trigger review, never automatic baseline overwrites. Freeze the set before an agent touches the prompt or pipeline; drift beyond threshold blocks completion. This is the same regression-eval discipline the delivery pipeline applies at merge time: agents in the delivery pipeline.
Worked example
An order service starts timing out at 14:10. The on-call engineer points the
SRE agent at it; the symptom table in the runbook skill matches
db_connections_active at 94% plus “too many connections” in the logs and
loads the connection-exhaustion runbook. Investigation phase, read-only: the
agent queries CloudWatch metrics against the 24-hour baseline, runs a Logs
Insights error query, checks pg_stat_activity for long transactions, and
reads the HikariCP pool size from Parameter Store. It presents three options
with evidence. The engineer approves option A: raise the pool from 20 to 30.
The write goes through the scoped Parameter Store tool; a PreToolUse hook
validates the value is within 5–50 before execution. Connections fall below
70% inside five minutes, and the agent’s final message is a timeline ready to
paste into the post-incident review.
// sources
- https://platform.claude.com/cookbook/claude-agent-sdk-03-the-site-reliability-agent
- https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills
- https://claude.com/blog/building-agents-with-the-claude-agent-sdk
- https://www.digitalapplied.com/blog/ai-agent-observability-2026-tracing-monitoring-stack-guide
- https://opentelemetry.io/blog/2025/ai-agent-observability/
- https://www.shaped.ai/blog/golden-tests-in-ai