[BUG] Strands gen_ai spans (invoke_agent / execute_tool) emit no message content on AgentCore managed runtime — OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT has no effect
Checks
- [x] I have updated to the lastest minor and patch version of Strands
- [x] I have checked the documentation and this is not expected behavior
- [x] I have searched ./issues and there are no duplicates of my issue
SDK Language
Python
Strands Version
0
Language Runtime Version
Python 3.10.
Operating System
Amazon Linux 2023
Installation Method
other
Steps to Reproduce
Steps to reproduce
Prereqs: an AgentCore managed harness running a Strands agent with at least one
tool (via an AgentCore Gateway), CloudWatch Transaction Search enabled, and the AWS
CLI (bedrock-agentcore / bedrock-agentcore-control).
-
Enable content capture on the harness runtime. Set the ADOT agent-observability flag and the OTel GenAI content-capture flag as harness environment variables:
--harness-id <HARNESS_ID> \ --region <REGION> \ --environment-variables '{ "AGENT_OBSERVABILITY_ENABLED": "true", "OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": "true" }' (Note: the AWS_REGION , AWS_STAGE , AWS_TRUNCATION_* vars are reserved and cannot be set; only the two above are needed.) -
Wait for the harness to be READY and confirm the env vars + live endpoint version: --query 'harness.{status:status,version:harnessVersion,env:environmentVariables}'
aws bedrock-agentcore-control list-harness-endpoints --harness-id <HARNESS_ID> --region
--query 'endpoints[].{name:endpointName,status:status,live:liveVersion}'
Confirm environmentVariables contains both flags and the endpoint liveVersion
matches the new harnessVersion .
3. Force a cold container start. Because runtime env vars are read at process
start and warm containers are reused (default idle-session timeout 900s), wait
~16 minutes with no invocations so the pre-update container recycles. (Otherwise a
warm container started before step 1 serves the request without the new env.)
4. Invoke the harness with a brand-new session id and a prompt that triggers a tool
call:
harnessArn="<HARNESS_ARN>",
runtimeSessionId=sid,
messages=[{"role": "user", "content": [{"text":
"Use the
Result: the execute_tool span has gen_ai.tool.name / gen_ai.tool.call.id / gen_ai.tool.description / gen_ai.tool.json_schema / gen_ai.tool.status but no gen_ai.tool.call.arguments and no tool result; the invoke_agent span has agent name / tools / model / token usage but no input or output messages. Neither span has an events array. scope.name on both is strands.telemetry.tracer .
Expected: with OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true , the tool arguments/result and the model input/output messages should be present on these spans
Expected Behavior
Expected behavior
With content capture enabled, the Strands invoke_agent / execute_tool spans should
include the message payloads (gated for privacy), e.g.:
execute_tool:gen_ai.tool.call.argumentsand the tool result/output.invoke_agent: input/output messages (gen_ai.input.messages/gen_ai.output.messages, or the corresponding prompt/completion content).
Questions / requests
- Does the Strands tracer honor
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT? If not, is there a Strands-specific setting/env var to enable message-content capture on these spans? - If such a control exists, how is it set for a Strands agent running on an AgentCore
managed harness (where the user does not run
opentelemetry-instrumentor configure the tracer directly)? - If content capture is not currently supported in the managed-harness path, could it be added and documented?
Cross-reference
Filing here because the spans originate from strands.telemetry.tracer. There is a
related gap on the AWS side — the AgentCore managed harness exposes no documented toggle
for this — so I'll also cross-link this in aws/bedrock-agentcore-sdk-python.
Actual Behavior
Actual behavior — observed span attributes
execute_tool span:
gen_ai.operation.name = execute_tool gen_ai.provider.name = strands-agents gen_ai.tool.name = gen_ai.tool.call.id = tooluse_... gen_ai.tool.description = ... gen_ai.tool.json_schema = {...} gen_ai.tool.status = success session.id / harness.id / harness.endpoint.qualifier / aws.genai.span_kind=TOOL
Missing: gen_ai.tool.call.arguments (tool input) and the tool result/output.
The span has no events.
invoke_agent span:
gen_ai.operation.name = invoke_agent gen_ai.provider.name = strands-agents gen_ai.agent.name = Strands Agents gen_ai.agent.tools = [...] gen_ai.request.model = amazon.nova-lite-v1:0 gen_ai.usage.input_tokens / output_tokens / total_tokens / prompt_tokens / completion_tokens / cache_read_input_tokens / cache_write_input_tokens session.id / harness.id / aws.genai.span_kind=AGENT
Missing: input messages / prompt, output messages / completion (no
gen_ai.input.messages / gen_ai.output.messages / gen_ai.prompt /
gen_ai.completion), and no events.
What I tried (and it did not help)
Per the ADOT distro
(aws_opentelemetry_distro.py),
when AGENT_OBSERVABILITY_ENABLED=true the distro does
os.environ.setdefault("OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT", "true").
So I set both on the managed harness runtime environment:
AGENT_OBSERVABILITY_ENABLED = true OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT = true
- Confirmed both env vars are present on the harness (harness version bumped, endpoint
liveVersionupdated, status READY). - Re-invoked — content still absent.
- Suspected warm-container reuse, so I waited past the idle-session timeout (~16 min) to
force a cold container start on the new version, then invoked again — content still
absent on both
execute_toolandinvoke_agent.
Because these spans are emitted by strands.telemetry.tracer (not by an ADOT native
GenAI instrumentor), the OTel content-capture flag does not appear to govern them.
Additional Context
Summary
When a Strands agent runs on an Amazon Bedrock AgentCore managed harness, the
GenAI spans emitted by strands.telemetry.tracer (invoke_agent, execute_tool)
contain only metadata — no message content: no model prompt/completion, and no
tool call arguments or tool result. Enabling the OpenTelemetry GenAI content-capture
flag on the runtime (OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true, with
AGENT_OBSERVABILITY_ENABLED=true) has no effect, even after a confirmed cold
container start.
I could not find any documented, working way to make Strands include message content in these spans in the managed AgentCore runtime.
Environment
- Runtime: Amazon Bedrock AgentCore managed harness (Strands agent).
- Model:
amazon.nova-lite-v1:0. - Span source (resource/scope on the emitted spans):
scope.name = strands.telemetry.tracertelemetry.auto.version = 0.18.0-aws,telemetry.sdk.name = opentelemetry,telemetry.sdk.language = pythonaws.service.type = gen_ai_agent,cloud.platform = aws_bedrock_agentcore
- Region: us-east-2. Spans delivered to CloudWatch
aws/spans(Transaction Search on).
Possible Solution
No response
Related Issues
No response
Addressed in #3194 and #3191