# 컨테이너 모델

## 배포 파이프라인

```
소스 코드 (agent_config/, main.py, Dockerfile)
    ↓
Docker 빌드 (linux/arm64)
    ↓
ECR 푸시
    ↓
AgentCore CLI (agentcore_agent_runtime.py create)
    ↓
CodeBuild 프로젝트 → 컨테이너 빌드
    ↓
AgentCore Runtime (microVM)
```

## Dockerfile

```dockerfile
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim
WORKDIR /app
ENV UV_SYSTEM_PYTHON=1 UV_COMPILE_BYTECODE=1
COPY requirements.txt requirements.txt
RUN uv pip install -r requirements.txt
RUN uv pip install aws-opentelemetry-distro>=0.10.1
ENV AWS_REGION=us-east-1 DOCKER_CONTAINER=1
RUN useradd -m -u 1000 bedrock_agentcore
USER bedrock_agentcore
EXPOSE 8080 8000
COPY . .
CMD ["opentelemetry-instrument", "python", "-m", "main"]
```

## .bedrock\_agentcore.yaml 주요 설정

```yaml
agents:
  troubleshooting_agent_runtime:
    entrypoint: main.py
    platform: linux/arm64          # Graviton 기반
    container_runtime: docker
    aws:
      network_configuration:
        network_mode: PUBLIC       # 공개 네트워크
      protocol_configuration:
        server_protocol: HTTP      # HTTP 프로토콜
      observability:
        enabled: true              # OTel 추적
    authorizer_configuration:
      customJWTAuthorizer:
        discoveryUrl: "https://cognito-idp.../openid-configuration"
```

## 엔트리포인트 (main.py)

```python
app = BedrockAgentCoreApp()

@app.entrypoint
async def invoke(payload, context):
    user_message = payload["prompt"]
    actor_id = payload["actor_id"]
    session_id = context.session_id
    # 에이전트 태스크 생성 → 스트리밍 응답

if __name__ == "__main__":
    app.run()  # HTTP 서버 시작 (포트 8080)
```

## 모듈별 배포 비교

| 모듈        | Runtime 이름                                    | 네트워크   | 메모리       |
| --------- | --------------------------------------------- | ------ | --------- |
| M1        | troubleshooting\_agent\_runtime               | PUBLIC | 없음        |
| M2        | troubleshooting\_agent\_runtime\_with\_memory | PUBLIC | STM+LTM   |
| M3 Conn   | a2a\_troubleshooting\_agent\_runtime          | PUBLIC | STM\_ONLY |
| M3 Perf   | a2a\_performance\_agent\_runtime              | PUBLIC | STM\_ONLY |
| M3 Collab | a2a\_collaborator\_agent\_runtime             | PUBLIC | 있음        |
