Content-free traces
Bonus: content-free traces
Section titled “Bonus: content-free traces”Time: 5–8 minutes
Flue’s Cloudflare tracing includes prompts, responses, instructions, tool arguments, and results by default. Keep the execution shape while turning that content capture off.
1. Install an explicit tracing policy
Section titled “1. Install an explicit tracing policy”Update src/app.ts to install content-free tracing before creating the route map.
The complete file below keeps the existing chat UI, ping endpoint, and agent
route. Changes shows the comparison with completed checkpoint 6:
src
- app.ts
Replace the entire contents of this file. In your code editor (for example, VS Code), open the file named above. Copy the code in Complete file, paste it into that file's editing pane, and save.
import { Hono } from 'hono';import { createAgentRouter } from '@flue/runtime/routing';import { instrument } from '@flue/runtime';import { createCloudflareTracing } from '@flue/runtime/cloudflare';import { FieldTrip } from './agents/field-trip.ts';import chatUi from './ui/index.html?raw';
instrument(createCloudflareTracing({ content: false }));
// src/app.ts is the Flue route map. Its default export owns every HTTP request// the Worker receives. Agents get mounted here with createAgentRouter(...)// starting in checkpoint 1.const app = new Hono();
// A small chat UI for trying the agent in a browser, locally and on workers.dev.app.get('/', (c) => c.html(chatUi));app.get('/api/ping', (c) => c.text('pong'));app.route('/agents/field-trip', createAgentRouter(FieldTrip));
export default app;Changes from Checkpoint 6 (guide) → Content-free traces bonus
+4−0
Use this comparison to review what's changing. For code to paste into your editor, use Complete file.
===================================================================--- a/src/app.ts Checkpoint 6 (guide)+++ b/src/app.ts Content-free traces bonus@@ -1,8 +1,12 @@ import { Hono } from 'hono'; import { createAgentRouter } from '@flue/runtime/routing';+import { instrument } from '@flue/runtime';+import { createCloudflareTracing } from '@flue/runtime/cloudflare'; import { FieldTrip } from './agents/field-trip.ts'; import chatUi from './ui/index.html?raw';
+instrument(createCloudflareTracing({ content: false }));+ // src/app.ts is the Flue route map. Its default export owns every HTTP request // the Worker receives. Agents get mounted here with createAgentRouter(...) // starting in checkpoint 1.What changes: an explicit tracing adapter replaces the default installation and turns conversation-content capture off while retaining the execution timeline.
Walk through the change
- Create the policy-bearing adapter.
createCloudflareTracing({ content: false })configures Flue’s Cloudflare trace attributes. The policy omits model messages, instructions, tool arguments, and tool results from those spans rather than redacting the conversation shown to the user. - Install it at module setup.
instrument(...)registers that adapter before the route map is created. Flue uses the explicit installation in place of its built-in one; this is not a second copy of the same tracing pipeline. - Keep the useful execution shape. The new traces still contain
invoke_agent,chat, andexecute_toolspans with timing, status, model identity, and token usage. You can still investigate a slow tool or model call without reading its prompt and result in the trace. - Understand the scope. This affects newly recorded Flue trace content. It does not rewrite old traces, delete stored chat history, or remove separate application logs such as checkpoint 6’s forecast note.
Follow it in the workshop: redeploy, make a fresh request, and inspect its trace. Check both sides of the change: timing and tool spans should remain, while message and tool-payload attributes should be absent.
This explicit instrumentation replaces Flue’s built-in tracing install. The
existing wrangler.jsonc already enables Workers Traces.
2. Deploy and inspect
Section titled “2. Deploy and inspect”npm run typechecknpm run deploysleep 5npm run smoke -- https://field-trip-agent.<subdomain>.workers.dev private-trace \ "Plan a Lisbon offsite from <START> to <END> for 8 people. What's the weather?"Use the exact deployed URL and the workshop dates. After ingestion, open the newest trace in Workers & Pages → field-trip-agent → Observability → Traces.
Save your workers.dev subdomain to open this test ↗https://field-trip-agent.<subdomain>.workers.dev/?id=private-trace
This opens the same conversation as the smoke test. If you repeat this checkpoint, before copying its commands.
Restart npm run dev in Terminal A, then run in Terminal B:
npm run typechecknpm run smoke -- http://localhost:5173 private-trace-local \ "Plan a Lisbon offsite from <START> to <END> for 8 people. What's the weather?"Open local chat in your browser ↗http://localhost:5173/?id=private-trace-local
This opens the same conversation as the smoke test. If you repeat this checkpoint, before copying its commands.
This tests the agent with the new instrumentation. To verify content-free Workers Traces in the dashboard, use the Live deploy tab.
Verification gate
Prove it works
invoke_agent,chat, andexecute_toolspans remain.- Timing, status, model identity, and token usage remain.
- Messages, system instructions, tool arguments, and tool results are absent.
Remove both imports and instrument(...), then redeploy. Existing traces retain
the policy used when they were recorded; only new traces change.
Reference: Flue Cloudflare tracing.