Skip to content

feat(telemetry): agent integration#555

Merged
lizradway merged 4 commits intostrands-agents:liz/otelfrom
lizradway:agent-integration
Feb 23, 2026
Merged

feat(telemetry): agent integration#555
lizradway merged 4 commits intostrands-agents:liz/otelfrom
lizradway:agent-integration

Conversation

@lizradway
Copy link
Copy Markdown
Member

Description

Integrates OpenTelemetry tracing into the agent loop, enabling observability for agent invocations, model calls, tool executions, and agent loop cycles.

Additionally moves span hierarchy to instance var in Tracer class per fast follow from previous PR. This allows for isolated span hierarchy tracking internally within Tracer class.


The agent now creates hierarchical spans that capture with context:

  • Agent invocation spans (parent) with accumulated token usage across all model calls
  • Agent loop cycle spans for each iteration of the agentic loop
  • Model invocation spans with input/output messages and token usage
  • Tool call spans with tool inputs and results

New AgentConfig options:

  • name: Agent name for span identification (defaults to "Strands Agent")
  • agentId: Unique identifier for the agent instance (auto-generated if not provided)
  • traceAttributes: Custom attributes to include on all spans

Telemetry is opt-in via telemetry.setupTracer(). When not configured, OpenTelemetry returns no-op tracers with zero overhead.

Related Issues

#418

Documentation PR

strands-agents/docs#557

Type of Change

New feature

Testing

  • Tested via example scripts locally exporting traces to Langfuse

How have you tested the change?

  • I ran npm run check

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@lizradway lizradway requested a review from pgrayy February 19, 2026 17:13
Comment thread src/models/model.ts Outdated
Comment thread src/models/streaming.ts Outdated
Comment thread src/agent/agent.ts Outdated
Comment thread src/agent/agent.ts Outdated
Comment thread src/models/streaming.ts Outdated
@lizradway lizradway requested a review from pgrayy February 23, 2026 15:03
Comment thread src/agent/agent.ts
@lizradway lizradway merged commit 99a8946 into strands-agents:liz/otel Feb 23, 2026
Comment thread src/agent/agent.ts
@lizradway lizradway deleted the agent-integration branch February 24, 2026 15:10
@pgrayy pgrayy mentioned this pull request Feb 25, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants