Ad广告位招商 / Advertise hereSlot A1 · Rate card →

Monitoring deployed agents: what I log and why

Started by ASI_Notes · 2026-10-21 13:06 UTC · 128 views · 4 replies
A Member
We run LLM agents with real tool access in production, so monitoring isn't optional — it's the safety layer. Here's what we actually log and the reasoning behind each choice.

Every tool call: full arguments and outputs, with a hash-chained log so tampering is detectable. This is the primary audit trail. If an agent does something destructive, the tool log is where we reconstruct it. We keep 90 days hot, a year cold.

Prompt/response pairs: we log them, but with PII redaction before storage. The tension is real — you need the actual prompts to debug weird behavior, but you can't keep raw user data forever. Our compromise: full logs for 14 days, redacted summaries after.

Anomaly triggers, not just raw logs: nobody reads raw logs at 3am. We alert on: tool calls outside the agent's declared scope, sudden spikes in token usage, repeated failed tool calls (often a sign of prompt injection or a broken integration), and any attempt to access credentials or exfiltrate data. Each trigger dumps the surrounding context into an incident bundle.

What we deliberately don't log: full file contents the agent reads (we log paths and hashes), or credentials in any form — those get redacted at the collection layer, not downstream.

The uncomfortable lesson: most of our incidents weren't exotic attacks. They were the agent doing something dumb with legitimate tools — deleting the wrong directory, spamming an API. Monitoring catches incompetence more often than malice, and that's fine. That's the point.

What does your agent monitoring stack look like — are we over-logging or under-logging?
A Admin
Thanks for a very concrete write-up. The line "monitoring catches incompetence more often than malice" matches what most incident reviews we've seen conclude, and it's a good argument for alerting on scope violations rather than trying to detect attacks directly.

Two additions that might help others build a similar stack:

1. Use a shared trace format. The OpenTelemetry semantic conventions for generative AI (https://opentelemetry.io/docs/specs/semconv/gen-ai/) define standard attributes for model calls, token usage and tool spans. Adopting them early means your agent traces can sit in the same backend as the rest of your service telemetry, and the trace id can follow a request across agent handoffs.
2. Log the decision context, not only the action. For destructive tool calls, storing the short plan or justification the agent produced just before the call makes post-incident review much faster than reconstructing intent from raw prompts.

To your question, a few follow-ups for members running agents in production: do you sample prompt/response logs or keep 100%? And has anyone measured how often the anomaly triggers fire on false positives versus real incidents?

— ASIHub Editorial (official staff account)
A Member
We keep 100% of prompt/response logs but tier the retention aggressively, and I would argue sampling the raw stream is the wrong trade-off for agents with real tool access.

The reason is that incidents in agentic systems are rare, high-impact, and almost never where you would expect them. Sampling destroys your ability to reconstruct the one trajectory that matters. Instead of sampling, we do what the original post describes: full capture with short hot retention — 14 days for raw prompts, 90 for tool logs — then aggressive summarization. The cost is manageable because the raw data ages out fast, and the summaries preserve the decision-relevant signal: what the agent saw, planned, and did.

On false positives: we measured. Over a quarter, roughly 70% of anomaly-trigger pages were false alarms. The breakdown was instructive: scope-violation alerts were the noisiest, because agents legitimately explore adjacent tools not listed in the declared scope; token-spike alerts were mostly batch-size changes; credential-access alerts were nearly always real. That distribution is actually useful. Instead of tuning thresholds globally, we kept the noisy triggers as low-severity 'observe' signals and promoted only the high-precision ones to paging.

The honest metric we report now is not precision but time from first trigger to a complete incident bundle. The triggers' real job is to start the recording, not to be right — a false positive that produced a good incident bundle is a cheap drill; a missed incident with no bundle is the failure.

One more practical note: log the trigger's own decision inputs. When an alert fires, store the exact rule or score that fired alongside the context. Otherwise your false-positive analysis is archaeology, and you cannot tell whether the rule is bad or the incident was just boring.
O Member
From a field perspective: make sure monitoring is in place before deployment.
A Member
Agreed, and the practical reason is that monitoring needs a baseline before real traffic hits. We deploy new agents in shadow mode first: full tool access wired up, monitoring recording everything, but actions gated behind a human approval or a dry-run flag. A week of shadow traffic gives you two things you can't get from staging — the real distribution of tool-call patterns, which is what lets you set anomaly thresholds that don't page anyone at 3am, and a calibration set for the triggers themselves. The false-alarm rate we measured early on was almost entirely a cold-start problem: thresholds picked from intuition rather than observed behavior. The other pre-deployment step that paid off: rehearsing the incident bundle. When an alert fires, it dumps the surrounding context — the trigger's inputs, the agent's recent plan, the tool calls before and after. We ran simulated incidents to check that the bundle actually contains enough to decide 'safe to resume' versus 'escalate,' and the first two dry runs showed gaps. Monitoring that isn't exercised before deployment is logging, not a safety layer — the difference only shows up when you need it.
Ad广告位招商 / Advertise hereSlot A10 · Rate card →
Log in or register to reply.
Ad广告位招商 / Advertise hereSlot A9 · Rate card →