TL;DR
서로 다른 agent framework를 사용하는 production 팀은 SDK와 tracing 방식이 달라 평가 파이프라인을 따로 유지해야 했지만, Amazon Bedrock AgentCore Evaluations는 OpenTelemetry를 공통 계층으로 삼아 이 문제를 줄입니다. 서비스는 CloudWatch에서 session.id로 trace를 묶고 invoke agent, inference, execute tool span에서 사용자 입력, model 응답, tool 실행 데이터를 추출하며, OpenTelemetry GenAI 규약과 OpenInference 사양의 서로 다른 attribute도 같은 평가 입력으로 변환합니다. instrumentation scope name이 인식된 prefix를 사용하고 메시지 content와 session.id가 갖춰지면 framework별 코드 변경 없이 GoalSuccessRate, Correctness, Helpfulness와 custom evaluator를 실행할 수 있습니다. on-demand 모드는 ground truth 기반 CI 회귀 테스트에, online 모드는 sampling을 적용한 production 품질 감시에 사용되며, telemetry 유실을 막으려면 handler 반환 전에 tracer와 logger provider를 모두 flush해야 합니다.
섹션별 상세

def _flush_telemetry():
from opentelemetry import trace as _trace
from opentelemetry._logs import get_logger_provider as _get_lp
for provider in (_trace.get_tracer_provider(), _get_lp()):
flush = getattr(provider, "force_flush", None)
if flush:
flush()
@app.entrypoint
async def invoke(payload, context):
prompt = payload.get("prompt", "")
try:
result = await run_agent(prompt)
finally:
_flush_telemetry()
return str(result)AgentCore Runtime이 실행 환경을 중단하기 전에 tracer provider와 logger provider의 버퍼를 모두 비워 span과 event record를 CloudWatch로 내보냅니다.
from bedrock_agentcore.evaluation import EvaluationClient
from bedrock_agentcore.evaluation.client import ReferenceInputs
from datetime import timedelta
ec = EvaluationClient(region_name=REGION)
# The client resolves each evaluator's level (SESSION, TRACE, or TOOL_CALL)
# automatically, so no level configuration is needed here.
results = ec.run(
evaluator_ids=[
"Builtin.GoalSuccessRate",
"Builtin.Correctness",
"Builtin.Helpfulness",
CUSTOM_RESPONSE_QUALITY_ID,
CUSTOM_SESSION_COMPLETENESS_ID,
],
agent_id=AGENT_ID,
session_id=SESSION_ID,
look_back_time=timedelta(hours=1),
reference_inputs=ReferenceInputs(
assertions=ASSERTIONS,
expected_trajectory=EXPECTED_TRAJECTORY,
expected_response=EXPECTED_RESPONSES[-1],
),
)CloudWatch에 수집된 세션을 EvaluationClient로 불러와 기본 evaluator와 custom evaluator를 같은 호출에서 실행합니다.
용어 해설
- OpenTelemetry
- — 분산 시스템에서 trace, metric, log를 공통 형식으로 수집하고 전송하는 중립적인 계측 프레임워크입니다. AgentCore Runtime에서는 ADOT가 OpenTelemetry Protocol로 전달된 span과 이벤트 기록을 Amazon CloudWatch로 보냅니다. 여러 agent framework의 실행 데이터를 같은 평가 파이프라인에 연결하는 기반입니다.
- Span
- — 분산 요청에서 하나의 작업 단계를 나타내는 추적 단위입니다. span에는 작업 이름, 시간 정보, 타입이 지정된 속성, 선택적 이벤트가 담기며 여러 span이 모여 하나의 trace를 구성합니다. AgentCore Evaluations는 span의 역할과 속성에서 사용자 입력, 모델 응답, tool 호출 정보를 추출합니다.
- OpenTelemetry GenAI 의미 규약(OpenTelemetry GenAI Semantic Conventions)
- — 생성형 AI 시스템의 model call, retrieval, tool 실행, agent 호출 같은 작업을 표준화된 operation과 attribute로 기록하는 규약입니다. invoke_agent, chat, execute_tool 같은 값이 span의 역할을 구분하고, 메시지와 tool 정보를 정해진 위치에 저장하도록 합니다. 평가 서비스가 framework별 구현 차이를 넘어서 실행 기록을 읽게 하는 핵심 규칙입니다.
- OpenInference 사양(OpenInference Specification)
- — LLM과 agent 실행을 기록하기 위해 Arize AI가 유지하는 개방형 관측성 사양입니다. openinference.span.kind의 LLM, TOOL, AGENT, CHAIN 값과 색인된 메시지 attribute를 사용해 추론과 tool 실행을 표현합니다. OpenTelemetry GenAI 규약과 다른 키를 사용하지만 AgentCore Evaluations에서는 동일한 평가 결과로 변환됩니다.
- LLM-as-a-judge
- — LLM을 평가자로 사용해 agent의 응답이나 세션 품질을 판정하는 평가 방식입니다. AgentCore Evaluations에서는 custom evaluator로 구성할 수 있고, expected_response나 assertions 같은 ground truth를 지시문에 넣는 경우 on-demand 평가에서만 사용할 수 있습니다. 실시간 online 평가에는 정답 데이터가 필요하지 않은 evaluator만 적용됩니다.
기술
- Amazon Bedrock AgentCore Evaluations
- Amazon Bedrock AgentCore Runtime
- Amazon CloudWatch
- AWS Distro for OpenTelemetry (ADOT)
- OpenTelemetry
- OpenTelemetry Protocol (OTLP)
- OpenTelemetry GenAI semantic conventions
- OpenInference
- LangGraph
- LlamaIndex
- OpenAI Agents SDK
- Google ADK
- Claude Agent SDK
- Strands Agents
- Python
활용 사례
- 여러 agent framework로 구현한 production agent의 응답 품질을 하나의 평가 파이프라인에서 비교할 수 있습니다.
- Pull request마다 고정된 prompt와 ground truth를 사용해 agent 회귀 테스트를 실행하고 evaluator 임계값으로 build를 차단할 수 있습니다.
- 실시간 production traffic의 일부 세션을 sampling해 CloudWatch alarm과 dashboard로 품질 변화를 추적할 수 있습니다.
AI 요약 · 북마크 · 개인 피드 설정 — 무료
출처 · 인용 안내
인용 시 "요약 출처: AI Trends (aitrends.kr)"를 표기하고, 사실 확인은 원문 보기 기준으로 진행해 주세요. 자세한 기준은 운영 정책을 참고해 주세요.