An AI agent tells a customer that a refund has been processed. The order system shows a refund request. The payment provider shows no completed refund. The agent's conversation history contains no obvious error.
What happened?
The agent may have called the wrong tool. The payment API may have rejected the request. Or the payment may have succeeded while its response was lost, leaving the agent convinced that nothing happened.
These are different failures. A conversation transcript may not distinguish between them.
That is the central challenge of AI agent observability: reconstructing not just what an agent said, but how execution moved through models, tools, APIs, queues and external systems, and what those systems actually did.
1. A transcript is not an execution trace
A transcript records the interaction visible to a user. An execution trace records the operations that produced it.
Consider a refund agent. Its workflow might involve:
- Receiving the customer's request.
- Retrieving the order and checking its status.
- Asking a model to select the next action.
- Calling a refund-policy service.
- Invoking a payment API.
- Waiting for the payment system to confirm the result.
- Responding to the customer.
A transcript may show the request and final answer. It may omit the policy lookup, the exact tool arguments, a retry, a timeout or a downstream response.
A trace represents these operations as related spans. Each span describes an operation, its timing and relevant attributes. Parent-child relationships show which operation initiated another. A trace can therefore reveal that a slow customer response was caused by a payment API call, rather than by model inference.
This is the foundation of distributed tracing. OpenTelemetry describes how trace context connects operations across services, while OpenInference defines conventions for representing LLM calls, tools, retrievers and other AI application operations.
The important distinction is that a trace is a causal map of execution, not simply a timestamped list of events.
2. The failure that a normal trace can still mislead you about
Consider a hypothetical refund workflow.
The agent checks the order, confirms that it is eligible, and calls the payment provider. The provider processes the refund, but the network connection fails before the response reaches the agent.
From the agent's perspective, the request timed out. It cannot tell whether the provider completed the operation.
If it retries without protection, the same refund could be submitted twice.
This is a classic distributed-systems problem: the caller can lose the response even when the server has successfully performed the operation. A timeout tells you that the caller did not receive a timely response. It does not establish that the operation did not happen.
Stripe explains this problem in its engineering discussion of idempotency. Its API supports idempotency keys so that a retry using the same key can return the result of the original operation rather than creating another charge.
The same principle matters when agents invoke consequential tools.
For a refund operation, the application should generate a stable operation identifier and pass it through to the receiving API when that API supports idempotency. A retry of the same logical refund should reuse the same key. A genuinely new refund should use a different one.
For example:
```http
POST /v1/refunds
Idempotency-Key: refund-order-8472
Content-Type: application/json
```
The key is not a substitute for authorization or business validation. It addresses a narrower problem: preventing repeated delivery of the same logical operation from producing repeated effects.
This changes how an engineering team should interpret a failed tool span. The investigation needs to establish whether the request was never sent, rejected, accepted, completed, or completed with its response lost. Those states should not be collapsed into a single label such as `tool_failed`.
3. The hidden break: when work crosses an asynchronous boundary
A trace can connect a model call to an API request when both happen inside one process. The harder problem appears when the agent hands work to another service through a queue.
Imagine that the refund agent publishes a message:
```json
{
"operation": "process_refund",
"order_id": "8472",
"amount": 1250
}
```
A separate worker consumes the message and calls the payment provider several seconds later.
If the tracing context is not carried with the message, the worker may create an entirely separate trace. The agent's trace ends when the message is published. The payment worker's trace begins when it consumes the message. Both traces may be individually valid, yet the connection between them is missing.
This is why adding trace instrumentation to every service is not enough. The context must travel with the work.
In HTTP-based communication, the W3C Trace Context standard defines the `traceparent` header. It carries a trace ID and the parent span ID, allowing downstream services to continue the same trace. OpenTelemetry uses this context to connect spans across service boundaries.
Message-based systems need equivalent propagation. The producer must inject context into message metadata, and the consumer must extract it when processing the message. OpenTelemetry's messaging span conventions explain how producer and consumer operations can be correlated.
There is an additional nuance: asynchronous work does not always fit neatly into a simple parent-child tree. A message can be retried, processed by multiple consumers or contribute to work involving several upstream operations. In these cases, trace links can express causal relationships without pretending that every operation is a direct child of one span.
For agent systems, this matters when:
- A planner delegates work to a sub-agent.
- A tool publishes a task for a background worker.
- A retrieval service performs asynchronous indexing or lookup.
- A workflow resumes after a human approval.
- A tool call triggers downstream processing that outlives the original model request.
If context propagation stops at any of these boundaries, engineers may see disconnected fragments rather than one reconstructable workflow.
Even a well-connected trace has a limit.
Suppose the payment API returns HTTP `200`. That establishes that the endpoint returned a successful HTTP response. It does not necessarily establish that the intended business operation reached its final state.
The endpoint might have accepted a refund request for asynchronous processing. The payment could still be pending, rejected later or require additional action.
An agent observability design should therefore distinguish at least three stages. Stage and what it establishes:
- Tool invocation: The agent or application attempted an operation with particular arguments.
- API response: The receiving endpoint returned a particular response.
- Business outcome: The receiving system's authoritative record shows what ultimately happened.
For a refund, the final stage may require checking the payment provider's transaction status or the order system's refund record. For a supplier onboarding workflow, it may require checking the procurement system's approval state. For a customer account change, it may require verifying the resulting account state.
This is a crucial boundary: observability can show the path an agent took; the system that owns the transaction must establish the transaction's outcome.
A trace should link to the relevant business operation identifier so an investigator can move from the agent's execution to the receiving system's record. Without that connection, a trace may explain what the agent attempted while leaving the actual consequence unresolved.
5. What should an enterprise trace preserve?
The objective is not to store every prompt and every byte of every response. It is to preserve enough structured information to reconstruct execution and investigate uncertainty. A useful trace should make it possible to answer:
- Which user request or workflow initiated the run?
- Which agent, model and relevant application version participated?
- Which model operation selected or requested a tool?
- Which tool and schema were available at that point?
- What operation identifier connected the tool call to the receiving system?
- Did execution cross a queue, worker or sub-agent boundary?
- Was context propagated across that boundary?
- What response or error did each component return?
- Was the operation retried, and did the retry reuse the same idempotency key?
- What does the receiving system say ultimately happened?
These are questions about reconstructing a particular execution. The exact fields will depend on the architecture and the sensitivity of the data.
There is also a privacy trade-off. Prompts, retrieved documents, tool arguments and outputs can contain personal data, credentials or commercially sensitive information. OpenTelemetry's GenAI conventions warn that these fields may contain sensitive information and recommend against capturing full content by default. See the GenAI span conventions.
A safer design often records identifiers, versions, operation types, status, timing and references to protected content. Where full payload capture is genuinely needed for debugging, it should be an explicit, access-controlled choice with defined retention and redaction rules. A trace should not become an unrestricted second copy of the enterprise's data.
6. The monitoring system must survive the system it observes
There is one more architectural question:
Where does the telemetry go?
If an agent, its worker and its observability backend all depend on the same failing service or infrastructure, an outage can remove both the application and the evidence needed to investigate it.
For example, an agent may fail because a shared database becomes unavailable. If the application can only write its execution records to that same database, the failure may prevent the records from being persisted.
This does not mean every enterprise needs a completely independent observability platform. It means the failure model must be explicit.
Teams should consider buffering telemetry locally, exporting it asynchronously, monitoring dropped telemetry and ensuring that critical operational records do not depend exclusively on the component whose failure they are meant to explain. Sampling also needs care: sampling is useful for controlling volume, but a policy that discards all error traces or rare consequential operations can remove precisely the evidence an investigation needs.
7. Turn traces into tests, not just dashboards
A production trace becomes more valuable when it changes how the system is tested.
Suppose an incident reveals that the agent retries a refund after a timeout without checking whether the first request completed. The team can turn that failure into a regression scenario:
- The payment provider receives the refund request.
- The provider completes the refund.
- The response is deliberately dropped.
- The agent experiences a timeout and retries.
- The test verifies that the receiving system records only one refund.
The test should also verify the expected trace relationships and operation identifiers. Otherwise, the application may stop duplicating refunds while the observability gap remains.
Not every production trace should be replayed blindly. It may contain personal data, credentials or changing external dependencies. Teams should sanitize or replace sensitive inputs, control external side effects and define which outputs are deterministic enough to compare.
Code-based assertions are appropriate for things such as tool selection constraints, required parameters, retry counts and idempotency behavior. Model-based evaluations can assess less deterministic qualities, such as whether retrieved context supported the agent's answer. These are different tests and should not be treated as interchangeable.
8. What technology leaders should ask
Before accepting an agent observability implementation, ask engineering teams to demonstrate three things:
- Can you follow one operation across boundaries? Start with a user request and show the model call, tool execution, queue handoff, worker and receiving API in one connected investigation.
- Can you distinguish an attempted action from a completed one? Show how a timeout, retry, API response and final business state are represented.
- Can you investigate a failure without exposing unnecessary data? Demonstrate what is captured, what is redacted, who can access it and how long it is retained.
If the demonstration ends at the agent's final answer, it has not yet established what happened in the connected systems.
9. Conclusion
AI agent observability is not simply a matter of recording more model calls or displaying tool activity on a dashboard. It is the engineering discipline of connecting decisions, operations and downstream effects across a distributed workflow.
- The most important distinction is between what an agent attempted, what a service acknowledged and what the business system actually completed.
- Trace context connects the execution path. Idempotency makes retries safer.
- Receiving-system records establish outcomes.
- Privacy controls determine what evidence can responsibly be retained.
For enterprises, that creates a useful boundary between operational observability and governance assurance. Observability helps engineers reconstruct execution. Continuous assurance helps an organization connect relevant changes, decisions, accountable owners and supporting evidence over time.
KlaritiQ focuses on that assurance layer: maintaining evidence-backed records of AI systems, changes, decisions and approvals. It is not a runtime tracing or breach-detection platform. The two disciplines address different questions, and enterprises need to know which one is answering theirs.
10. Frequently Asked Questions
1. What is the difference between an AI model and an AI agent? Does a company need to train both?
An AI model and an AI agent are different parts of an AI application. The model is the underlying technology that understands inputs and generates outputs, while the agent is the application built around that model to perform a task. An agent typically combines a model with instructions, available tools, business rules, application code, memory or retrieved information, and a process for deciding what to do next. A company can use a pre-trained model such as Claude through an API and build an agent by configuring its instructions, connecting approved tools and defining its workflow. It does not normally need to train the underlying model again. Alternatively, a company can use an open-source model, host it on its own infrastructure and optionally fine-tune it using relevant data before building the agent around it. Fine-tuning a model and configuring an agent are two different activities: fine-tuning changes the model's learned behavior, while agent configuration determines how the application uses the model, what it can access and which actions it can perform. The right choice depends on requirements such as accuracy, privacy, cost, latency, customization and infrastructure control.
2. What is a span in AI agent tracing, and how do parent-child relationships help find the cause of a failure?
A span is a recorded unit of work with a beginning and an end, which is why the term describes the time span occupied by an operation. For example, when a customer opens a checkout page, a tracing system might record one parent span for the `GET /checkout` request, a child span for retrieving product details from a catalog service, and another child span for a database query made by that service. Each span has its own identifier, start time, duration, status and relevant attributes. The parent-child relationship is recorded by the tracing instrumentation when one operation initiates another; it is not something engineers have to infer after an incident. OpenTelemetry's documented example of a frontend calling a Product Catalog service shows how engineers can compare the same product lookup across different parent operations: a lookup associated with checkout took approximately 1.7 seconds, while one associated with adding a product to the cart took approximately 130 milliseconds. That difference helps narrow the investigation to the checkout path. During an incident, engineers open the trace, locate the slow or failed span and follow its recorded parent and child relationships to identify which operation introduced the delay or error. In an AI agent, the same structure can connect the original request to a model call, a tool invocation, an API request and a database operation. Common span types include incoming HTTP requests, outgoing HTTP calls, database operations and internal application work; messaging systems also use producer and consumer spans. The important point is that a span records one operation, while the relationships between spans reveal how the larger workflow was executed.
3. Why would an AI agent send work to another service instead of completing the entire task itself? What happens to tracing when that work is separated?
An agent workflow is often split across services because different parts of the task have different operational requirements. Consider a customer requesting a refund: the agent can check the order and refund policy immediately, but the actual payment operation may need to be handled by a separate payment service that owns the payment credentials, transaction rules and connection to the payment provider. That service may also need to process requests reliably during periods of high traffic, retry temporary failures or continue work after the original user request has ended. A message queue allows the agent to submit a refund job without keeping its own process waiting for the payment operation to finish. This improves isolation, scalability and resilience, but introduces a tracing requirement: the original workflow's trace identifier and the relevant parent span context must travel with the queued message. Otherwise, the payment worker may start a separate trace that cannot be connected to the agent's original request. The first service should not simply pass a summary of its conversation; it should propagate the tracing context and a business operation identifier, such as a refund request ID, so the receiving service can report its execution and outcome against the same logical operation. If the agent needs to tell the customer whether the refund actually completed, the workflow must also retrieve the result, either by waiting for a response or by handling a later status update. The trade-off is that asynchronous processing makes services more independent and resilient, but the overall workflow becomes harder to follow and may finish long after the original request has returned.
4. What is asynchronous processing, and why can one agent workflow have multiple parent-child relationships or trace links?
Asynchronous processing means that a service starts or schedules work without waiting for that work to finish before continuing. For example, an agent may submit a refund request to a queue and immediately return a message saying that the refund is being processed. A payment worker consumes the message later, contacts the payment provider and updates the refund status. The agent's original operation may already have ended by then, even though the business task is still in progress. This is why a distributed trace is not always a simple tree in which every operation starts and finishes inside its parent's lifetime. Imagine that one worker processes a batch containing refund requests from several customer workflows: its work is related to multiple originating requests, so treating all of them as children of one arbitrary request would misrepresent what happened. Similarly, a message may be retried or handled by multiple consumers. OpenTelemetry supports span links to record these causal relationships without forcing them into a single parent-child chain. A parent-child relationship generally represents direct execution nesting, whereas a link says that two operations are related even when one did not directly start the other or their execution periods do not overlap. This distinction helps engineers reconstruct asynchronous workflows accurately, especially when jobs are delayed, retried, batched or resumed later.
5. What does context propagation mean in distributed tracing, and why can a trace break between two services?
Context propagation is the process of carrying tracing identifiers from one service or process to another so that their recorded operations can be connected. Imagine an AI agent calling a payment service over HTTP. The agent's tracing system has a trace ID identifying the overall workflow and a span ID identifying the current operation. It sends this information in a `traceparent` header. The payment service reads that header and creates its own span using the incoming span as its parent, allowing both operations to appear in the same trace. With a message queue, the same context must be attached to the message when it is published and extracted when a worker consumes it. A trace can become disconnected if the application does not inject that context, the receiving service does not extract it, an intermediary drops the metadata, or a custom integration does not support propagation. The services may still work perfectly, and both may produce logs and spans, but the observability platform cannot reliably establish that they belong to the same workflow. OpenTelemetry provides libraries and propagators to automate much of this process, but teams must verify that every relevant boundary, including queues and background workers, preserves the context. Importantly, context propagation carries tracing identifiers and related metadata, not the agent's entire conversation, prompt or decision history. Those require separate application-level records and identifiers.
6. Why does the tool schema matter when tracing an AI agent's execution?
A tool schema describes what a tool does, what inputs it accepts, which parameters are required and what types of values those parameters must contain. For example, a refund tool might require an `order_id`, a refund `amount` and a `reason`. The model uses the tool description and schema to decide whether the tool is relevant and how to construct its arguments. If the schema is incomplete, ambiguous or changed without updating the agent's configuration, the model may select the wrong tool, omit a required parameter or supply a value in the wrong format. The application may reject the call before it reaches the payment service, or it may accept a valid-looking request that does not represent the intended business action. This is why an execution trace should preserve which tools and schemas were available at the time, which tool was selected, the arguments generated, the arguments validated by the application and the response returned by the receiving service. Recording a schema version or stable schema hash is particularly useful: if an agent starts failing after a tool update, engineers can compare the schema used during a successful execution with the one used during the failure. Without this information, a trace might show that the agent called `process_refund` but not establish whether it was using the correct contract for that operation.