Agent traces for Think, Flue, and AI SDK in Agents SDK
Agent tracing is now available for applications built with the Agents SDK, showing each agent turn with model calls, tool runs, approvals, token usage, and Workers runtime operations. Developers can enable tracing via Wrangler configuration and wrap the AI SDK to automatically capture and inspect traces in the Cloudflare dashboard.
Agent tracing is now available for applications built with the Agents SDK. Traces show each agent turn alongside model calls, tool runs, approvals, token usage, and Workers runtime operations.
Turn on Workers tracing in your Wrangler configuration:
{
"$schema": "./node_modules/wrangler/config-schema.json",
"observability": {
"traces": {
"enabled": true
}
}
}[observability.traces]
enabled = true
Think and Flue applications emit agent traces automatically. For direct AI SDK calls, wrap the AI SDK namespace once. wrapAISDK() supports AI SDK v6 and v7. This AI SDK v7 example also supplies the agent identity:
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,
},
},
});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,
},
},
});
Message and tool payload recording is off by default. Turn it on only when the payloads are safe to store:
const tracedAI = wrapAISDK(ai, {
storeMessages: true,
storeTools: true,
});const tracedAI = wrapAISDK(ai, {
storeMessages: true,
storeTools: true,
});
Open the Agents tab ↗ in the Cloudflare dashboard to inspect sessions, replay conversations, and view trace waterfalls. For advanced setup, privacy controls, and trace structure, refer to Agent tracing.
Source: original entry ↗
More from Cloudflare
Follow Cloudflare to get its new changes in your feed and email digest.
Cloudflare One Client for Windows hotfix - trusted certificate chains
A new GA release for Windows Cloudflare One Client is available, addressing an issue with building trusted certificate chains.
Cloudflare One Client for macOS - Trusted Certificate Chain Fix
A new GA release of the macOS Cloudflare One Client is available. This hotfix addresses an issue with building trusted certificate chains.
Cloudflare One Client for Linux
A new GA release of Cloudflare One Client for Linux is now available. This hotfix addresses an issue with building trusted certificate chains.