Skip to content

feat(bedrock): Multi Agent Support, capturing time metrics from metadata #1656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

satya-turing
Copy link
Collaborator

@satya-turing satya-turing commented May 21, 2025

Amazon Bedrock Multi-Agent Support & Time Metrics

Overview

This MR adds two key enhancements to the Amazon Bedrock instrumentation:

  1. Multi-Agent Support: Adds support for tracing interactions between multiple collaborating Bedrock agents
  2. Time Metrics Capture: Implements extraction of accurate timing information from Bedrock metadata

Details

Multi-Agent Support

  • Added capability to trace agent collaborator invocations
  • Implemented hierarchical span creation for nested agent calls
  • Enhanced trace collection to properly organize multi-agent interaction data

Time Metrics Capture

  • Improved span timing accuracy by extracting timestamps from Bedrock metadata
  • Added start and end time extraction for all span types
  • Enhanced performance metrics for better observability

Impact

These enhancements provide:

  • Better visibility into complex multi-agent workflows
  • More accurate performance metrics for agent interactions
  • Improved debugging capabilities for agent collaborations

Testing

The implementation includes tests for:

  • Multi-agent trace collection
  • Timing metadata extraction
  • Hierarchical span creation with nested agents

@satya-turing satya-turing requested a review from a team as a code owner May 21, 2025 13:47
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label May 21, 2025
Copy link
Contributor

@mikeldking mikeldking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @satya-turing - we're not fully comprehending all these abstractions and honestly not comfortable at the current moment to have this go into the main bedrock instrumentor since we will have to maintain it. @axiomofjoy and I will come up with a reasonable next step. Possibly a fork. But as it stands it's not a true instrumentation from what I can tell - it's taking signals from bedrock and emitting spans - which will have issues with context propagation.

Will review more in depth tomorrow and come up with a strategy.


### Prerequisites
1. **Response Accumulator**: Processes responses from Bedrock services and creates OpenTelemetry spans
2. **Trace Manager**: Organizes bedrock trace data into a hierarchical structure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this hierarchy should be semantic - what are you considering to be a trace?

graph TD
A[Bedrock Agent API Call] --> B[Create Initial OpenTelemetry Span]
B --> C[Response Accumulator Collects Traces]
C --> D[Trace Collector Builds Hierarchy]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is somewhat of a dangerous word to use. Trace collector is a known OTEL primitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants