

# Well-Architected considerations
<a name="arch-well-architected"></a>

The following considerations apply regardless of the industry or tenant type. They are framed prescriptively — implementers should treat each as a design checkpoint before deploying AVX at production scale.

 **Security.** The AVX request path crosses six service boundaries (browser/phone → API Gateway → Lambda proxy → AgentCore runtime → Bedrock model / Athena / KB). Enforce least privilege at each boundary independently: scope AgentCore execution-role IAM statements to the specific Bedrock inference-profile ARNs and the specific KB ARN, not to service-level wildcards. Infer persona server-side from validated Cognito claims, not from client-supplied parameters — a client-controlled persona parameter is a privilege-escalation vector when personas carry different data access breadths. For voice sessions, note that the Nova 2 Sonic bidi path does not forward custom HTTP headers; any caller identity that must survive the bidi transport must be encoded in the initial session payload, not in a header.

 **Reliability.** AgentCore Runtime scales to zero between requests and restarts on invocation. First-invocation cold-start latency (typically 3–8 seconds for the container warm-up phase) is user-visible for voice sessions. Design the contact flow to play a hold message during initialization. Instrument the supervisor handler to detect and surface the difference between an AgentCore cold-start delay and a tool timeout so that operators can distinguish platform health from grounding data availability. Codify graceful-degradation paths in every tool factory: if Memory returns no records, the tool returns a structured "not available" response rather than raising an unhandled exception that aborts the session.

 **Operational excellence.** Session IDs passed to AgentCore’s `runtimeSessionId` parameter must be at least 33 characters; IDs shorter than this minimum are rejected by the API and produce an opaque error that is difficult to correlate to its cause. Generate session IDs with sufficient entropy (`session_{timestamp}_{random_12chars}`) and validate the length before invoking the runtime. Enable CloudWatch Transaction Search for the deployment account to correlate a single session ID across API Gateway, Lambda, and AgentCore log groups without manual cross-service log queries.

 **Cost optimization.** The dominant AVX cost drivers at scale are Bedrock Sonnet token volume and Nova 2 Sonic voice-minutes. AgentCore Memory’s 15-minute TTL \+ lazy-refresh pattern bounds cross-region Athena cost by paying the session-init query cost once per session, not once per turn. Use the three-tier eval pipeline (tool-unit → mocked-conversation → real E2E) to catch regressions in the two cost-free tiers before spending Bedrock inference budget on every CI run. Apply per-session token caps in production to prevent runaway tool-call loops from generating unbounded costs.

 **Performance efficiency.** Voice latency is the primary performance constraint for the Nova Sonic bidi path. The first-turn latency budget has three components: session-init Athena queries (\~6–7 seconds cold, reduced by Memory cache hits on subsequent turns), AgentCore container warm-start (\~3–8 seconds on cold invocation, zero on warm invocation), and Nova Sonic speech-to-first-audio-token (\~700ms). Pre-warm the AgentCore runtime by provisioning a minimum concurrency of one if sustained voice traffic is expected. Use persona-scoped Bedrock Retrieve filters (`source_category` values) to limit KB retrieval to the relevant content subset, reducing both retrieval latency and LLM context size.