Agent Observability, Safety and Guardrails

An agent that behaves well in a demo can drift quietly in production. A prompt tweak changes how often it offers refunds, a model upgrade shifts its phrasing, a persistent user finds a way to talk it into something odd. Nobody notices until a screenshot circulates. Two habits prevent that: watching the agent continuously, and bounding what it is allowed to do.

Watching an agent

The book groups monitoring into four parts. The first is performance metrics: how quickly the agent answers (tracked at the median and at the slow tail), how often its tool calls succeed, how many user intents are fully resolved, how often conversations are escalated to a human, and how many turns a resolution takes.

The second is conversation analytics. Logs are mined for the intents people raise and how that mix shifts over time, the points where users abandon or show frustration, the tool sequences that go with satisfied customers, and the effect of prompt variants on completion.

The third is tool-usage tracking. Every call is recorded with its parameters (sensitive fields redacted), its outcome, its latency and the conversation context that triggered it. The fourth is anomaly detection: alerts on a sudden jump in escalations, a spike in tool failures, or unusual invocation patterns that could signal prompt injection or a degraded system.

Metrics that point at a layer

The most useful idea here is that tool telemetry assigns blame. The book reads a tool that is rarely used as a documentation gap, and a tool with a high error rate as a schema or implementation problem. Neither is an "agent problem" in the vague sense. They point at different layers.

Take a ride-hailing assistant. If riders keep asking to cancel but cancel-ride is almost never called, the skill probably does not describe when cancellation applies, which is a Skills layer fix. If estimate-fare fails often, no amount of prompt editing will help; the trouble is in the schema or the tool underneath. Good observability turns "the bot seems off" into a ticket for the right team.

Bounding an agent

Guardrails constrain behaviour so that it cannot be harmful, unauthorised or expensive. The book covers four kinds.

  • Confirmation. Any action with financial impact, deletion or irreversibility needs explicit consent. The agent states what it is about to do and waits for a clear yes.
  • Data access boundaries. An agent may use only the tools declared for it. A rider-facing assistant should not be able to call a driver-payout tool. The book enforces this at the MCP layer (L6) through tool-level authorisation.
  • Cost and rate limits. Caps on tool calls per turn and per session, dollar thresholds that require elevated approval, and limits on expensive external calls stop runaway behaviour.
  • Human-in-the-loop patterns. There are three: approval gates, where the agent pauses before a high-stakes action; shadow mode, where it proposes and a human approves before anything runs, typically early in a deployment; and exception handling, where it works autonomously but escalates out-of-scope requests or low-confidence situations.

Where a rule lives decides how strong it is

Notice where the book puts the access boundary. It is enforced by authorisation below the agent, not requested in the prompt. That distinction is worth carrying everywhere. A rule that exists only as a sentence in a system prompt is a polite request, and prompts are exactly what teams retune every day. A rule enforced in a lower layer holds even when the prompt changes, the model is swapped or a user pushes back.

The same reasoning explains why confirmation has a screen-side half. The agent raises the request, but a person has to see it and answer it, which is covered in agent-facing UI.

The takeaway

Measure what the agent does, route each symptom to the layer that owns it, and put hard limits somewhere the prompt cannot erase. For the structure of the agent itself, read agent architecture and tool selection, and for how the MCP side of these boundaries works, see MCP authentication and best practices.

What the book covers

  • A table of agent performance metrics with target thresholds
  • Conversation analytics and tool usage tracking
  • Confirmation before destructive actions and data access boundaries
  • Cost and rate limiting for runaway agents
  • Approval gates, shadow mode and exception handling