단계 5: ALB 검증 및 테스트

이 단계에서는 두 Application Load Balancer (ALB)의 적절한 구성과 접근성을 확인하고 A2A 에이전트 엔드포인트를 테스트합니다. 이를 통해 Connectivity와 Performance 에이전트 모두 해당 로드 밸런서를 통해 운영 가능하고 접근 가능한지 확인합니다.

ALB DNS 이름 가져오기

workshop-module-3 디렉토리 내의 a2a-performance-agent 폴더로 이동합니다:

cd /workspace/workshop-module-3/a2a/a2a-performance-agent

ALB DNS 이름 가져오기:

CONNECTIVITY_ALB=$(aws elbv2 describe-load-balancers \
  --names a2a-connectivity-alb \
  --query 'LoadBalancers[0].DNSName' --output text)

PERFORMANCE_ALB=$(aws elbv2 describe-load-balancers \
  --names a2a-performance-alb \
  --query 'LoadBalancers[0].DNSName' --output text)

Health 엔드포인트 테스트

에이전트 상태가 healthy이고 각 에이전트가 특정 스킬과 연결되어 있는지 확인합니다:

printf "=== Connectivity Agent Health ===\n"
curl -s http://$CONNECTIVITY_ALB/health | jq '{status, service}'

printf "\n=== Performance Agent Health ===\n"
curl -s http://$PERFORMANCE_ALB/health | jq '{status, service}'

Agent Card 테스트

A2A ALB 확인
circle-check
circle-info

선택 사항: 콘솔 기반 검증: EC2 > Load Balancers로 이동하여 AWS 콘솔을 통해서도 ALB 구성을 확인할 수 있습니다.

코드 분석: A2A Server 및 Agent Card

A2A Server 아키텍처 (ECS Task)

각 A2A Server는 ECS Task로 실행되며, ALB 뒤에서 두 개의 핵심 엔드포인트를 제공합니다:

엔드포인트
용도
응답

/health

ALB 헬스체크

{"status": "healthy", "service": "..."}

/.well-known/agent-card.json

A2A Agent Card

에이전트 메타데이터

/ (POST)

A2A 메시지 수신

Task 결과

Agent Card 스키마

Agent Card는 A2A 프로토콜의 서비스 디스커버리 메커니즘입니다:

AgentCoreExecutor 핵심 구조 (agent_executer.py)

A2A Server는 AgentExecutor 인터페이스를 구현하여 A2A 메시지를 AgentCore Runtime 호출로 변환합니다.

전체 구조:

circle-info

agent_arn이란?: AgentCore Runtime의 **ARN (Amazon Resource Name)**으로, 각 에이전트 런타임의 고유 식별자입니다. config.yamlagent_card_info.agent_arn 필드에서 로드되며, 형식은 arn:aws:bedrock-agentcore:{region}:{account_id}:runtime/{runtime_name} 입니다. 아래 _build_agent_url()에서 이 ARN을 사용하여 AgentCore Runtime API 호출 URL을 구성합니다.

1. AgentCore Runtime URL 구성:

2. OAuth 토큰 관리 (캐싱):

3. AgentCore Runtime HTTP 호출:

4. A2A 메시지 처리 (execute 메서드):

OAuth 토큰 캐시 메커니즘

A2A 통신 흐름

circle-info

핵심 포인트: A2A Server는 프로토콜 브릿지 역할을 합니다. A2A 프로토콜의 SendMessage 요청을 받아 AgentCore Runtime의 HTTP API로 변환합니다. OAuth 토큰 캐시가 Cognito 호출을 최소화하고, 15분 타임아웃이 장시간 에이전트 실행을 지원합니다.

이 단계가 완료되었습니다. 다음 단계로 진행하세요.

마지막 업데이트