Cloudflare Agents Ships Tracing for AI Agent Workflows
Debugging an AI agent is harder than debugging a regular API. When something goes wrong — the wrong tool fires, a hallucinated parameter slips through, or a conversation derails three turns in — you are looking at a chain of model calls, tool invocations, conditional branches, and approval gates, all stitched together by prompts. The standard debugging toolkit for this is print statements and hope.
Cloudflare just shipped agent tracing for its Agents SDK, and it is the first time I have seen observability for agents that does not feel bolted on. Traces show each agent turn alongside model calls, tool runs, approval decisions, token counts, and runtime operations — all in a waterfall view inside the Cloudflare dashboard. Think and Flue applications, which are Cloudflare’s own agent frameworks, emit traces automatically with zero configuration. For custom apps using the AI SDK directly, one function call wraps the entire thing.
What the Traces Actually Show
A single agent interaction can spawn a lot of moving parts. A typical turn might involve: the agent receives a user message, calls a model with system prompt and conversation history, the model returns a tool call, the agent executes the tool against a database or API, the result feeds back into the model, the model decides whether to call another tool or respond, and finally a message goes back to the user. Each of these steps happens in milliseconds, but when something fails, you need to see which millisecond broke and why.
Cloudflare’s agent traces capture this as a single span tree. At the top level is the agent session. Under it, each turn gets its own span. Inside each turn, you see the model call (with token counts: prompt tokens, completion tokens, cached tokens), any tool invocations (with duration and status), approval gates (did a human sign off?), and Workers runtime operations like KV lookups or D1 queries.
The waterfall view in the dashboard lets you expand any span to see its children. If a tool call took 800ms, you click into it and see whether the bottleneck was the network, the query, or the tool logic itself. If a model returned a malformed tool call that the agent SDK had to retry, that shows up as a failed span with a retry child. This is table stakes for backend observability but AI agents have been running without it for years.
Token usage tracking matters for cost, not just debugging. When you see that a single user interaction burned 12,000 tokens across three model calls because the agent kept looping on a tool — you want to know. The trace makes that visible. You can filter by conversation ID to see how specific user sessions performed, or by agent ID to compare different agent configurations side by side.
Think and Flue: Automatic Instrumentation
Think is Cloudflare’s agent for reasoning-heavy tasks. Flue handles multi-step workflows with branching logic. Both are built on top of the Agents SDK, and both get tracing for free. You deploy them to Workers, and traces appear in the dashboard with no additional code.
For teams building their own agents on top of the AI SDK (not Think or Flue), the integration is one function:
import * as ai from "ai";
import { wrapAISDK } from "agents/observability/ai";
const tracedAI = wrapAISDK(ai);
await tracedAI.generateText({
model,
prompt: "Find an available appointment",
runtimeContext: {
agentId: "booking-agent-production",
conversationId: "conversation-123",
},
telemetry: {
functionId: "booking-agent",
includeRuntimeContext: {
agentId: true,
conversationId: true,
},
},
});
wrapAISDK takes the standard AI SDK namespace and returns a traced version. Every call through it — generateText, streamText, generateObject, tool calls — gets a span. The runtimeContext and telemetry fields let you attach agent and conversation IDs so the dashboard can group traces by session.
Message and tool payload recording is off by default. That is the right default — prompts and tool outputs often contain user data, API keys, or proprietary business logic that should not be sitting in trace storage. You can turn it on with storeMessages: true and storeTools: true, but only when you are certain the payloads are safe to store:
const tracedAI = wrapAISDK(ai, {
storeMessages: true,
storeTools: true,
});
This is the kind of design decision that suggests the team has actually run agents in production. Full payload capture is useful during development and debugging on staging. In production, the span structure and metadata (timing, token counts, status) are usually enough to diagnose issues without exposing raw conversation data.
How Tracing Changes Agent Development
Before tracing, debugging an agent looked like this: reproduce the issue manually, add console.log statements at every decision point, deploy, reproduce again, scroll through thousands of lines of JSON, find the one line where the wrong value appeared, and hope you can fix it without introducing a new bug.
With tracing, the workflow shifts: open the Agents tab in the Cloudflare dashboard, find the failed session by conversation ID or time range, click into the turn that failed, and read the waterfall. The trace shows exactly which model call returned the bad tool invocation, what the arguments were, and what the SDK did with it. You might discover that the model returned a tool name the SDK did not recognize because of a typo in the system prompt. You might find that a tool call succeeded but returned an empty result because the database query was wrong. Either way, you know within seconds rather than hours.
This matters more as agents get more complex. A single-agent system with one tool is manageable with logs. A multi-agent system where Agent A delegates to Agent B, which calls three tools and waits for a human approval before responding — that is unmanageable without structured traces. Cloudflare’s tracing spans cross agent boundaries. If Agent A calls Agent B, the trace shows that as a child span, so you can follow the entire chain of reasoning from the user’s original message to the final response.
A New CI SDK Alongside
Cloudflare shipped agent tracing as part of a broader Agents Week release that also includes a new CI SDK built on Cloudflare Workflows. The CI SDK runs across millions of repositories and can spawn its own agents to handle tasks that a linear CI pipeline would struggle with — multi-repo builds, staggered deployments, agent-driven code review.
The CI SDK is interesting in its own right, but the connection to tracing is what ties it together. Local development now carries the same OpenTelemetry-compatible tracing that production agents get in the dashboard. You develop locally with wrangler dev, see traces in your terminal or a local trace viewer, and then when you deploy to production, the same tracing infrastructure feeds into the Cloudflare dashboard. No context switch between “dev mode debugging” and “prod mode debugging.”
For teams building agent pipelines that span multiple Workers, this is a significant operational improvement. Instead of correlating logs across five different Worker invocations by timestamp and hoping the clocks are synced, you follow a single trace ID through the entire pipeline.
What Is Not Yet There
The tracing is free during beta (until October 1, 2026). After that, it moves into paid Workers Observability. Cloudflare has not published the pricing, which makes it hard for small teams to commit. If tracing becomes a significant line item for agents that generate a lot of spans — and AI agents do — teams will be forced to sample or disable it, losing the debugging surface they just gained.
The trace viewer in the dashboard is functional but not as rich as dedicated observability tools like Honeycomb or Datadog. You cannot build custom dashboards from trace data, set alerts on span-level metrics, or export traces to an external collector. For teams that already have an observability stack, this means running two systems or waiting for the export feature.
Multi-agent tracing is present but the cross-agent boundary tracking relies on the SDK being consistent about propagating trace context. If you mix Cloudflare Agents SDK with third-party agent frameworks, those boundaries will break and you will see disconnected spans that do not link back to the original session.
Payload recording being off by default is the right call for production, but it means you need a separate mechanism for debugging prompt and tool output issues in production — sampling, user-reported issue replay, or a staging environment that mirrors production traffic.
Who Should Adopt This
If you are already deploying agents on Cloudflare Workers with the Agents SDK or AI SDK, you should turn this on today. It is free during beta, takes roughly three lines of config, and the debugging time it saves on the first production issue will justify the effort. Turn it on in staging first, get comfortable with the dashboard, then enable it in production with payload recording off.
If you are evaluating Cloudflare for agent hosting, the tracing story is a differentiating factor. AWS Bedrock Agents and Google Vertex AI Agent Builder have their own monitoring, but they do not give you span-level visibility across the full agent lifecycle the way Cloudflare’s OpenTelemetry-based approach does. The fact that local development and production use the same tracing infrastructure means you do not have to guess whether your staging environment is representative.
If you are building agents on another platform, watch what Cloudflare is doing here. Agent observability is going to become table stakes within the next 12-18 months, and the patterns Cloudflare is establishing — span-per-turn, cross-agent context propagation, configurable payload recording — are likely to become the baseline that other platforms adopt.
The OpenTelemetry Bet
Cloudflare chose OpenTelemetry as the tracing standard. This is not surprising — OTel is the closest thing the industry has to a universal observability protocol — but it is the right bet. It means traces from Cloudflare agents can eventually be exported to any OTel-compatible backend (Honeycomb, Datadog, Grafana, Jaeger) without format conversion. It means developer tools that understand OTel traces can visualize Cloudflare agents without special integration.
The current limitation is that Cloudflare does not yet support trace export. Traces stay in the Cloudflare dashboard. Once export ships — and the blog post hints that it is coming — teams will be able to feed agent traces into their existing observability pipelines alongside application traces, database traces, and infrastructure metrics. That unified view is where agent debugging stops being a specialized skill and becomes part of normal operations.
In the meantime, the dashboard is good enough to replace print-statement debugging for most agent workflows. And replacing print-statement debugging, after years of the AI industry pretending agents are just like regular software, is a meaningful step forward.