Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Agentic AI Observability: What to Track Beyond Model Calls

· 6 min read · Home Tech

In this article
  1. Why Model Calls Alone Are Not Enough
  2. Tool Execution and Side Effects
  3. State and Memory Changes
  4. Control Flow and Decision Points
  5. Outcome Verification and Success Criteria
  6. Cost, Latency, and Token Budgets
  7. Choosing What to Track: A Practical Checklist
  8. Frequently Asked Questions

Agentic AI observability must track the entire decision-action loop, not just the model calls themselves. You need visibility into tool execution, state changes, control flow, and outcome verification to debug, audit, and improve autonomous agents. This article explains the specific data points beyond raw LLM prompts and responses that matter for production agentic systems.

Why Model Calls Alone Are Not Enough

Traditional LLM observability logs prompt, completion, token counts, latency, and cost per request. That works for a chatbot that answers one question. An agent, however, chains multiple model calls with tool invocations, memory lookups, and conditional logic in between. The same prompt can lead to different actions depending on the agent's internal state, the order of previous steps, and the results of tool calls. If you only log model calls, you cannot answer basic questions like: Why did the agent book the wrong flight? Which tool returned bad data that caused the error? Did the agent loop three times before giving up? Model calls are the atoms, but the molecule is the entire trajectory.

Tool Execution and Side Effects

Every tool call an agent makes is a potential point of failure and a source of side effects. You must track the tool name, the exact arguments passed, the raw output, the status code, and the duration. For example, if an agent calls a database query tool, you need the SQL string, the number of rows returned, and any truncation. If it calls an external API, log the HTTP method, endpoint, request headers (redacted), response body, and rate-limit headers. Side effects matter even more: a tool that sends an email, updates a record, or triggers a payment is irreversible. Observability must record that the side effect happened, when, with what parameters, and whether the agent retried or rolled back. Without this, an audit trail is impossible.

State and Memory Changes

Agents maintain state across steps, whether in a conversation context, a vector store, a scratchpad, or a database. Every read and write to that state changes the agent's future behavior. Track state snapshots before and after each step, or at least log deltas. For instance, if an agent updates a customer's address in a CRM, log the old value and the new value. If it writes a note to a memory store, log the embedding ID and the content. Also track which state variables the agent accessed during a step. This helps you reproduce a failure: you can replay the exact state at step 5 and see why step 6 diverged. Without state tracking, you only see the inputs and outputs, not the internal reasoning context.

Control Flow and Decision Points

Agents use loops, conditionals, and sub-agent spawns. Observability must capture the path taken through this control flow. Log when an agent enters a loop, how many iterations it runs, and why it exits (success, max iterations, error). Record conditional branches: if the agent decides to call a tool because the model's confidence score was above a threshold, log that score and the threshold. Also track sub-agent creation and termination. For example, a research agent might spawn three sub-agents to search different sources. Log each sub-agent's ID, its parent, its objective, and its final result. This lets you trace a failure to a specific branch or a runaway loop that consumed tokens and time.

Outcome Verification and Success Criteria

An agent can complete a task without achieving the user's goal. Observability must include a verification step: did the agent's final output pass the success criteria? Define these criteria per task type. For a data extraction agent, success might be that all required fields are present and non-null. For a code-generation agent, success might be that the code compiles and passes unit tests. Log the verification result, the specific criterion that failed, and the agent's own self-assessment if it provides one. Also track user feedback if available, such as a thumbs down or a correction. This separates "ran without error" from "actually worked." Many production incidents are silent failures where the agent finished but produced a wrong answer.

Cost, Latency, and Token Budgets

Beyond per-call metrics, track cumulative cost and latency across the entire agent run. An agent that makes 50 model calls and 30 tool calls can be expensive and slow. Log the total token count, the number of steps, the wall-clock time, and the cost per step. Set budgets and log when they are exceeded. For example, if a customer-support agent has a budget of $0.50 per interaction, observability should flag runs that exceed that. Also track the time spent waiting on tool calls versus model inference. This helps you identify bottlenecks: a slow API might cause the agent to time out and retry, doubling the cost. Cumulative metrics are essential for capacity planning and for detecting runaway agents that loop unexpectedly.

Choosing What to Track: A Practical Checklist

When designing your observability pipeline, start with these questions:

  • What can go wrong in each step of the agent's workflow?
  • What data would you need to replay a failed run exactly?
  • What side effects must be auditable for compliance or safety?
  • What does the user consider a successful outcome?
  • What are the cost and latency limits per task?

Then instrument accordingly. Use structured logging with unique run IDs and step IDs. Store traces in a format that allows querying by run, by tool, by state change, and by outcome. Add sampling for high-volume events, but always keep full traces for failures and for runs that involve side effects. Finally, build dashboards that show not just model call counts, but also tool error rates, loop iterations, state divergence, and success rates.

Frequently Asked Questions

What is the difference between tracing and logging for agents?

Tracing captures the full execution path of a single agent run, including nested calls and state transitions, while logging records discrete events. For agents, you need both: logs for individual events (tool calls, state updates) and traces to connect those events into a coherent story. A trace typically includes a run ID that links all logs from that run.

How do I handle sensitive data in tool outputs?

Redact sensitive fields before logging, such as passwords, API keys, and personal data. Use field-level redaction based on the tool's schema. For example, if a tool returns a user's email, log it as user@example.com or a hash. Also consider logging only the presence of a sensitive field, not its value, unless you need it for debugging.

Should I log the full state after every step?

Logging full state can be expensive and noisy. Instead, log state deltas or snapshots at key decision points, such as before a tool call that modifies state, or after a loop iteration. For small states, full snapshots are fine. For large vector stores, log the IDs of the documents retrieved and any changes made.

How do I measure the success of an agent without user feedback?

Define task-specific success criteria programmatically. For example, if the agent is supposed to generate a JSON object, check that it is valid JSON and contains required keys. If it is supposed to book a meeting, check that a calendar event was created with the correct time. Use these checks as a proxy for user satisfaction, and log the results.

What are common mistakes in agent observability?

The most common mistake is only logging model calls and ignoring tool side effects. Another is not correlating logs with a run ID, making it impossible to trace a failure. Also, many teams forget to log the agent's internal reasoning or decision rationale, which is crucial for debugging. Finally, not setting budgets on cost and latency can lead to runaway agents that incur huge bills.