Skip to main content

OpenTelemetry Bedrock AgentCore Instrumentation (Alpha)

pypi

This package provides OpenTelemetry instrumentation for AWS Bedrock AgentCore, the runtime framework for building agentic applications with AWS Bedrock. It leverages Splunk distribution of opentelemetry-util-genai for producing telemetry in semantic convention. Core concepts, high-level usage and configuration

Status: Alpha (APIs and produced telemetry are subject to change).

Installation

pip install splunk-otel-instrumentation-bedrock-agentcore

Quick Start

Manual Instrumentation (development/debugging)

from bedrock_agentcore import BedrockAgentCoreApp
from opentelemetry.instrumentation.bedrock_agentcore import (
    BedrockAgentCoreInstrumentor,
)

# Manual instrumentation, easy to debug in your IDE
BedrockAgentCoreInstrumentor().instrument()

app = BedrockAgentCoreApp()

@app.entrypoint
def handler(event):
    return {"status": "success", "event": event}

Zero-code Instrumentation

In zero-code instrumentation mode, ensure you install opentelemetry-distribution and run your app with the OpenTelemetry Bedrock AgentCore instrumentor enabled:

.. code-block:: bash

opentelemetry-instrument python your_bedrock_agentcore_app.py

from bedrock_agentcore import BedrockAgentCoreApp

app = BedrockAgentCoreApp()

@app.entrypoint
def handler(event):
    return {"status": "success", "event": event}

What Gets Instrumented

This instrumentation captures:

  • BedrockAgentCoreApp -> Mapped to Workflow spans

  • MemoryClient.retrieve_memories -> Mapped to RetrievalInvocation spans

  • MemoryClient operations -> Mapped to ToolCall spans

  • CodeInterpreter operations -> Mapped to ToolCall spans

  • BrowserClient operations -> Mapped to ToolCall spans

All spans are properly nested with correct parent-child relationships and include rich attributes about the operation.

Testing Reference

For a detailed implementation map, configuration matrix, wrapped SDK method inventory, span attribute assertions, and suggested test cases, see docs/testing-reference.md.

Compositional Instrumentation

This instrumentation focuses on Bedrock AgentCore runtime operations. For complete observability, combine it with provider-specific or framework-specific instrumentation.

AgentCore + Bedrock

from opentelemetry.instrumentation.bedrock_agentcore import (
    BedrockAgentCoreInstrumentor,
)
from opentelemetry.instrumentation.bedrock import BedrockInstrumentor

BedrockAgentCoreInstrumentor().instrument()
BedrockInstrumentor().instrument()

Adds Bedrock API call spans with AWS-specific attributes and metrics.

AgentCore + Bedrock + Strands

from opentelemetry.instrumentation.bedrock_agentcore import (
    BedrockAgentCoreInstrumentor,
)
from opentelemetry.instrumentation.bedrock import BedrockInstrumentor
from opentelemetry.instrumentation.strands import StrandsInstrumentor

BedrockAgentCoreInstrumentor().instrument()
BedrockInstrumentor().instrument()
StrandsInstrumentor().instrument()

Adds agent orchestration, runtime operations, and Bedrock model call telemetry.

Configuration

Environment Variables

# Capture request/response content (disabled by default)
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true

# Content capture mode
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT_MODE=SPAN_AND_EVENT

# Select GenAI emitters
export OTEL_INSTRUMENTATION_GENAI_EMITTERS=span_metric_event

Instrumentation Options

from opentelemetry.instrumentation.bedrock_agentcore import (
    BedrockAgentCoreInstrumentor,
)

# Basic instrumentation
BedrockAgentCoreInstrumentor().instrument()

# With custom providers
BedrockAgentCoreInstrumentor().instrument(
    tracer_provider=my_tracer_provider,
    meter_provider=my_meter_provider,
    logger_provider=my_logger_provider,
)

# Uninstrumentation
BedrockAgentCoreInstrumentor().uninstrument()

Requirements

  • Python >= 3.10

  • bedrock-agentcore >= 1.0.0

  • OpenTelemetry API >= 1.38

  • splunk-otel-util-genai >= 0.1.9

Trace Hierarchy Example

BedrockAgentCoreApp.entrypoint (Workflow)
+-- Memory: retrieve_memories (RetrievalInvocation)
+-- CodeInterpreter: execute_code (ToolCall)
+-- Browser: take_control (ToolCall)

Each span includes rich attributes:

  • gen_ai.system = “bedrock-agentcore”

  • gen_ai.operation.name = “invoke_workflow” | “execute_tool” | “retrieval”

  • Retrieval span names include the memory provider, for example retrieval bedrock-agentcore-memory

  • Framework-specific attributes, such as memory IDs, code interpreter session IDs, browser session IDs, and operation metadata

Examples

The examples/manual directory contains a working example that exercises BedrockAgentCoreApp, MemoryClient, CodeInterpreter, and BrowserClient instrumentation with OTLP export.

cd examples/manual
pip install -r requirements.txt
pip install -e ../../[instruments]

export AWS_DEFAULT_REGION=us-west-2
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
python main.py

Testing

Run the package tests from the repository root or this directory:

pytest instrumentation-genai/opentelemetry-instrumentation-bedrock-agentcore/tests

Contributing

Issues / PRs welcome in the main splunk-otel-python-contrib repository. This module is alpha: feedback on attribute coverage, performance, and Bedrock AgentCore surface expansion is especially helpful.

License

Apache-2.0

Metadata

Release files for splunk-otel-instrumentation-bedrock-agentcore 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for splunk-otel-instrumentation-bedrock-agentcore 0.3.0
File Size Uploaded Provenance Actions
splunk_otel_instrumentation_bedrock_agentcore-0.3.0.tar.gz 27.7 kB Without provenance Details for splunk_otel_instrumentation_bedrock_agentcore-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for splunk-otel-instrumentation-bedrock-agentcore 0.3.0
File Interpreter ABI Platform Actions
splunk_otel_instrumentation_bedrock_agentcore-0.3.0-py3-none-any.whl Python 3 none any Details for splunk_otel_instrumentation_bedrock_agentcore-0.3.0-py3-none-any.whl

Total release size: 51.7 kB

Release files / splunk_otel_instrumentation_bedrock_agentcore-0.3.0.tar.gz

Download URL splunk_otel_instrumentation_bedrock_agentcore-0.3.0.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
42f3a2e62e4b2f9d61be94fa3df46f0516620a76f0458f06ae2f2342fb0af391
BLAKE2b-256 checksum
How to use checksums
16b38f7a8063e080d8fc4da7b6323055c0cb65ef2d1a8cff4f98c53e1e5b58c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"trixie","libc":{"lib":"glibc","version":"2.41"},"name":"Debian GNU/Linux","version":"13"},"implementation":{"name":"CPython","version":"3.11.15"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.5.6 7 Apr 2026","python":"3.11.15","system":{"name":"Linux","release":"5.15.0-1084-aws"}} HTTPX2/2.5.0

Release files / splunk_otel_instrumentation_bedrock_agentcore-0.3.0-py3-none-any.whl

Download URL splunk_otel_instrumentation_bedrock_agentcore-0.3.0-py3-none-any.whl
Size 24.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0caef6d564cc86bcc0f5e89bba632dab187e20925b49bf02d5b1b881a5275c5
BLAKE2b-256 checksum
How to use checksums
05edc7645cc575ab1b03481eb6d119d23b130a2bf3338344c721f9571af91f09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"trixie","libc":{"lib":"glibc","version":"2.41"},"name":"Debian GNU/Linux","version":"13"},"implementation":{"name":"CPython","version":"3.11.15"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.5.6 7 Apr 2026","python":"3.11.15","system":{"name":"Linux","release":"5.15.0-1084-aws"}} HTTPX2/2.5.0

Security for splunk-otel-instrumentation-bedrock-agentcore 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page