/aws:agui-strandsfrom aws
Build or debug generative-UI chat apps on the AG-UI × Strands × Bedrock AgentCore × Vercel AI SDK (useChat) stack. Use WHEN: scaffolding an ag_ui_strands agent server (StrandsAgent, @tool, BedrockModel, EventEncoder, RunAgentInput, /invocations, /ping, 0.0.0.0:8080, arm64); writing the createUIMessageStream bridge (RUN_STARTED→start-step, TOOL_CALL_RESULT→tool-output-available, start/finish envelope, SSE buffer flush); building generative-UI card renderers (useChat, dynamic-tool parts, tool-input-available, tool-output-available, AI SDK v5/v6); deploying to Bedrock AgentCore Runtime (InvokeAgentRuntime, runtimeSessionId, ECR, OpenNext streaming, Terraform); or debugging: blank chat bubble, tool chip spins forever, text part not found, agent forgets context after message 1, frozen pane, runtimeSessionId length errors, manifest-list/image-not-found on deploy.
Ships in aws. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Build chat apps where a Strands agent on Bedrock AgentCore emits AG-UI protocol events,
a Next.js route translates them into Vercel AI SDK stream parts, and useChat renders tool
calls as React cards. This is the architecture in real production apps (elko.is, garri.is).
"AGUI" here is NOT CopilotKit's frontend SDK. It is a hand-written bridge: AG-UI SSE on the backend, the Vercel AI SDK UI-message stream on the frontend, joined by ~50 lines in your route. Internalize that or you will look for libraries that do not exist.
useChat (AI SDK v6) ──POST UIMessage[]──► /api/chat route
▲ │ flatten → AG-UI RunAgentInput {threadId,runId,messages,...}
│ parts[] ▼ InvokeAgentRuntime (accept: text/event-stream)
React cards ◄── AI SDK parts ◄── translateEvent() ◄── AG-UI SSE ◄── FastAPI /invocations :8080 (arm64)
│ ag_ui_strands.StrandsAgent
▼ Strands Agent → Bedrock (Claude)
Each layer is blind to the others. A bug in the agent surfaces as a blank screen two layers up with no error. When something is wrong, name the layer first: AG-UI event? SSE wire? AI SDK part ordering? React card switch? Debug the boundary, not the symptom.
The single source of truth crossing the boundary is the AG-UI → AI SDK part translation table
(see references/ai-sdk-bridge.md). Get one type string or one ordering rule wrong and the chat
goes blank silently.
Build and verify backend → bridge → frontend → deploy, proving each layer before the next.
agent/main.py) — FastAPI + ag_ui_strands.StrandsAgent, /invocations SSE +
/ping, on 0.0.0.0:8080. Scaffold: scripts/agent_server.py.
Verify with curl -N -H 'accept: text/event-stream' localhost:8080/invocations -d '{...}'.@tool functions returning json.dumps({...}). Before writing each tool, ask:
what is its exact three-part contract? (a) the function name == the React card case; (b) the
return JSON shape == what the card reads; (c) every value is JSON-serializable. Drift on any one
fails silently — verify all three before moving on. See references/ag-ui-strands.md.app/api/chat/route.ts) — the crux. Copy
scripts/route_bridge.ts as written (translation table +
buffer-flush + synthetic-text-start fixes baked in); adapt only the session strategy for
production (see the session decision tree below). Read references/ai-sdk-bridge.md first.useChat + a parts[] renderer that switches tool-<name>/dynamic-tool parts
to cards. See references/ai-sdk-bridge.md §rendering.references/agentcore-deploy.md.Run scripts/agui_doctor.py against the project at any point to catch the
known footguns before they cost you an afternoon.
The route uses createUIMessageStream with a manual writer. In this path the SDK does NOT
write start/finish for you — you must (it only back-fills messageId onto your start
chunk). This contradicts a lot of stale advice about streamText().toUIMessageStreamResponse(),
which is a different path. For the AG-UI bridge:
const stream = createUIMessageStream({
execute: async ({ writer }) => {
writer.write({ type: "start" }); // REQUIRED (id back-filled by SDK)
try {
// for each AG-UI SSE event → translateEvent(event, writer, ctx)
// (full RUN_*/TEXT_MESSAGE_*/TOOL_CALL_* → part mapping in references/ai-sdk-bridge.md §1)
} finally {
writer.write({ type: "finish" }); // REQUIRED (close envelope)
}
},
onError: () => "Agent service error",
});
return createUIMessageStreamResponse({ stream }); // adds SSE framing + [DONE]; do NOT write [DONE]
The full, correct translateEvent switch is in references/ai-sdk-bridge.md and
scripts/route_bridge.ts. Do not paraphrase it from memory — the exact type strings are
load-bearing.
[DONE] sentinel, frames as data: {json}\n\n, and
TOOL_CALL_ARGS.delta is a JSON-string fragment — concatenate per toolCallId, parse once at
TOOL_CALL_END. A run must be bracketed RUN_STARTED … RUN_FINISHED|RUN_ERROR.buffer = lines.pop() keeps the partial
last line; if RUN_FINISHED lands in the final chunk you break before parsing it →
finish-step never fires → client hangs in streaming forever. (Baked into the scaffold.)runtimeSessionId must be 33–256 chars. One crypto.randomUUID() (36) is enough; double-UUID
is belt-and-suspenders.accept: "text/event-stream", or the entire response buffers and the
user sees a frozen pane, then everything at once.export const runtime = "nodejs" on the route (not edge) — the AWS SDK and web-stream
transform need Node. Set maxDuration ≥ 120 for multi-tool runs.case. Renaming the Python tool without updating the card
switch → the chip flashes and the card silently returns null. Keep a shared TOOL_NAMES const.Decimal/datetime/floats at the boundary or
json.dumps throws and the whole turn becomes a generic RUN_ERROR.type strings from memory — tool-input-available /
tool-input-delta / tool-output-available are distinct; one wrong string silently drops the
part and the card never renders. Copy from references/ai-sdk-bridge.md or scripts/route_bridge.ts.createUIMessageStream to write start/finish for you on the bridge path — it
does not. You write both; the SDK only back-fills messageId. (Auto-write is the streamText path.)session_manager on the template Strands agent — StrandsAgent silently ignores it.
Use session_manager_provider and set replay_history_into_strands=False..env or .env.local — Next bundles them into the Lambda where
the profile breaks the SDK credential chain. Use .envrc (direnv) locally; the IAM role when deployed.:latest — the runtime won't roll on source changes. Use a
content-addressed tag (sha1 of source files) so Terraform forces a rebuild.runtime = "edge" on the chat route — the AWS SDK + web-stream transform need Node.--platform linux/arm64 --provenance=false --sbom=false.Which backend mode? (garri's three-mode pattern)
AGENT_URL set → POST the local python agent (fast iteration, full AG-UI path, no AWS).AGENT_RUNTIME_ARN set → InvokeAgentRuntime (deployed AgentCore).streamText with TS tool mirrors (zero-infra fallback / demo).
Explicitly set the unused env to "" in prod (SST) so a leaked local URL can't activate.Who owns conversation history?
replay_history_into_strands=True: stateless agent, the route sends full history each
turn, StrandsAgent overwrites agent.messages and calls stream_async(None). Use this.session_manager_provider (File/S3 SessionManager): Strands persists history; set
replay_history_into_strands=False. Mutually exclusive with the above.Backend tool vs frontend tool?
@tool on the server): result arrives inline as TOOL_CALL_RESULT. Default choice.RunAgentInput.tools): stream halts after TOOL_CALL_END; the client
executes it and sends a NEW RunAgentInput with the result. Only when the action needs the browser.Session id for production? Mental model: on Lambda you have no durable module-scope state —
assume horizontal scale from day 1. The in-memory sessions Map works in next dev but breaks on
Lambda (per-instance, cold starts) → the agent forgets context after message #1. The
runtimeSessionId must be stable across a conversation's requests. Pick by deployment:
useChat chat id (persist in localStorage) and send it
as threadId in the request body; the route uses it instead of messages[0].id.references/ai-sdk-bridge.md in full before
writing/altering the route bridge or any frontend card — translation table, every part
type, the start/finish truth, the card-rendering state machine.references/ag-ui-strands.md in full before
writing/altering the agent or its tools — StrandsAgent internals, @tool schema rules,
BedrockModel, history replay, frontend tools, the gotchas.references/agentcore-deploy.md in full before any
deploy/infra work — the runtime contract, arm64 + buildx flags, Terraform, IAM, sessionId,
OpenNext streaming, ARN wiring.references/agui-protocol.md ONLY to verify exact wire-level
field names (camelCase), the RunAgentInput schema, or the STEP/REASONING/STATE event set. Do NOT
load it for the bridge — ai-sdk-bridge.md already has the translation table. Do NOT load it for
the agent — use ag-ui-strands.md. Loading it alongside ai-sdk-bridge.md for a bridge task just
duplicates the event table.references/anti-patterns.md when debugging a silent failure —
it is indexed by symptom (blank bubble, spinner forever, amnesia, frozen pane, NaN prices…).:8080 + env wiring + .envrc vs .env), see the "Local dev"
section of references/agentcore-deploy.md.python3 scripts/agui_doctor.py [PROJECT_DIR] — static scan for the known footguns (buffer flush,
runtime="nodejs", maxDuration, accept header, sessionId length, Dockerfile arm64, buildx
provenance flags, tool-name↔card-case parity, OpenNext streaming wrapper). Prints PASS/WARN/FAIL.
Run it after scaffolding and before every deploy.scripts/route_bridge.ts — drop-in app/api/chat/route.ts reference with the translation table
and all the defensive fixes. Adapt the session strategy for production.scripts/agent_server.py — drop-in agent/main.py reference (FastAPI + ag_ui_strands).agui_doctor.py reports no FAIL.case (and vice versa).start … finish and flushes the trailing buffer.accept: text/event-stream; the route is runtime="nodejs".--provenance=false --sbom=false and the OpenNext streaming wrapper.references/ag-ui-strands.md (opens in a new tab)references/agentcore-deploy.md (opens in a new tab)references/agui-protocol.md (opens in a new tab)references/ai-sdk-bridge.md (opens in a new tab)references/anti-patterns.md (opens in a new tab)scripts/agent_server.py (opens in a new tab)scripts/agui_doctor.py (opens in a new tab)scripts/route_bridge.ts (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub tomaspalsson/flow --plugin aws6 skills in this plugin
/aws-exploreToken-efficient AWS resource exploration during debugging. Use when: (1) debugging live AWS resources — S3 access issues, DynamoDB query patterns, Bedrock/AgentCore failures, (2) the user asks what's in their AWS account, (3) you need to understand the shape/config of AWS resources before making changes. Covers S3, DynamoDB, and Bedrock/AgentCore. Do NOT use for: creating/modifying AWS resources (use sst skill), deploying agents (use strands-agentcore skill), or general AWS documentation questions. Trigger keywords: s3, bucket, dynamodb, table, bedrock, agentcore, aws, 403, access denied, describe, explore, scan./aws-lambda-microvmsBuilds, runs, debugs, and operates applications on AWS Lambda MicroVMs — Firecracker-isolated, snapshot-resumable serverless compute environments running inside a container with up to 8 hr lifetimes. Applicable when workloads need strong isolation between tenants, isolated serverless compute, sandbox compute, or secure multi-tenant execution. Also suited for AI/agent code-execution sandboxes, interactive code playgrounds and notebooks (Jupyter, REPLs, dev environments running user-supplied code), reinforcement-learning environments, multi-tenant CI executors and build runners, sessionful game or simulation servers, or isolated security scanners. Also applicable when the workload needs long-lived sessions, a real port-listening server (gRPC, WebSocket, custom TCP protocols), state preserved across periods of inactivity (suspend/resume), container-level access (FUSE, eBPF, custom syscalls), or session-affine routing.