Wait, Automatic Tracing? wrangler dev Now Ships a Debug API Built for Coding Agents!
Hey everyone, Shii-chan here! I've got great news for coding agents today. Local Worker development just got a lot easier to debug, and I can't stop being excited!
Cloudflare BlogWhat was announced?
This comes straight from the Cloudflare Blog. wrangler dev and vite dev now automatically capture OpenTelemetry-format traces for every local request, and expose them to coding agents through a single API called the Local Explorer API.
When Cloudflare's tooling detects an agent session, it automatically points the agent to this API. That means there's no SDK to install, no tracing to enable, and no extra configuration needed on the agent's side.
The story so far
Until now, chasing down a bug in a Worker meant sprinkling console.log calls through your code, running it, eyeballing the output, then tweaking and running it again. Checking whether a KV read succeeded, whether a D1 write went through, or whether a Queue actually fired meant working through each piece by hand, one slow loop at a time.
What changes
Now a single query to the Local Explorer API can surface everything that happened during a request. In the example from the post, a KV read succeeded, but a D1 insert failed because the delivery_window column was missing, which is why the Queue never fired — and all of that shows up from one query.
That lets a coding agent pinpoint the cause, apply a migration locally, and rerun to verify — all inside a single loop. No deployment required, since everything happens locally.
Dive Deep
Here's how it works under the hood.
- The workerd runtime automatically instruments outgoing HTTP requests (timing, status codes, metadata), binding calls to KV, R2, D1, Durable Objects, and Queues, and the full handler lifecycle from
fetchtoscheduled - Miniflare collects these runtime events and console output, and converts them into OpenTelemetry traces and logs
- The converted data is stored locally in a SQLite-backed Durable Object
You can pull the stored traces from http://localhost:8787/cdn-cgi/explorer/api. The POST /cdn-cgi/explorer/api/local/observability/query endpoint in particular lets you query traces and logs with SQL. The API root serves an OpenAPI schema, so agents can discover how to use the API at runtime.
If you want to look at it yourself, press e in Wrangler or visit /cdn-cgi/explorer on your local server to open the Local Explorer, where you can inspect spans, timing, attributes, errors, and correlated console logs visually.
To use it, just make sure wrangler and @cloudflare/vite-plugin are on their latest versions.
npm install --save-dev wrangler@latest
npm install --save-dev @cloudflare/vite-plugin@latest
Wrap-up
wrangler devandvite devnow automatically capture OpenTelemetry traces for every local request- You can query traces and logs with SQL through the Local Explorer API at
http://localhost:8787/cdn-cgi/explorer/api - Fetch calls, binding calls to KV/R2/D1/Durable Objects/Queues, and the full handler lifecycle are all auto-instrumented
- No SDK installation, tracing setup, or agent-side configuration required
- Humans can see the same data by pressing
ein Wrangler or visiting/cdn-cgi/explorer
If you're letting a coding agent build on Workers, or you just want a faster local debugging loop, this update is for you!