Amazon Bedrock AgentCore

AWS offers AgentCore as part of the Bedrock suite, giving teams a production-ready infrastructure for running AI agents. The service handles containerization, tool orchestration, and model access through a unified runtime that connects to Bedrock's foundation model catalog.

This guide covers instrumenting AgentCore agents with InteractiveAI via OpenTelemetry for full observability into agent execution, model interactions, and tool usage.

Prerequisites

  • InteractiveAI account with API credentials

  • AWS account with Bedrock access


Installation

Install the required packages:

pip install bedrock-agentcore-starter-toolkit strands-agents[otel] interactiveai boto3 mcp

Configuration

InteractiveAI and OpenTelemetry Setup

Configure your InteractiveAI credentials and prepare the OpenTelemetry exporter:

import os
import base64
from interactiveai import Interactive

# InteractiveAI credentials
os.environ["INTERACTIVEAI_PUBLIC_KEY"] = "pk-ia-..."
os.environ["INTERACTIVEAI_SECRET_KEY"] = "sk-ia-..."
os.environ["INTERACTIVEAI_HOST"] = "https://app.interactiveai.com"
interactiveai = Interactive(
    secret_key=os.getenv("INTERACTIVEAI_SECRET_KEY"),
    public_key=os.getenv("INTERACTIVEAI_PUBLIC_KEY")
)

# Construct Basic Auth header for OTLP export
auth_string = base64.b64encode(
    f"{os.environ['INTERACTIVEAI_PUBLIC_KEY']}:{os.environ['INTERACTIVEAI_SECRET_KEY']}".encode()
).decode()

# Configure OpenTelemetry exporter
os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = os.environ["INTERACTIVEAI_HOST"] + "/api/public/otel"
os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = f"Authorization=Basic {auth_string}"

AWS Credentials

Configure access to Amazon Bedrock services:


Creating an Instrumented Agent

Build an AgentCore agent with InteractiveAI tracing enabled through OpenTelemetry. This example uses Strands Agents SDK with MCP tools, though any compatible agent framework can be instrumented similarly.


Deployment and Invocation

Deploy the agent to Amazon Bedrock AgentCore and invoke it with trace context propagation:


Viewing Trace Data

After agent execution, the InteractiveAI dashboard displays complete trace information including:

  • End-to-end agent execution flow

  • Individual model calls with token consumption and cost calculations

  • Tool invocations and MCP interactions

  • Latency measurements for each operation

  • Request and response payloads for debugging

These traces provide visibility into agent behavior across development, staging, and production environments.

Last updated

Was this helpful?