← All answers

Question

What is the cleanest way to trace and log an agent workflow in production without much overhead?

Short answer

Wrap your model client once, record spans instead of printing logs, and send them in the background so your agent never waits on telemetry. Keep payloads to what you need and add detail only where you debug.

In more detail

  • Instrument at the edges

    Wrap the model client and tool functions rather than every line of code. That covers the steps that cost money and fail.

  • Never block the request

    Telemetry should be sent in the background and fail quietly, so a tracing problem cannot break your agent.

  • Control the volume

    Sample routine runs, keep every failed run, and trim large payloads you do not need to read.

Answers are the start.

Open a real trace and see it for yourself.