Last updated: November 26, 2026 · Reviewed by Alessandro Pignati
What should AI agent observability show, and what should it never store in plain text? AI agent observability is the practice of tracing every step an agent takes, from model calls and tool calls to handoffs between agents, so you can explain its cost, failures and risky actions. The trace is only useful if it is safe to keep, because agent telemetry often holds the same prompts, secrets and personal data your security controls exist to protect.
Most guides stop at the first half of that answer. Yet Gartner predicts that by 2028 LLM observability investment will reach 50% of GenAI deployments, up from 15% in March 2026. Teams are about to collect far more agent data than before, so the moment to decide what goes into a trace is now.
What Is AI Agent Observability?
AI agent observability extends LLM observability from single requests to whole agent runs. An LLM call is one prompt and one response. An agent run is a chain: the model plans, calls a tool, reads the result, calls the model again and sometimes hands part of the task to a second agent.
Request-level metrics such as latency, tokens and error rates still matter, and we cover them in our guide to LLM observability with an AI gateway. What agents add is the link between steps. Without it, you can see that a run was slow and expensive, but not which tool call caused it or what data the agent read along the way.
That link also matters for governance. Gartner expects that by 2027, 40% of enterprises will demote or decommission autonomous agents because of governance gaps found only after production incidents (Gartner). After an incident, a trace that rebuilds the run is often the only evidence you have.
What an AI Agent Trace Should Capture
A useful agent trace is a tree of spans, one per step, all tied to the same session. The OpenTelemetry GenAI semantic conventions give those steps standard names: invoke_agent for an agent run, chat for a model call and execute_tool for a tool call, with a nested invoke_agent span when one agent delegates to another. Tool calls made over MCP use the same execute_tool shape (Dash0).
Two caveats apply. The conventions are still in Development status, so attribute names can change between releases. On June 12, 2026 they also moved to a dedicated repository, semantic-conventions-genai. Pin the version you instrument against and plan for renames.
)
| Span | What it tells you | Security signal to watch |
|---|---|---|
Session and invoke_agent | Who started the run, which agent and version, total time and cost | Runs started by unexpected users or service accounts |
chat | Model, provider, input and output tokens, latency, errors | Token spikes, prompts that carry personal data |
execute_tool (including MCP) | Tool name, arguments, duration, result status | Tools called outside the agent's normal scope, writes to sensitive systems |
Nested invoke_agent (A2A) | Which agent delegated what, and to whom | Handoffs to agents nobody approved |
| Retrieval and memory | Documents and memory entries the agent read | Retrieved content the user is not entitled to see |
The right-hand column maps to the OWASP Top 10 for Agentic Applications. Tool misuse (ASI02), identity and privilege abuse (ASI03) and insecure inter-agent communication (ASI07) usually appear first as odd spans in a trace.
Where to Collect Agent Telemetry: SDK or Gateway
You can instrument agents in two places, and many production teams use both.
Inside the framework (SDK). SDK instrumentation sees the agent's internal steps: the plan, memory reads and the reasoning between calls. The cost is coverage. Every team, framework and language needs its own setup, and agents built by other teams or vendors stay dark.
At the gateway. A gateway sits on the network path between agents and the models, MCP servers and other agents they call. It sees every request whatever the framework, which makes it the natural place for cost attribution, tool-call records and policy enforcement. It cannot see reasoning that never leaves the process.
Gateway telemetry is increasingly common. LLM observability in Bifrost, the open-source gateway from Maxim AI, emits OTLP traces that follow the GenAI conventions and tracks duration and failure rate for each MCP tool. It also lets you switch off prompt and response logging while still recording tokens, cost and latency. That option is worth copying whatever gateway you run, because it separates the metrics you need every day from the content you rarely should keep.
The Agent Gateway (TrustGate) plays the same role in the NeuralTrust platform: model, MCP and A2A traffic passes through one point you control and meter, and every agent handoff is traced (NeuralTrust AI Gateway).
Cost Signals Hidden in Agent Traces
Agents spend money in ways a monthly invoice cannot explain: retries, fallbacks, long tool outputs fed back into the context and loops that call the same tool again. OWASP lists this pattern as Unbounded Consumption (LLM06) in its 2026 Top 10 for LLM Applications (Cloud Security Alliance).
Agent traces turn that into something you can act on. They show cost per session and per agent, not only per model, plus tool fan-out and repeated spans with the same tool and similar arguments, which is how loops show up. The gateway can then enforce budgets and rate limits, so a runaway agent hits a limit before it hits the monthly bill. For the full set of cost controls, see how to reduce LLM costs with an AI gateway.
Securing AI Agent Observability Data: Prompts, Secrets and Audit Logs
Agent traces are a sensitive data store in their own right. One trace can hold the user's prompt, the system prompt, documents pulled from internal systems, tool arguments with customer records and the model's answer. If the trace pipeline is weaker than the systems it records, it becomes the easiest place to take that data.
The risk is well documented. The 2026 OWASP list keeps Sensitive Information Disclosure at LLM02 and adds Hidden Context Exposure (LLM08), which covers retrieved documents, agent memory and tool responses (Cloud Security Alliance). Credentials are part of the problem too. GitGuardian counted 1,275,105 leaked secrets tied to AI services in 2025, up 81% year over year, and found that LLM infrastructure such as orchestration, RAG and vector storage leaked secrets 5× faster than core model providers (GitGuardian).
The OpenTelemetry GenAI conventions already treat content as a design choice: prompts and responses are opt-in and travel in a separate event, because they routinely contain personal data.
Five controls follow from that:
- Metadata by default. Record tokens, cost, latency, model and tool names on every span. Capture full content only in staging or for approved, sampled investigations.
- Mask before storage. Redact personal data and credentials in flight, before they reach a log, a trace backend or a third-party provider. Block credentials outright, because a masked key has still left your perimeter.
- Role-based access to originals. Most people who read traces need the shape of the run, not the raw prompt. Limit unmasked views to a few admins.
- Short retention for content, longer for audit. Keep content for days. Keep tamper-evident records of which user, agent and tool did what for as long as your auditors require. Our guide to MCP audit logging lists the fields that matter.
- Keep the data plane where the data lives. Self-hosted or hybrid deployments keep traces inside your own infrastructure and jurisdiction.
)
How NeuralTrust handles it?
- TrustGate's data masking plugin redacts personal data, credentials and internal identifiers in requests and responses, using built-in entities plus custom regex or keyword rules (TrustGate docs).
- TrustGuard masks PII and secrets in prompts and model output, and its activity view shows masked values by default: only Owner, Global Admin and Admin roles can switch to the original (TrustGuard docs). The Agent Gateway runs as SaaS, hybrid with a private data plane, or fully on premises, and keeps cryptographic audit trails of every call.
Where to Start, by Team
| Your situation | Start here | Add next |
|---|---|---|
| One team, one agent framework | SDK tracing with GenAI conventions, metadata only | Gateway budgets once a second team ships agents |
| Several teams or vendors building agents | Gateway tracing for all model, MCP and A2A traffic | SDK spans for the agents you own |
| Regulated data (finance, health, public sector) | Masking in flight and role-based access to originals | Self-hosted data plane and a retention policy |
| Multi-agent workflows | Session IDs carried across every handoff | Alerts on unapproved agent-to-agent calls |
| Cost overruns | Cost per session and loop detection | Hard budgets and rate limits per team |
Conclusion
AI agent observability is now as much a security decision as an engineering one. Trace every step of an agent run with the OpenTelemetry GenAI conventions and collect it where coverage is widest: usually the gateway, plus SDK spans for the agents you own. Then treat the trace store as sensitive data, because it is a second copy of everything your agents touched, and put the controls before storage rather than after a leak. You get faster debugging and real cost control without exposing the data you meant to protect.
Secure AI Agents in Production with NeuralTrust
Route your agents' model, MCP and A2A traffic through the Agent Gateway and get traces, budgets and data masking on every call.
Related Articles
- LLM Observability with an AI Gateway: Complete Guide
- How to Reduce LLM Costs with an AI Gateway
- MCP Audit Logging: What CISOs Must Track
- A2A Security: Mutual Auth and Integrity
FAQs about AI Agent Observability
1. What is AI agent observability?
AI agent observability is the practice of recording and connecting every step an AI agent takes in production: model calls, tool calls, retrieval, memory reads and handoffs to other agents. Each step becomes a span in one trace, so teams can explain why an agent acted, what it cost and which data it touched. It builds on LLM observability but follows the whole run rather than single requests.
2. How is AI agent observability different from LLM observability?
LLM observability measures individual model requests: latency, tokens, cost and errors. AI agent observability links those requests into a run and adds the steps between them, such as tool calls over MCP, retrieval and delegation to other agents. That link is what lets you find the step that made a run slow, expensive or unsafe, rather than only seeing the total.
3. What should an AI agent trace include?
At minimum, a session ID, the agent name and version, one span per model call with tokens and latency, one span per tool call with the tool name and result status, and a nested span for each handoff to another agent. Following the OpenTelemetry GenAI conventions (invoke_agent, chat, execute_tool) keeps traces portable across tools, although the conventions are still in Development status.
4. Should you log prompts and responses in agent traces?
Not by default. Prompts, tool arguments and responses often contain personal data and credentials, which is why the OpenTelemetry GenAI conventions make content capture opt-in. Record metadata on every span, mask sensitive values before storage, restrict who can see unmasked content and keep content retention short. Capture full content only for staging or approved investigations.
About the Author
Roger Howroyd is Head of Global SEO and AI at NeuralTrust, where he leads the company's search strategy across SEO, AEO, GEO, and LLM optimization. He specializes in AI-powered search, content strategy, and SEM. Connect on LinkedIn.
Reviewed by Alessandro Pignati, Lead AI Security Researcher at NeuralTrust.
NeuralTrust is the leading platform for securing and scaling AI agents. Named a Pioneer in the Gartner Emerging Market Quadrant for AI Application Security 2026, recognized across four Gartner Hype Cycle reports in 2026, and featured in the Gartner Market Guide for Guardian Agents 2026, the Gartner Market Guide for AI Gateways 2025 and the KuppingerCole Leadership Compass for Generative AI Defense 2025. Headquartered in Barcelona with offices in London and New York. ISO 27001 certified.
Drafted with AI assistance. Fact-checked and reviewed by Alessandro Pignati.
Sources
- Gartner, "Gartner Predicts by 2028, Explainable AI Will Drive LLM Observability Investments to 50% for Secure GenAI Deployment," March 30, 2026. https://www.gartner.com/en/newsroom/press-releases/2026-03-30-gartner-predicts-by-2028-explainable-ai-will-drive-llm-observability-investments-to-50-percent-for-secure-genai-deployment
- Gartner, "Gartner Says Applying Uniform Governance Across AI Agents Will Lead to Enterprise AI Agent Failure," May 26, 2026. https://gartner.com/en/newsroom/press-releases/2026-05-26-gartner-says-applying-uniform-governance-across-ai-agents-will-lead-to-enterprise-ai-agent-failure
- Dash0, "OpenTelemetry GenAI Semantic Conventions Explained," September 14, 2026. https://www.dash0.com/knowledge/opentelemetry-genai-semantic-conventions-explained
- OWASP GenAI Security Project, "OWASP Top 10 for Agentic Applications for 2026." https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
- OWASP GenAI Security Project, "OWASP GenAI LLM Top 10 2026," August 3, 2026. https://genai.owasp.org/resource/owasp-genai-llm-top-10-2026/
- Cloud Security Alliance, "OWASP's 2026 LLM Top 10 and New Agent Control Standard," September 4, 2026. https://labs.cloudsecurityalliance.org/research/csa-research-note-owasp-genai-top10-2026-agent-control-stand/
- GitGuardian, "The State of Secrets Sprawl 2026," March 17, 2026. https://blog.gitguardian.com/the-state-of-secrets-sprawl-2026/
- Maxim AI, "AI Observability" (Bifrost), accessed November 2026. https://www.getmaxim.ai/ai-observability
- NeuralTrust, "Data Masking" (TrustGate documentation), accessed November 2026. https://docs.neuraltrust.ai/trustgate/plugins/data-masking
- NeuralTrust, "Data Loss Prevention detector" (TrustGuard documentation), accessed November 2026. https://docs.neuraltrust.ai/trustguard/detectors/data-loss-prevention
)
)
)
)
)
)
)
)