Skip to content

Decision AgentCore Runtime V2

Reese Hodge edited this page Oct 22, 2026 · 7 revisions

Decision: AgentCore Runtime V2

Context

Max Height has friends-and-family traffic and scales to zero. For that traffic shape, most visits can be cold starts, so runtime startup latency is user-visible unless hidden behind the greeting flow. research.md R2c and docs/infra-plan.md therefore make the AgentCore runtime platform version a core architecture choice.

The top of tasks.md records deviation C5: AgentCore Runtime had never been provisioned, and platform version was undecided. R2c resolved that gap by targeting platform version V2.

Decision

Target Amazon Bedrock AgentCore Runtime platform version V2 for the Max Height agent runtime.

Accepted target, not implemented or constitutionally approved: provision the runtime through CDK using stable aws-cdk-lib/aws-bedrockagentcore. T152 remains open and packages/infra/lib/agent-stack.ts constructs no runtime. No deployed resource or platform version was checked in AWS. The constitution's technology table still mandates AgentCore CLI for agent deployment and requires an amendment for technology changes. The upcoming re-architecture spec must resolve that conflict; this wiki decision does not override the constitution.

Reversed 2026-09-27. This page previously said runtime deployment must go through the AgentCore CLI, because CloudFormation and CDK could not set platformVersion. That constraint no longer exists, so the split it forced is gone. See The reversal below. The CLI keeps local development.

Concrete source values and constraints:

Item Source value
Platform version V2
Supported project region us-west-2
Other V2 regions listed us-east-1, us-east-2, eu-west-1, ap-northeast-1
AWS-measured V2 P75 cold start about 2 seconds, flat from 200 MB to 2 GB images
V1 comparison about 5.4 seconds rising to about 30 seconds
Container platform LINUX_ARM64
Agent container port 8080
Health endpoint /ping
Invocation endpoint /invocations POST
Container image target less than 200 MB
V2 container environment variable cap 2.5 KB
Startup deadline healthy within 120 seconds
Session idle timeout 1800 s (decided) — service default is 900 s; range 60–28800 s on microVMs
Instance maxLifetime 28800 s (8 h) service default, left as-is

Runtime deployment must poll get-agent-runtime until READY or a failed terminal state. Create/update can return while still CREATING, and early update/delete can raise a conflict.

The reversal

Three facts, each verified on 2026-09-27, removed the premise behind the CLI-owns-the-runtime split:

Fact Verified against
AWS::BedrockAgentCore::Runtime now exposes a PlatformVersion property CloudFormation Template Reference for the resource
AgentCore constructs moved into stable aws-cdk-lib/aws-bedrockagentcore — including Runtime, Memory, MemoryStrategy, and Policy Direct import verification corrected the alpha README's false "Policy remains experimental" caveat (see below)
That stable module already ships in the pinned aws-cdk-lib, while @aws-cdk/aws-bedrock-agentcore-alpha is declared and imported nowhere repo node_modules inspection

The deciding argument is P10, not convenience. As a CLI invocation, the platform version was a manual post-deploy check that nothing in CI could see. In CDK it becomes an assertion on the synthesized template. Removing the alpha pin also retires the "alpha construct churn" risk and reduces dependency count (Concept-Supply-Chain-Discipline).

Alpha pin removed 2026-09-28. @aws-cdk/aws-bedrock-agentcore-alpha is gone from packages/infra/package.json, taking the transitive @aws-cdk/aws-bedrock-alpha out of the lockfile with it. Nothing imported either. The six constructs T023b and T152 need — Runtime, RuntimeEndpoint, AgentRuntimeArtifact, Memory, MemoryStrategy, CfnRuntime — were confirmed present in stable by direct import at that time. That check was deliberately not frozen into a guard test: tsc fails on the import itself the moment those tasks write it, sooner and more precisely than a typeof assertion could. See Log entry 28.

Two README claims were disproved while doing it. The Migration to Stable section is the source for the table above, and it is stale on both edges. Both were checked by importing the module and testing typeof, not by re-reading the README:

The alpha README says True in aws-cdk-lib 2.270.0
"The Policy submodule remains experimental" Policy is exported from stable. The migration is total — dropping the alpha package leaves nothing behind, so the "all except Policy" caveat above no longer applies to us.
Lists Observability among the graduated constructs No such construct exists in either package. It is a submodule of helpers — LogType, LoggingConfig, LoggingDestination, configureTracingDelivery(), configureLoggingDelivery(). Do not go looking for new Observability(...). Stable is a superset; it adds RuntimeObservabilityOptions.

Sharp edge — CDK codegen lags the CloudFormation spec. platformVersion is absent from the generated L1 in aws-cdk-lib 2.270.0 and 2.271.0 (latest at time of writing), so it must be set with an untyped escape hatch:

const cfnRuntime = runtime.node.defaultChild as CfnRuntime;
cfnRuntime.addPropertyOverride('PlatformVersion', 'V2');

A typo there silently deploys V1 and looks like success — the precise failure V2 was chosen to avoid. A CDK assertion is mandatory, and the deployed value must still be confirmed with get-agent-runtime --query platformVersion. See Gotchas.

Not yet proven by us. The CFN property description is still blank upstream, indicating freshly generated service-model plumbing. That V2 provisions correctly through CloudFormation is untested here; the CLI path remains a working fallback if it does not.

Session idle timeout versus FR-010

idleRuntimeSessionTimeout defaults to 900 s (15 min). Because the session opens at TV power-on rather than first message, and spec.md FR-010 allows 30 minutes, the default would drop a quiet visitor mid-experience at roughly 16 minutes.

Set to 1800 s so the platform timer matches the cap the session manager already enforces, leaving application code the single authority on session length. A number decided, not inherited.

Consequences

V2 snapshots the initialized runtime and restores instances from that snapshot. That makes cold starts small enough to hide behind the pre-generated greeting, but it also creates correctness hazards. /ping must not report healthy until initialization is complete, and the agent must not compute random values, UUIDs, tokens, timestamps, or monotonic reference points at module scope.

The frontend flow becomes part of the runtime strategy: the session should open when the TV powers on, not when the user sends the first message. The greeting durations cited by research.md and docs/infra-plan.md are 8832-14688 ms, comfortably longer than the expected V2 platform startup.

Under the accepted target, CDK would own the runtime along with the other infrastructure. In the current code, Component-Infra-Stacks contains the Cognito, WebSocket/Lambda, budget, and frontend stacks, but neither AgentCore Runtime nor Memory is constructed. No target resource should be described as deployed on the strength of this decision.

Warm-up closed (2026-09-28). The "construct and exercise the Bedrock client at startup" requirement is now fully implemented. warmBedrockClient() drives one real signed ListAsyncInvokes(maxResults: 1) against the same bedrock-runtime host the Converse path uses, so credential resolution, endpoint-ruleset evaluation, SigV4 signing, protocol serde and the TLS connection pool land in the snapshot instead of being re-paid by every restored instance.

The operation was picked on Concept-Budget-Ceiling grounds (P2): it runs no model and bills nothing, which matters because a scale-to-zero service starts containers often. CountTokens looked ideal — also free, and model-aware — but AWS documents Claude models offered only through cross-Region inference as unsupported for CountTokens on bedrock-runtime, and global.anthropic.claude-haiku-4-5-* is one of those. A small maxTokens invocation would have billed every cold start.

This adds an IAM obligation to T152: the runtime execution role must grant bedrock:ListAsyncInvokes. Omitting it stops the container at startup, which is deliberate — the alternative is a degraded snapshot inherited by every instance.

Alternatives considered

Alternative Rejected because
Stay on V1 Cold starts scale with image size and match the project's all-cold-start traffic pattern poorly. See the cost note below — this rejection was made without knowing V2's price premium.
Wait for CDK support Overtaken by events — CloudFormation added PlatformVersion and the constructs graduated.
CDK-only runtime deployment Now the chosen option, via the stable module plus an L1 escape hatch.
Keep deployment in the CLI anyway Nothing forces it now, and it leaves the runtime outside the tested, reviewable artifact.
Run the agent as a Lambda Web Function instead (added 2026-10-22) Not rejected, not adopted. It would drop ECR, the platformVersion trap and the V2 premium, but it has no session affinity (history moves to DynamoDB), needs app-level JWT validation, and bills fixed 2 GB environments for their whole life. Rates are about 22% under on-demand V2. See Source-Lambda-Web-Functions.
Lower FR-010 to 15 minutes to match the idle default Inherits a number instead of deciding one, and silently contradicts a published functional requirement.

V2 costs more than V1, and we did not know that

Added 2026-09-29. Published rates (Source-AgentCore-Pricing):

V1 V2
CPU $0.0895 / vCPU-hour $0.1276 / vCPU-hour
Memory $0.00945 / GB-hour $0.0169 / GB-hour

That is roughly +42% CPU and +79% memory. A committed-baseline V2 rate ($0.0997 / $0.0132) is announced for October 2026, which narrows but does not close the gap.

This does not reverse the decision. A scale-to-zero service whose traffic is almost entirely cold starts is the workload snapshot-backed starts exist for, and V2 also bills per second with idle memory reclaimed after 120 seconds, so faster starts partly pay for the higher rate. The point is that the trade was never actually priced — the comparison above simply was not on the wiki when "stay on V1" was rejected. It is now, and it belongs in the Concept-Budget-Ceiling arithmetic for any future re-evaluation.

Status/verification

The design evidence was checked 2026-09-27 against research.md R2d, docs/infra-plan.md, deviations C5/C6/C7 in tasks.md, the CloudFormation Template Reference, the AgentCore lifecycle-settings reference, and the alpha package README. Implementation status was checked 2026-09-30 against agent-stack.ts, index.ts, warmup.ts, and T152; deployment was not checked.

Trap: some specs still mention the old @aws/agentcore-cli install command. docs/infra-plan.md records that package as renamed and unpublished; following the stale install command 404s. Verify current package reality before following any spec install instruction. See also Gotchas and Concept-Supply-Chain-Discipline.

Clone this wiki locally