Keep the four layers separate

The supplied SDK material describes a trace as an end-to-end workflow operation. Treat that operation boundary as the first decision; then choose the identifier or context field that answers the question at hand.

  • workflow_name is a readable label for the logical application or workflow.
  • trace_id identifies a trace and is documented as unique; use it when the question is “which operation?”
  • group_id is optional conversation-level linkage across separate traces.
  • Optional trace metadata carries contextual attributes; it should not replace either trace identity or conversation correlation.

Accordingly, this article recommends treating names, retention, metadata ownership, and review rules as application policy. It does not use the moved OpenTelemetry registry as authority for the Agents SDK identity model.

Decision table for boundary selection

Choose the narrowest boundary that matches the operational question. The final column is a proposed application action, rather than an SDK-prescribed implementation.

Four identity and correlation cases
CaseOperation boundaryIdentifier purposeUniqueness expectationCorrelation scopeMetadata ownerInference to rejectBounded application-owned action
one runner invocation as one operationOne Runner calltrace_id identifies that operationUse the documented unique trace ID; workflow_name is a labelThat one traceApplication for its metadata keysMatching workflow names prove matching operationsSet a readable workflow label and retain the trace ID for incident lookup.
multiple runs forming one operationSeveral Runner calls that jointly make one larger operationAn enclosing trace supplies the operation boundaryThe enclosing trace has its own trace identityAll calls inside that trace contextApplication defines the outer boundary and its metadataEvery Runner call must remain an unrelated top-level operationUse an outer trace only after the application declares that the calls form one operation.
multiple traces belonging to one conversationSeparate operations in a single conversationgroup_id links the separate tracesKeep every trace_id distinct; group_id is a shared correlation valueThe chosen conversationApplication owns the conversation mappingA conversation requires merging all work into one traceAssign a group ID while preserving each operation’s trace ID.
provider harness metadata with a per-run valueThe run that supplies contextual tracing dataMetadata records context, including a harness-related valueDo not use metadata as a uniqueness mechanismThe trace or run carrying that metadataSDK may add agent_harness_id; a run can supply the existing metadata keyA metadata field is a substitute for trace_id or group_idDocument key ownership and set a per-run value deliberately when that override is intended.

The supplied tracing documentation says the SDK normally surrounds a Runner invocation with a trace, while a trace context can place several runs under one broader trace. It also presents group_id as an optional way to connect traces from one conversation.

Failure walkthrough: undoing a name-based correlation

Consider a hypothetical team that gives unrelated operations the same workflow_name and then concludes that they represent one operation. The label is useful for describing the workflow, but the supplied material assigns trace identity to trace_id. The team should preserve the existing trace IDs and withdraw the name-based correlation conclusion.

Next, choose the intended boundary conditionally. If the operations are actually stages of one end-to-end unit of work, the team can propose an outer trace around the relevant runs. If they are separate operations from one conversation, it can instead propose a shared group_id. Neither choice follows merely from equal names.

This is an unexecuted architectural walkthrough. The application should define its own naming convention, correlation-key retention period, metadata access rules, and review process before applying either policy.

Metadata and data-handling limits

Metadata is optional in the supplied tracing description. The configuration excerpt states that configuring a default harness ID causes agent_harness_id to be added to trace metadata unless RunConfig.trace_metadata already contains that key. That precedence is relevant to ownership: decide whether the application or the SDK should supply each key before relying on it for analysis.

Tracing can be disabled, and a run can be configured to omit potentially sensitive inputs and outputs from trace payloads. Those controls concern recording rather than identity design. They do not establish an application retention policy or make a metadata value safe to retain.

Alternatives, limits, and review triggers

For a single operation, the trace-per-run approach is the simplest option. For a composed operation, an outer trace provides a larger boundary. For a conversation made of separate operations, group_id avoids collapsing those operations into one trace. Metadata remains supplementary context in all three designs.

This guidance is limited to the supplied excerpts, which contain gaps. Revisit the decision table when the source material changes, or when a version retirement or incompatible release affects tracing, metadata precedence, or default trace creation.