TL;DR: When an AI agent sends a strange reply, or sends nothing at all, the conversation transcript shows the outcome and almost none of the decisions behind it. A per-turn trace fills that gap by recording what came in, what context was built, which checks ran and what they decided, which tools were called with what inputs and results, why the planning loop stopped, what was sent and what it cost. Written durably and step by step, the same record also stops a duplicate message from being processed twice and shows the last thing that definitely happened when a turn crashes halfway. This post walks through what a good trace contains, how it answers the most common question about a deployed agent, how traces become test cases, and what should be kept out of them.
In 1953, an Australian scientist named David Warren was working at the Aeronautical Research Laboratories in Melbourne while investigators tried to work out why the de Havilland Comet, the world’s first commercial jet airliner, had crashed. The wreckage could tell them a good deal, but nothing could tell them what the crew had seen, heard or said in the final minutes, and Warren, who had recently seen a miniature voice recorder at a trade show, began to wonder why aircraft didn’t carry one. His 1954 report, “A Device for Assisting Investigation into Aircraft Accidents”, proposed recording both the voices in the cockpit and the readings on the instruments, and he went on to build working prototypes.
Aviation authorities were largely uninterested at first. It took the 1960 crash of Trans Australia Airlines Flight 538 at Mackay, in Queensland, and a firm recommendation from the judge at the inquiry, before Australia became the first country to make cockpit voice recording compulsory. The devices everyone now calls black boxes are, slightly confusingly, painted bright orange, so that they’re easier to find in the debris.

Conversational AI agents are at roughly the stage aviation was at before Warren. When an agent sends a reply that makes no sense, or leaves a customer’s message unanswered, the people responsible usually have the transcript and very little else, which is rather like investigating an accident from the passenger list. This post is about the recorder an agent should carry: what each turn of a conversation should leave behind, and what that record makes possible.
What the transcript leaves out
A transcript records the two ends of a turn, the customer’s message and the agent’s reply, while almost everything that decided the reply happens between them. Along the way, a modern agent loads the customer’s record and a summary of the conversation so far, works out which tools it is allowed to use, runs a series of code checks, lets a model choose tools, runs them, writes a reply from the results, checks the reply again and only then hands it to a messaging provider. Any one of those steps can explain a strange outcome, and none of them appears in the conversation.
Wrong answers about availability are a good illustration, because the same sentence on the screen can come from several unrelated faults. The calendar search might have used the wrong timezone, it might have timed out so that the reply was written around an error, or the agent might never have searched at all, in which case the model simply guessed. Each of those has a different fix, and from the transcript alone they look identical.
Silence is harder still, since a reply that never arrived leaves nothing in the conversation to inspect. The only way to know whether the agent decided not to answer, was prevented from answering or answered into a send that failed is to have written the decision down when it was made. Anthropic’s guide Building Effective Agents recommends making an agent’s planning steps visible for much the same reason, since an agent whose steps can be seen is far easier to correct.
What a turn should record
The useful unit is the turn, meaning everything that happens between one inbound message (or a short burst of messages answered together) and the decision about what to send back. A good trace gives each turn one parent record, with a separate row underneath for every tool call, and fills both in as the turn progresses so that a turn which never finishes still leaves most of its story behind.

| What to record | Why it matters later |
|---|---|
| The inbound message, with the channel and the provider’s event id | Shows exactly what the agent was answering, and lets duplicates be recognised |
| The context that was built: the contact’s details, the conversation summary, the tools that were enabled | Explains answers that depend on what the agent knew or was allowed to do |
| Each gate and its verdict, before the model runs and after the reply is written, with a reason code | Turns “it didn’t reply” into a named cause |
| Each tool call: its input, its output, whether it succeeded and how long it took | Separates a poor decision from a failed action |
| The stop reason of the planning loop | Shows whether the agent finished, hit its step limit or stopped on a tool error |
| The final reply, and any repair the checks asked for | Lets you compare what was drafted with what was sent |
| The send status and the provider’s message id | Connects the turn to delivery receipts and carrier errors |
| The model, tokens and cost, ideally per stage | Explains slow or expensive turns, and catches a model that changed without anyone noticing |
| Latency and the final status | Gives a quick way to find turns that failed, were blocked or were deferred |
Two of these deserve more attention than they usually get. The built context is the field most often missing, because it’s large and feels redundant, yet many puzzling replies turn out to be sensible responses to the wrong information, such as an outdated summary, a field the agent wasn’t permitted to see or a tool that a rule had quietly switched off. Storing a snapshot of what the agent was actually given, with a size cap so that it doesn’t swallow the database, answers that whole class of question at a glance.
The tool records matter for a different reason. A tool’s output is evidence, and a reply should only claim what the evidence supports, so when a customer is told “you’re booked for Thursday at 3” the trace should contain a booking call with a successful result and an appointment id to match. If that call is missing, the fault lies with the reply. If the call is there and the appointment still isn’t on the calendar, the fault lies further down, in the tool or in the calendar it writes to.
Checkpoints and the message that arrives twice
A trace written only at the end of a turn has a serious weakness, which is that the turns you most need to understand are the ones that never reached the end. A worker that crashes after booking an appointment and before recording it leaves no sign of the booking, and if the job is retried, the agent may cheerfully book a second one. Durable traces are therefore written incrementally, with a checkpoint after every stage and, above all, after every action that changes something in the world, so the record always shows the last thing that definitely happened.
The same rows solve a quieter problem. Messaging providers deliver inbound messages as webhooks, and a webhook can arrive more than once, since a provider that doesn’t get a prompt acknowledgement may try again, and job queues that retry failed work can produce the same effect from the inside. Left unprotected, each delivery becomes its own turn, and the customer receives two replies, or two bookings.

The protection is an idempotency key, a value that identifies the inbound event so that a second attempt at the same work can be recognised as such. The provider’s own message id is the natural choice when there is one, and a hash of the conversation and message content serves when there isn’t. Because the trace row is written at the very start of the turn, a unique constraint on that key in the trace table turns the trace itself into the guard. The second delivery either finds the existing row and stops quietly, or tries to insert its own row, fails on the constraint and stops all the same, which also covers two workers picking up both deliveries at almost the same moment.
Tool calls can use the same idea on a smaller scale. If a data-changing tool has already succeeded within the turn with identical inputs, a retry can return the recorded result without running the action again, so the booking made before the crash is reused.
A trimmed trace for a turn that ended in silence might look like this:
json{
"status": "deferred",
"channel": "sms",
"inbound_message": "Hi, can I move my appointment to Friday?",
"pre_gates": { "action": "deferred", "reasons": ["outside_business_hours"] },
"loop_stop_reason": "blocked_by_gate",
"tool_calls": [],
"final_reply": null,
"send_status": "skipped",
"latency_ms": 41
}
The agent stayed quiet because the message arrived outside its reply hours, and the whole decision took a fraction of a second because no model was ever called.
Answering “why didn’t it reply?”
This is the question asked most often about any deployed agent, and a good trace usually answers it with one of a handful of causes:
- A gate blocked the turn: the customer had opted out, the contact was inactive or had no consent recorded, the channel wasn’t compliant, or a message cap had been reached.
- A person had taken over: once a teammate takes over a conversation the agent should stay silent, and the trace records the block with its own reason.
- It was outside the reply hours: the turn was deferred, and whether a deferred message is ever answered later varies between systems.
- It was a duplicate: the same event had already been handled, and the second attempt stopped before doing anything.
- The agent chose silence: a message such as “ok thanks” may need no answer, and a good trace marks that as a completed turn with nothing to send.
- The reply failed its checks: a post-gate caught a claim the tools hadn’t supported, the permitted repair failed too, and the turn ended without sending.
- The send failed: the turn completed, but the provider rejected the message, which shows up as a failed send status with the provider’s error, often a carrier filtering problem.
Each of these has a different owner. Gate blocks usually point to contact data or settings, takeovers to the team, deferrals to the agent’s schedule, failed checks to its instructions or tools, and failed sends to the messaging setup, so a trace that names the cause also tells you whom to ask.
Traces as test cases, and what to leave out of them
Traces earn a second life as evaluation material. A turn that went wrong already contains everything a test needs, namely the inbound message, the context the agent was given and the outcome that shouldn’t have happened, which is why the most valuable evaluation sets for conversational agents tend to be built from real failures. Replaying the recorded context against a changed prompt or a different model shows whether the fix works and whether anything that used to work has quietly broken. The tool records make the assertions precise, since a rule such as “never claim a booking the booking tool didn’t make” can be checked directly against the trace, without anyone judging the wording of the reply.
The same richness creates a privacy obligation. A trace of a customer conversation is a customer record, usually containing names, phone numbers, appointment details and whatever the customer chose to write, and it deserves the same care as the conversation itself. Secrets are the clearest case, and API keys, access tokens and passwords should be redacted, by field name and by recognisable pattern, before the context snapshot is stored, or a key pasted into a message will sit in the database indefinitely. Card numbers and government identifiers belong in the same category, and the simplest protection there is an agent that never asks for them. The OWASP Top 10 for LLM Applications lists sensitive information disclosure among its main risks, and logs are one of the less obvious places where that information collects.
Retention is the other half of the problem, since traces are most useful in the weeks after a turn, while someone is debugging it or turning it into a test, and far less useful a year later. A sensible policy keeps full detail for a limited period, keeps summary fields such as status, stop reason, latency and cost for longer, and removes a customer’s traces along with the rest of their data when they ask.
In Myna: every turn starts by checking whether the same message has already been handled, using the provider’s event id or an idempotency key, both protected by unique constraints, and stops quietly if it has. Otherwise a turn record is written straight away and checkpointed after each stage and after every data-changing tool, holding the inbound message, the built context with secrets redacted, the verdicts and reason codes of the checks before and after the reply, the loop’s stop reason, the final reply, latency and a breakdown of tokens and cost by stage. Every tool call gets its own row with its input, output, success and timing, and a data-changing tool that already succeeded with the same inputs in that turn isn’t run again.
Reading the recorder
Flight recorders are now standardised to the point where an investigator almost anywhere can read one, and agent traces are slowly moving in the same direction. OpenTelemetry, the open-source observability project, publishes semantic conventions for generative AI that give common names to model calls, agent invocations and tool executions (with operation names such as invoke_agent and execute_tool), along with attributes for the model and the conversation a span belongs to, and metrics for token usage. The conventions are still marked as in development, so the names may change, and they leave the capture of prompts and replies switched off unless someone deliberately opts in, which is a sensible default for exactly the privacy reasons above.
Whichever format the records end up in, their value comes from being read, and the most useful habit in the first weeks of a deployment is to open the traces of the turns that went wrong, one at a time, until the causes start to repeat and point towards a small number of fixes.