Agent Observability: Monitoring AI Agents That Act, Not Just Answer

TL;DR

Agent observability is the practice of capturing what AI agents actually do (sessions, tool calls, file changes, dependency installs, and token spend) with attribution to a terminal, repo, and user. It is not the same as LLM observability: LLM tools trace model calls, but agents act on real systems, so the risk lives in behavior, not completions. And because agents act at machine speed, observability alone is forensics: it must be paired with enforcement that can block a violating action before it executes.

Nexus is an AI-agent governance and observability platform by Swfte. This page explains the discipline it implements: what agentic observability means in 2026, the event model that captures agent behavior, and why the observability wave ( useful as it is) stops one step short of what security teams actually need.

Why agent observability is not LLM observability

LLM observability answers questions about model calls: what was the prompt, what came back, how long did it take, what did it cost, was the answer good. That framing fits chat features and RAG pipelines, where the model's output is the product.

Agents break the framing because agents act. A Claude Code session does not end at a completion. It runs shell commands, edits thirty files, installs a dependency, connects to MCP servers, and commits. Every one of those is an action on a real system, performed with the developer's own credentials, and none of them appears in an API-call trace. The worst LLM failure is a wrong answer; the worst agent failure is a wrong action: a deleted directory, a leaked secret, a poisoned dependency.

So the unit of observation shifts. Call-level tools observe the conversation. Agent-level observability observes behavior: the session as the trace, the tool call as the span, and the file system, package registry, and credential set as the blast zone. If you monitor agents with an LLM-call tracer, you see the thinking and miss the doing.

The capture model: six event types

Nexus instruments the agent runtime itself (for Claude Code, through its native hook system) and reduces agent behavior to six structured event types. Together they answer the questions an incident responder, a finance owner, and a security reviewer each ask.

EventWhenWhat is recorded
sessionAgent session startsTerminal ID, user (git email), repo, branch, commit, model provider
promptPrompt submittedFingerprint + length only in the default privacy tier: no prompt text leaves the machine
tool_actionBefore each tool callTool, target, and a blocked flag when policy says no: recorded in-flight
dependency_installnpm / pnpm / yarn / pip / mvn / cargoPackage and version: supply-chain visibility for every agent-initiated install
file_changeEvery edit or writeRepo-relative path plus a protected flag when a policy-guarded file is touched
token_usageEvery turnInput, output, baseline vs. compressed tokens, savings, and cost

Privacy by default: in the standard capture tier, prompt content is never stored: only a fingerprint and length. Tool failures have their own failure modes too; see troubleshooting MCP server errors.

Observability alone is not enough

Here is the uncomfortable part of the agentic-observability wave: a dashboard cannot stop anything. Agents act at machine speed, unattended. By the time a trace shows a write to .env or a curl | sh, the action already ran. For agents, purely retrospective observability is forensics with better charts.

The step beyond is enforcement: evaluating policy before the tool call executes. Nexus performs this check in-flight, the same hook that records a tool_action event first evaluates it against policy, and a violating action (a destructive command, a write to a protected path, an install from an unapproved registry) is denied with a stated reason before it runs. The denial itself is captured with a blocked flag, so the audit trail includes what was attempted and why it was stopped. Policy checks are local and synchronous (a network hiccup cannot bypass them) while capture is fail-open, so a down collector never blocks legitimate work.

This is the line between agent observability and agent governance: observability tells you what happened; governance also decides what is allowed to happen. For the concrete case of securing Claude Code specifically, see Claude Code security.

The identity graph: agents as non-human identities

Every agent is a non-human identity: it authenticates, holds credentials, and takes actions, usually with no owner, no lifecycle, and no offboarding trigger. Observing individual sessions is necessary but not sufficient; you also need the aggregate view of who these actors are and what they can reach.

The Nexus console maintains an inventory of agents and non-human identities and connects them into an identity graph. The graph exists to answer the one question that matters in an incident: if this agent's credential were compromised right now, what could an attacker reach through it? That blast-radius analysis turns a vague worry about "AI agents with access" into a scoped list of systems, repos, and connections: the difference between an afternoon of incident response and a week of it. The same connection data powers the MCP picture: which agents talk to which servers, from which terminals, the visibility gap covered in MCP security best practices.

Shadow-agent detection

Shadow AI used to mean personal ChatGPT accounts. In developer organizations it now means shadow agents: a coding agent installed in a terminal, an MCP server added to a local config, an unsanctioned model provider: none of which touch SaaS logs, OAuth grants, or SSO, and all of which are invisible to SaaS-side security tooling by construction.

Because Nexus captures at the endpoint (the terminal where agents actually run) unmanaged agents, unsanctioned providers, and unknown non-human identities surface as findings in the console rather than remaining unknowable. Detection is the entry point; the paved path is governance attached to sanctioned tools, so the governed route is also the easiest one.

Cost attribution: the pillar agents make urgent

Agents consume tokens differently from chat: long sessions, repeated context, tool output flowing back into the window, retries. A single runaway session can spend more than a month of a chat feature, and a provider invoice attributes none of it.

Nexus meters token usage per turn (input, output, baseline versus compressed) and attributes cost per terminal, per repo, per user. Because it records a baseline alongside actuals, it can show what context compression and output filtering saved rather than asserting it. Teams use the same events to find runaway sessions, enforce budgets, and answer the question finance actually asks: not "what did AI cost" but "which team, which repo, which workflow."

Agent observability FAQ

What is agent observability?

Agent observability is the practice of capturing and analyzing what AI agents actually do (the sessions they run, the tools they call, the files they change, the packages they install, and the tokens they consume) with attribution to a terminal, repo, and user. It extends LLM observability from watching model calls to watching behavior, because agents act on real systems rather than just returning text.

How is agent observability different from LLM observability?

LLM observability traces API calls: prompt in, completion out, plus latency, cost, and quality. Agent observability covers what happens between and after those calls (shell commands executed, files edited, dependencies installed, MCP servers contacted) because with agents the risk lives in the actions, not the completions. A hallucinated sentence is a quality bug; a hallucinated rm -rf is an incident.

What events should you capture from an AI agent?

Six event types cover an agent's observable behavior: session starts (terminal, user, repo, model), prompts (as fingerprint and length in a privacy-preserving tier), tool actions (with an in-flight blocked flag), dependency installs (supply chain), file changes (with protected-path flags), and per-turn token usage (baseline vs. compressed, and cost). Together they answer who ran what, where, what it touched, and what it cost.

Can you monitor AI agents without recording developer prompts?

Yes. Nexus's default privacy tier captures a fingerprint and length for each prompt, never the text, so teams get session-level attribution, action trails, and cost accounting without storing what developers typed. Deeper capture tiers are an explicit opt-in per repository, making privacy a configuration decision rather than an accident.

Is observability enough to secure AI agents?

No. Observability is retrospective. It tells you what happened. Agents act at machine speed, so by the time a dashboard shows a destructive command, it already ran. Securing agents requires pairing observability with enforcement: policy evaluated before each tool call executes, denying protected-path writes, destructive commands, and unapproved installs in-flight. Observability without enforcement is forensics.

How does Nexus implement agent observability?

Nexus wraps the agent runtime, for Claude Code, via its native hook system, installed with one command: nexus wrap claude. Hooks stream structured events (session, prompt metadata, tool actions, installs, file changes, token usage) to a local collector and durable ledger, and the same hooks evaluate policy before actions run. The console adds an agent and non-human-identity inventory, an identity graph with blast-radius analysis, shadow-AI detection, and policy-as-code findings. The capture layer is open-core.

See what your agents do. Block what they shouldn't.

Nexus captures every agent session, tool action, file change, and token spent, and enforces policy before actions execute. One command to start: nexus wrap claude.

Open-core capture layer · Metadata-only privacy tier by default · Per-repo enforce/audit modes