TL;DR
Amazon Bedrock AgentCore Observability는 AgentCore runtime 밖에서 실행되는 에이전트의 telemetry를 기본으로 받지 않으므로, 온프레미스·GCP·Azure 환경에서는 AWS Distro for OpenTelemetry(ADOT)와 OpenTelemetry 환경 변수 구성이 필요합니다. ADOT는 boto3와 Strands framework를 자동 계측해 reasoning steps, tool invocations, model calls, token usage를 수집하고, aws_configurator가 SigV4로 서명한 OTLP 요청을 Amazon CloudWatch에 전송합니다. AGENT_OBSERVABILITY_ENABLED와 log group·metric namespace 설정을 추가하면 외부 에이전트의 데이터가 AgentCore Observability 대시보드에 색인됩니다. 실습에서는 Python 3.10 이상 환경에 패키지를 설치하고 opentelemetry-instrument로 Strands 에이전트를 실행한 뒤 2~3분 후 세션, trace, span metrics, latency, token usage를 확인하며, Google Cloud Shell에서도 같은 흐름을 검증합니다.
섹션별 상세

- Amazon Bedrock AgentCore Observability는 AgentCore runtime 밖에서 실행되는 에이전트에 telemetry 전송을 위한 추가 구성이 필요하다. — 서론의 native 지원 범위와 비AWS 환경 추가 설정 설명
aws xray update-trace-segment-destination --destination CloudWatchLogs --region us-east-1
aws xray get-trace-segment-destination --region us-east-1
# Expected: {"Destination": "CloudWatchLogs", "Status": "ACTIVE"}CloudWatch Transaction Search의 trace 저장 목적지를 설정하고 활성화 상태를 확인합니다.


- ADOT는 boto3와 Strands framework를 자동 계측하고 SigV4 인증으로 CloudWatch OTLP 엔드포인트에 telemetry를 전송한다. — How it works 절의 Auto-instrumentation, SigV4 authentication, CloudWatch OTLP endpoint 설명
pip install "aws-opentelemetry-distro>=0.10.0" boto3 "strands-agents[otel]"
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export AWS_REGION=us-east-1
export AGENT_OBSERVABILITY_ENABLED=true
export OTEL_PYTHON_DISTRO=aws_distro
export OTEL_PYTHON_CONFIGURATOR=aws_configurator
export OTEL_RESOURCE_ATTRIBUTES="service.name=my-external-agent,aws.log.group.names=/aws/bedrock-agentcore/runtimes/my-external-agent"
export OTEL_EXPORTER_OTLP_LOGS_HEADERS="x-aws-log-group=/aws/bedrock-agentcore/runtimes/my-external-agent,x-aws-log-stream=runtime-logs,x-aws-metric-namespace=bedrock-agentcore"
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_TRACES_EXPORTER=otlp비AWS 환경에서 ADOT와 Strands Agents를 설치하고 IAM 인증 및 AgentCore Observability 라우팅에 필요한 환경 변수를 설정합니다.
from strands import Agent
from strands.models.bedrock import BedrockModel
from opentelemetry import baggage
from opentelemetry.context import attach
import time
# Configure the Bedrock model
model = BedrockModel(
model_id="us.anthropic.claude-haiku-4-5-20251001-v1:0",
region_name="us-east-1"
)
# Create the agent
agent = Agent(
model=model,
system_prompt="You are a helpful travel assistant."
)
# Set session ID for AgentCore session tracking
# All agent calls after attach() share same session ID for multiple requests/responses
session_id = f"external-session-{int(time.time())}"
ctx = baggage.set_baggage("session.id", session_id)
attach(ctx)
# Run the agent
response = agent("What are the top 3 things to do in Tokyo?")
print(response)Claude Haiku를 사용하는 Strands 에이전트를 만들고 session.id를 설정한 뒤 여행 질의를 실행합니다.
- AGENT_OBSERVABILITY_ENABLED=true와 OTEL_RESOURCE_ATTRIBUTES의 aws.log.group.names가 AgentCore Observability용 telemetry 처리 및 색인을 활성화한다. — Step 3의 환경 변수와 Key configuration details 설명
opentelemetry-instrument python3.12 agent_test.pyADOT 자동 계측으로 Python 프로세스를 감싼 상태에서 에이전트를 실행해 Bedrock 호출과 Strands 동작의 telemetry를 수집합니다.
용어 해설
- ADOT 자동 계측(ADOT Auto-Instrumentation)
- — 애플리케이션 코드를 크게 수정하지 않고 실행 중인 Python 프로세스에 OpenTelemetry 계측 기능을 주입하는 방식입니다. ADOT는 boto3와 Strands framework의 호출을 가로채 trace와 span을 생성하고, 이를 AWS 관측성 서비스로 내보냅니다. 외부 환경의 에이전트 telemetry를 중앙 대시보드로 연결하는 핵심 구성입니다.
- OpenTelemetry Protocol(OTLP)
- — OpenTelemetry가 trace, metric, log 같은 telemetry 데이터를 전송할 때 사용하는 프로토콜입니다. 이 글에서는 ADOT가 HTTP/Protobuf 방식으로 Amazon CloudWatch의 OTLP 수집 엔드포인트에 데이터를 보내며, 로그 헤더로 대상 log group과 metric namespace를 지정합니다. 서로 다른 실행 환경의 데이터를 같은 관측성 체계로 모으는 통로입니다.
- AWS Signature Version 4(SigV4)
- — AWS API 요청에 자격 증명 기반 서명을 추가해 요청자의 권한을 확인하는 인증 방식입니다. ADOT의 aws_configurator가 boto3 credential chain을 사용해 CloudWatch OTLP 요청에 SigV4 서명을 붙입니다. 비AWS 환경에서도 IAM access key를 통해 AWS 엔드포인트로 telemetry를 전송할 수 있게 합니다.
- 생성형 AI 의미 규약(Generative AI Semantic Conventions)
- — 생성형 AI 애플리케이션의 agent reasoning, tool invocation, model call 같은 이벤트를 OpenTelemetry span 속성으로 일관되게 기록하는 규약입니다. Strands [otel] 패키지는 이 규약에 맞춰 모델 호출과 token usage를 포함한 telemetry를 생성합니다. 에이전트별 실행 흐름과 비용 정보를 공통 형식으로 조회하는 기반입니다.
- CloudWatch Transaction Search
- — AWS X-Ray trace 데이터를 CloudWatch Logs로 전달하고 검색할 수 있도록 하는 기능입니다. 글에서는 aws xray update-trace-segment-destination 명령으로 목적지를 CloudWatchLogs로 바꾸고 상태가 ACTIVE인지 확인합니다. AgentCore Observability에서 외부 에이전트의 trace를 조회하기 위한 사전 설정입니다.
기술
- Amazon Bedrock AgentCore Observability
- AWS Distro for OpenTelemetry (ADOT)
- Amazon CloudWatch
- AWS X-Ray
- AWS Identity and Access Management (IAM)
- OpenTelemetry Protocol (OTLP)
- Python
- boto3
- Strands Agents
- Google Cloud Platform (GCP)
- Microsoft Azure
- IAM Roles Anywhere
- Claude Haiku
활용 사례
- 온프레미스 에이전트의 중앙 관측성
- GCP 또는 Azure에서 실행되는 AI agent monitoring
- AWS EKS·ECS·Lambda 외부 에이전트의 trace와 token usage 추적
- agent reasoning chain과 tool invocation 감사
- hallucination 및 유해하거나 주제에서 벗어난 응답 탐지
- 에이전트 비용 관리를 위한 token usage 모니터링
AI 요약 · 북마크 · 개인 피드 설정 — 무료
출처 · 인용 안내
인용 시 "요약 출처: AI Trends (aitrends.kr)"를 표기하고, 사실 확인은 원문 보기 기준으로 진행해 주세요. 자세한 기준은 운영 정책을 참고해 주세요.