|
| 1 | +# AgentCore AWS runtime study for ONEVibe |
| 2 | + |
| 3 | +## Decision |
| 4 | + |
| 5 | +ONEVibe may reuse the AgentCore harness's explicit Bedrock model/region configuration and its reliance on the standard AWS credential chain. It must not copy the harness's temporary cross-account Secrets Manager credentials into a retained sandbox environment, mount a host AWS profile, or assume AgentCore's execution-role injection exists in ONEComputer. |
| 6 | + |
| 7 | +The production target is: |
| 8 | + |
| 9 | +```text |
| 10 | +host/cloud workload identity |
| 11 | + → ONEVibe credential broker outside the sandbox |
| 12 | + → STS AssumeRole with a Bedrock-only session policy |
| 13 | + → AWS container credential-provider endpoint |
| 14 | + → retained sandbox standard AWS credential chain |
| 15 | + → Claude Code / Agent SDK → Bedrock |
| 16 | +``` |
| 17 | + |
| 18 | +## What the reference harness does |
| 19 | + |
| 20 | +Deployment scripts create a `boto3.Session` from an explicit CLI profile or `AWS_PROFILE`, then call STS to verify the effective caller before building/deploying: |
| 21 | + |
| 22 | +- `/Users/gini/Desktop/agentcore-claude-codex-runtime-harness/invgini-agentcore-runtimes/scripts-v2/build_and_push.py` |
| 23 | +- `/Users/gini/Desktop/agentcore-claude-codex-runtime-harness/invgini-agentcore-runtimes/scripts-v2/deploy_runtime.py` |
| 24 | + |
| 25 | +The normal AgentCore runtime receives temporary execution-role credentials from AgentCore. Claude inherits the standard AWS provider chain from its process environment; credentials are not arguments to `ClaudeAgentOptions`: |
| 26 | + |
| 27 | +- `runtimes/claude-python/app/main.py` |
| 28 | +- `runtimes/claude-python/app/session.py` |
| 29 | +- `docs/AGENTCORE_SKILLS_ARCHITECTURE_20260712.md` |
| 30 | + |
| 31 | +The optional cross-account workaround reads one Secrets Manager secret at process startup and writes its fields into `AWS_*` environment variables: |
| 32 | + |
| 33 | +- `runtimes/claude-python/app/credential_bootstrap.py` |
| 34 | +- `docs/CROSS_ACCOUNT_BEDROCK_SANDBOX.md` |
| 35 | + |
| 36 | +That workaround does not refresh credentials and is unsuitable for retained ONEVibe sandboxes. |
| 37 | + |
| 38 | +## Bedrock configuration worth reusing |
| 39 | + |
| 40 | +The runtime separates the AgentCore control-plane region from the Bedrock model-serving region. Inside the runtime it sets: |
| 41 | + |
| 42 | +- `CLAUDE_CODE_USE_BEDROCK=1` |
| 43 | +- `AWS_REGION` |
| 44 | +- `AWS_DEFAULT_REGION` |
| 45 | +- an allowlisted Bedrock inference-profile/model ID |
| 46 | +- Claude model selection variables |
| 47 | + |
| 48 | +Claude Code also requires the minimum inference-profile discovery permissions in addition to invocation. A readiness check must perform a real signed request; cached SSO identity or a successful historical STS lookup is insufficient because refresh can still fail later. |
| 49 | + |
| 50 | +## ONEVibe implementation contract |
| 51 | + |
| 52 | +The sandbox launcher must start from an environment allowlist and remove inherited `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`, `AWS_PROFILE`, `AWS_CONFIG_FILE`, and `AWS_SHARED_CREDENTIALS_FILE`. It must never mount `~/.aws`. |
| 53 | + |
| 54 | +The sandbox receives only: |
| 55 | + |
| 56 | +- `AWS_CONTAINER_CREDENTIALS_FULL_URI` |
| 57 | +- `AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE` |
| 58 | +- `AWS_REGION` |
| 59 | +- `AWS_DEFAULT_REGION` |
| 60 | +- `CLAUDE_CODE_USE_BEDROCK=1` |
| 61 | +- approved model/inference-profile configuration |
| 62 | + |
| 63 | +The token file identifies one sandbox/lease generation; it contains no AWS credential, is read-only, mode `0400`, and is revoked when the lease is released or replaced. |
| 64 | + |
| 65 | +The broker must authenticate that token, map it server-side to tenant/user/conversation/lease generation, assume only a Bedrock role with a restrictive session policy, return standard expiring container credentials, refresh before expiry, and reject sandbox-supplied role/account/region/model choices. Logs retain only safe metadata such as role alias, region, expiry, result category, and lease ID. |
| 66 | + |
| 67 | +## Threat and failure gates |
| 68 | + |
| 69 | +- Host `AWS_*` leakage can select the wrong account or widen authority. |
| 70 | +- A mounted AWS directory exposes profiles and SSO caches to model-accessible tools. |
| 71 | +- Static environment credentials in a retained sandbox both leak and expire without refresh. |
| 72 | +- A shared unauthenticated broker lets one sandbox request another tenant's authority. |
| 73 | +- Cached identity is not readiness; force a signed Bedrock request. |
| 74 | +- Model entitlement, inference-profile, region, and signer-account mismatches must produce distinct sanitized errors. |
| 75 | +- Retained sessions can outlive image/config changes; bind session continuity to lease ID and generation. |
| 76 | + |
| 77 | +## POC boundary |
| 78 | + |
| 79 | +The current Azure POC uses a scoped Anthropic-compatible relay token injected into the Claude process. That is sufficient to prove the conversation/sandbox/artifact spine, but not this production AWS credential design. Track short-lived secret injection under ONE-227 and implement the container-provider broker before production Bedrock promotion. |
| 80 | + |
0 commit comments