local start-agentcore (serve a Bedrock AgentCore Runtime locally)
cdkd local start-agentcore [target] is the long-running serve
counterpart of the single-shot local invoke-agentcore. It boots the
AgentCore Runtime container once (same image / env / credential
resolution as invoke-agentcore) and keeps it warm, serving the
runtime's native protocol contract so a client can hit it repeatedly:
- HTTP / AGUI runtimes serve
POST /invocations+GET /ping(proxied to the warm container, with the session-id / boot-resolvedAuthorizationinjected and the request/response — including an SSE stream — piped through) and the bidirectional/wsWebSocket endpoint behind a host bridge that injects the AgentCore session-id (and, under acustomJwtAuthorizer, theAuthorizationheader) on the container upgrade — so a header-less client (e.g. a browserWebSocket, which cannot set custom upgrade headers) can hold an interactive multi-frame session. Both share the same host port; the ready banner prints both anHTTP contract served on http://...line and theServer listening on ws://...line. - MCP runtimes serve
POST /mcp; A2A runtimes servePOST /(these have no/wsbridge, and print aServer listening on http://...ready line plus a<PROTOCOL> contract served on http://...line).
Runs until ^C. Models cdk-local's cdkl start-agentcore,
inherited into cdkd's command tree as a thin
pass-through to cdk-local's command factory. Requires Docker.
local start-agentcore target resolution
Same shape as local invoke-agentcore: a CDK display path
(MyStack/MyAgent) or stack-qualified logical ID. Single-stack apps may
omit the stack prefix. Omit the target in a TTY for an interactive picker
over the discovered AgentCore Runtimes.
local start-agentcore state-source flags
start-agentcore is one of the factory pass-throughs that bind deployed
state via the extraStateProviders seam: cdk-local's
start-agentcore factory accepts it, so cdkd threads its S3-backed
--from-state factory in and layers the cdkd-specific --from-state /
--state-bucket / --state-prefix flags on top of cdk-local's inherited
--from-cfn-stack / --stack-region. Use --from-state (after a prior
cdkd deploy) or --from-cfn-stack [name] (for a stack deployed via the
upstream CDK CLI) to substitute Ref / Fn::GetAtt / Fn::Sub /
Fn::ImportValue / Fn::GetStackOutput intrinsics in the runtime
container image + environment variables. Mutually exclusive. (start-alb,
start-service, and — as of cdk-local 0.128.0 — start-cloudfront thread
--from-state the same way.)
local start-agentcore options
--port <n>— serve bind port the client connects to (default0= OS-assigned). The HTTP contract and the/wsbridge share this one port; the ready banner prints the chosenhttp://<host>:<port>+ws://<host>:<port>/ws.--host <ip>— serve bind host (default127.0.0.1).--session-id <id>— pin one AgentCore session-id for every forwarded request //wsconnection (default: a fresh UUID each, so each is its own session).--bearer-token <jwt>— Bearer JWT presented under acustomJwtAuthorizer(verified against the runtime's OIDC discovery URL before the container starts, then forwarded on every request and the container/wsupgrade). Now the default-when-missing fallback — the inbound JWT gate is per request, not boot-time (see below).--no-verify-auth— skip the inbound JWT verification (a--bearer-token, if given, is still forwarded).--sigv4— sign each forwarded request with AWS SigV4 (servicebedrock-agentcore) when the runtime declares nocustomJwtAuthorizer, so the warm container sees the sameAuthorization/X-Amz-*headers the cloud receives. Mutually exclusive with--bearer-token; ignored (with a warning) when acustomJwtAuthorizeris declared.--watch— re-synth + reload the warm container in place on a CDK source change, keeping the host serve up (only the container rotates; a per-firing classifier picks rebuild vs soft-reload, the same machinery asinvoke-agentcore --ws --watch). Off by default.--env-vars <file>— SAM-shape env-var overrides.--platform <linux/amd64|linux/arm64>— defaults tolinux/arm64(AgentCore's required arch).--container-host <host>— host to bind the container ports to.--timeout <ms>— per-request timeout.--from-state/--from-cfn-stack [name]/--state-bucket/--state-prefix/--stack-region— state-source flags (above).--assume-role [arn]/--ecr-role-arn <arn>— role-assumption + cross-account ECR image-pull flags.--no-pull/--no-build— pull / build skip.
local start-agentcore inbound auth (customJwtAuthorizer)
When the runtime declares an inbound customJwtAuthorizer, the warm serve
verifies each contract request's Authorization per request (matching
the cloud): 401 when the header is missing, 403 when the token is
invalid, forwarded on a pass. GET /ping is unauthenticated. The
container boots without requiring a token up front; --bearer-token is the
default token used when a request arrives without its own Authorization.
For a SigV4-protected runtime (no customJwtAuthorizer) use --sigv4
instead to sign each forwarded request.
local start-agentcore lifecycle
The container is started once and kept warm; HTTP / AGUI contract requests
are proxied to it and each /ws client opens its own container upgrade
with the session-id (and optional Authorization) injected. ^C
(SIGTERM / SIGINT) tears the container down and exits — no
cdkd-local-agentcore-* container is left behind. The studio
agentcore-ws serve kind (cdk-local) spawns this command, but cdkd does
not embed cdk-local's studio command, so that surface is not exposed by
the cdkd CLI.