본문으로 건너뛰기

OpenTelemetry로 통합하는 Agent 평가

OpenTelemetry span을 이용해 다양한 agent framework를 같은 기준으로 평가하는 Amazon Bedrock AgentCore Evaluations의 구조와 운영 방법을 설명합니다.

이 요약은 AI가 원문을 분석해 생성했습니다. 정확한 내용은 원문 기준으로 확인하세요.

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해야 합니다.

섹션별 상세

01
Production agent 팀은 LangGraph, LlamaIndex, OpenAI Agents SDK, Google ADK, Claude Agent SDK, Strands Agents처럼 서로 다른 framework를 사용하지만, 기존 평가 도구는 특정 SDK나 tracing 방식에 묶여 있었습니다. Amazon Bedrock AgentCore Evaluations는 이 결합을 끊고 OpenTelemetry를 공통 입력 형식으로 사용합니다. agent가 인식된 scope name 아래에서 telemetry를 내보내면 framework별 agent 코드 수정 없이 같은 평가 체계에 연결됩니다.
02
Agent의 한 사용자 turn은 여러 작업을 수행하므로 model 호출, tool 실행, retrieval, reranking, embedding, guardrail, memory 같은 span이 함께 생성됩니다. 평가 서비스는 그중 invoke agent span에서 사용자 prompt와 최종 응답을 읽고, inference span에서 model에 전달한 메시지와 model reply를 읽으며, execute tool span에서 tool 이름·입력·결과를 추출합니다. 나머지 span은 평가에 필수는 아니지만 실행 맥락으로 남기 때문에 더 풍부한 trace도 별도 설정 없이 처리됩니다.
03
평가 실행 시 서비스는 CloudWatch에서 span과 event record를 가져와 session.id로 묶고, 각 trace_id를 한 사용자 turn으로 재구성합니다. OpenTelemetry GenAI 규약에서는 gen_ai.operation.name의 invoke_agent, chat, execute_tool이 역할을 구분하고, OpenInference에서는 openinference.span.kind의 AGENT, LLM, TOOL이 같은 역할에 대응합니다. 두 규약의 서로 다른 attribute key와 span vocabulary를 공통 평가 입력으로 변환하므로 GoalSuccessRate, Correctness, Helpfulness, custom LLM-as-a-judge가 framework에 관계없이 동일하게 동작합니다.
Amazon Bedrock AgentCore Runtime의 여러 agent framework가 OpenTelemetry telemetry를 Amazon CloudWatch로 보내고, Amazon Bedrock AgentCore Evaluations가 세션별 span을 분류해 점수로 변환하는 데이터 흐름도입니다.
Diagram도식은 사용자의 InvokeAgentRuntime 호출에서 시작해 AgentCore Runtime에 배포된 Strands Agents, LangGraph, LlamaIndex, OpenAI Agents SDK, Google ADK, Claude Agent SDK의 실행 기록이 CloudWatch로 이동하는 경로를 나타냅니다. CloudWatch의 span과 event record는 session.id로 묶인 뒤 invoke agent, inference, execute tool 역할로 분류되고, GoalSuccessRate·Correctness·Helpfulness 같은 evaluator에 전달됩니다. 마지막으로 on-demand 점수는 호출자와 CI 품질 게이트로 반환되고 online 점수는 CloudWatch alarm과 dashboard에 활용됩니다.
04
범용 연동의 핵심은 instrumentation library의 scope name과 메시지 데이터입니다. opentelemetry.instrumentation.* 또는 openinference.instrumentation.* prefix를 사용하면 generic path가 활성화되지만, 임의의 mycompany.agent.tracing 이름은 span이 규약을 따르더라도 자동 인식되지 않습니다. 또한 span에는 runtimeSessionId와 일치하는 session.id가 있어야 하며, 메시지 content가 span attribute나 상관관계가 있는 event record에 포함되어야 세션 평가가 완성됩니다.
05
AgentCore Runtime에서는 ADOT가 시작 시 설치된 instrumentation package를 자동으로 활성화하므로 requirements.txt에 패키지를 추가하는 방식으로 계측할 수 있습니다. 다만 OpenAI Agents SDK는 set_tracing_disabled(True)를 호출하면 자체 tracing pipeline이 꺼지고, LlamaIndex는 top-level invoke agent span을 내보내는 FunctionAgent 또는 ReActAgent 구조가 필요합니다. handler가 반환된 뒤 실행 환경이 중단될 수 있으므로 tracer provider와 logger provider를 모두 force_flush해야 하며, 누락된 flush가 telemetry와 평가 실패의 가장 흔한 원인으로 제시됩니다.
python
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로 내보냅니다.

06
on-demand 평가는 agent를 호출한 직후 EvaluationClient.run()으로 점수를 계산하므로 CI/CD 회귀 테스트와 ground truth 비교에 적합합니다. expected responses, expected tool trajectories, behavioral assertions를 ReferenceInputs로 전달하고 임계값 미달 시 build를 실패시킬 수 있습니다. online 평가는 CloudWatch log group을 감시하면서 지정한 sampling rate로 실시간 세션을 처리하지만, expected_response나 assertions가 필요한 custom evaluator는 사용할 수 없습니다.
python
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를 같은 호출에서 실행합니다.

07
on-demand와 online 모드는 모두 AgentCore Evaluations의 동일한 처리 경로를 사용하므로 agent 동작이 안정적이면 CI 점수와 production 점수를 직접 비교할 수 있습니다. online 결과는 /aws/bedrock-agentcore/evaluations/results/{config_id} 경로에 저장되고 CloudWatch alarm이나 dashboard로 품질 추세를 관찰할 수 있습니다. 따라서 여러 framework를 사용하는 팀도 framework별 평가 코드를 따로 유지하지 않고 하나의 품질 관리 인터페이스를 적용할 수 있습니다.

용어 해설

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 요약 · 북마크 · 개인 피드 설정 — 무료

출처 · 인용 안내

원문 발행 2026. 08. 27.수집 2026. 08. 27.출처 타입 RSS

인용 시 "요약 출처: AI Trends (aitrends.kr)"를 표기하고, 사실 확인은 원문 보기 기준으로 진행해 주세요. 자세한 기준은 운영 정책을 참고해 주세요.