Cloudflare now traces every step an AI agent takes
· Do Minh Tuan · Business Hackers 🚀
Cloudflare has added agent tracing to Workers, which records a span for each meaningful step an AI agent takes: when it is invoked, when it calls a model, when it runs a tool, and when an approval happens. You can replay a session turn by turn and see the sequence of decisions. For anyone who has tried to debug an agent that behaved strangely and could not reconstruct why, that is a real gap being filled, and I would not want to debug an agent without it.
Anyone who has run an on-call rotation knows how much of debugging depends on a timeline. With a normal request, you have a stack trace, a log line and a request id, and you can follow the path. With an agent, the path wanders. It calls a model, gets an answer, chooses a tool, gets a result, revises. By the time a user complains, the evidence is spread across several systems, and nobody can say which step went wrong.
Why agent tracing is different
A trace for a web request is deterministic in the happy path. The same input usually follows the same route. An agent is different because the model's output decides the next step. Two runs of the same prompt can take different paths, and the interesting failure is often a path you did not anticipate. Tracing is how you turn that into something inspectable.
The span types in the announcement map to the places where things go wrong. An invocation span tells you the agent started and with what. A model call span shows the request and response, which is where a bad prompt or a model change shows up. A tool run span shows what the agent did to the outside world, which is where damage happens. An approval span shows where a human was in the loop, which matters when you are trying to work out who said yes.
The replay feature is the part I would use most. It is one thing to see a list of spans. It is another to step through them in order and watch the session unfold. For a support team trying to explain to a customer why the bot did something, that is valuable. For an engineer, it is the difference between guessing and knowing.
The caveats are in the fine print
Cloudflare's documentation is honest about two limits, and both matter. The traces are not lossless, and payloads may be truncated. That means you get a summary of what went through, not a verbatim transcript. For most debugging that is enough. For a dispute about exactly what a model was told, it may not be, and you should not build an audit process on the assumption that it is.
The second caveat is that payload recording defaults differ by framework. Depending on how the agent is built, you may get more or less detail without changing anything. That is the kind of inconsistency that produces confusing comparisons, so I would check what is recorded for each framework before relying on a trace.
The third is cost. From 1 October 2026, every span counts as a billable event. That is a significant change in how you think about instrumentation. When tracing was free, the temptation was to trace everything. When each span has a price, the sensible approach is to trace the decision points that matter and leave the rest alone. I would put a budget on tracing the same way I would put one on model calls.
What I would instrument
Start with the boundaries. Log every model call with the model name, the token counts and the latency. Log every tool call with the tool name, the arguments and whether it succeeded. Log approvals with who approved and what they saw. Those four things cover most of the questions you will ask after a bad session.
Then add the business-critical decisions. If the agent decides whether to refund, cancel or escalate, that decision deserves its own span with the reason attached. If the agent writes to a database or sends an email, that is a tool run you want recorded, because it is an action with consequences outside the system.
I would not instrument every internal step. A trace with a thousand spans is as hard to read as no trace, and now it costs money. I think the skill is choosing the ten points where a human will want to look.
Who this is for
If you run a single prompt in a single endpoint, you do not need this. A log line is enough. If you run agents that take several steps, call tools and touch customer data, tracing stops being a nice-to-have. It is how you answer the question every client eventually asks: what exactly did the system do, and why?
For a team in Vietnam building agents for overseas clients, this is a useful differentiator in a sales conversation. Being able to show a client a replay of a failed session, with the exact tool call that went wrong, is more convincing than any slide about architecture. It also protects you when the client blames the agent for something a human approved.
My honest view is that observability for agents is still immature, and a first-party feature from a platform is a step toward normal. The billing change is the part I would plan for now, because instrumentation decisions are hard to reverse once a team has built dashboards on top of them. Trace deliberately, keep the retention short, and check what the payloads contain before you send them to a third party.
Written with AI assistance, reviewed and edited by Do Minh Tuan.