Skip to content

CodeAct host tool spans should be parented under execute_code #6704

Description

@eavanvalkenburg

Description

When a CodeAct agent invokes a host tool from inside the execute_code tool, the OpenTelemetry span for that invoked host tool should be parented underneath the execute_code tool span.

Right now, the tool span appears as a separate sibling / incorrectly-parented span in the trace, which makes the CodeAct execution flow harder to understand in observability tools such as the Aspire dashboard.

Expected behavior

For a CodeAct run like:

  1. Agent calls execute_code.
  2. Code inside the sandbox calls a host tool via call_tool(...).
  3. The host tool executes.

The trace hierarchy should look like:

agent run
└── execute_code tool
    └── host tool invoked by CodeAct

Actual behavior

The host tool invoked by CodeAct is not parented under the execute_code tool span, so the trace does not accurately represent the nested execution flow.

Why this matters

Correct span parenting would make CodeAct traces easier to inspect, especially when debugging sandbox execution and host-tool calls in OTEL backends.

Metadata

Metadata

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions