Watching what your agent does
You cannot investigate what you did not record. Agents produce a lot of activity, and almost none of it is logged by default.
In 60 seconds
Watching what your agent does
You cannot investigate what you did not record. Agents produce a lot of activity, and almost none of it is logged by default.
What to record for every step
| Field | Why you need it |
|---|---|
| Correlation ID | Ties every step of one run together, across agents |
| Agent + version + model | "Which change caused this?" is unanswerable without it |
| Acting user | Who this was done for, not just which service account |
| Tool name and full arguments | The actual action, with real values |
| Tool result (or a hash) | What came back, and whether it was surprising |
| Source of influencing content | The URL, ticket, or file that preceded the decision |
| Approval record | Who approved, when, and what they were shown |
| Cost and duration | Runaway detection, and your invoice |
Alerts worth having on day one
- 1
A tool fires for the first time
This agent has never useddelete_userbefore. That is either a new feature or an incident. - 2
Volume spike
Thirty refunds in a minute where the normal rate is three an hour. - 3
Unfamiliar destination
An outbound request to a domain not on the allow-list, or an email to a brand-new recipient domain. - 4
Secret-shaped output
Anything matching a credential pattern appearing in output or in a URL. - 5
Loop detection
The same tool call repeating with near-identical arguments. - 6
Approval refused
A human said no. That is your highest-quality attack signal, and most teams never alert on it.
Make the trail human-readable
→ read ticket #99213 (source: customer email)
→ searched orders for user 4471 · 1 result
→ proposed refund ₹42,000 to a new recipient ← flagged: amount 84× the median
→ human refused · run ended
Watch and read more
Lab
A trace you can replay, and an alert that would have caught an incident.
The problem
log.info("agent.step", extra={
"run_id": run_id,
"agent": f"{AGENT_NAME}@{AGENT_VERSION}",
"model": MODEL_ID,
"acting_user": user_id,
"tool": tool_name,
"args": redact(args),
"result_hash": sha256(result),
"influenced_by": source_ref, # the URL / ticket / file just read
"approved_by": approver_id,
})You are done when
Hard questions
Try to answer before you reveal. If you can answer these, you understood the lesson.
Q1Why is a refused approval one of the highest-value alerts in the system?Reveal
Q2Your logs now contain everything the agent read, including customer data. Name the three obligations this creates.Reveal
Questions people ask
Isn't logging everything expensive?
Log all metadata always; sample the full content, and keep full content for anything that touched a write tool or an approval. That gets you most of the investigative value at a fraction of the storage.
Do I need special AI observability tools?
Helpful, not required. Tracing standards like OpenTelemetry handle agent traces fine, and dedicated tools mostly add nicer views of prompts, costs and evaluation. Start with your existing stack.
How long should I keep agent logs?
Long enough to investigate an incident discovered late — often 90 days — balanced against privacy obligations. Write the policy down before someone asks you in an audit.
What if the model's reasoning is not exposed?
Log what you can: inputs, tool calls, outputs, timing. The tool call sequence alone tells you most of what happened. Reasoning text is a nice-to-have, and it is not always a faithful account of the real cause anyway.
Lesson test
5 questions. Get 3 right (60%) to pass and complete this lesson.
Sign in with your phone number to take the test and save your progress