New Tool Radar

AI Agents & Automation

How to Name Agent Runs With Traceable Ids

Name agent runs with traceable ids so any log line can be traced back to its run.

Schematic with three steps: Generate the id when the run starts; Carry the id on every log line; Test by tracing a failure back to.

When something goes wrong, the first question is always which run it was. A traceable run id answers it: a short, unique id given to the run at its start, carried on every log line, every tool call, and every notification that run produces. CrewAI Flows generate a unique id for each flow state automatically, and LangSmith traces are organized around runs in the same way. Copy that shape: generate the id when the run starts, put it in the run record, and require every log line and message to carry it. A run with no id is a run you cannot find again.

What you need

  • A run record that can hold an id, created when the run starts
  • An id format: short, unique, and readable, such as a date plus a sequence
  • Every log line and notification the run produces, checked to carry the id

Step 1: Generate the id when the run starts

When a run begins, generate a unique id and store it in the run record with the task name and start time. An id generated later cannot be attached to the earlier steps.

Step 2: Carry the id on every log line and message

Put the run id on each log line, each tool call record, and each notification the run sends. A line without the id is a line that belongs to no run.

Step 3: Test by tracing a failure back to its run

Take one log line from a failed test run and use only its id to find the run, its task, and its other log lines. If you cannot, the id is missing somewhere it should be.

Worked example: synthetic run id check

The table below is a synthetic example. It shows the expected result of traceable run ids; no run was started.

Item Carries the run id? Result
Log line, step 1 Yes Pass
Tool call record Yes Pass
Failure notification Yes Pass
Failure traced to its run Yes Pass

Expected result (UNTESTED). every log line, tool record and notification carries the run id, and a failure is traced back to its run from the id alone. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • An id must be unique: two runs sharing an id merge into one confusing record.
  • An id that changes mid-run splits the run in two, so generate it once.
  • The id helps tracing, not diagnosis: it finds the run, it does not explain the failure.
  • Ids in notifications must not expose personal data; keep them to the id and the outcome.

Sources

See all