Preview web apps live as your coding agent builds them with Amazon Bedrock AgentCore runtime
Amazon Bedrock AgentCore’s runtime now lets coding agents expose live web apps via per‑session microVMs, using Session endpoints that forward authenticated HTTP, HTTP/2, and WebSocket traffic to allowed ports. Engineers can configure up to five allowed ports in the 8000–12000 range when calling **CreateAgentRuntime**, receive the endpoint URL in the **X‑Amzn‑Bedrock‑AgentCore‑Runtime‑Session‑Endpoint‑Url** header, and instantly preview changes without redeployment. This reduces feedback latency for iterative development of agent‑generated sites such as Vite‑based dashboards.
⚡ Key Takeaways
- Allowed ports are specified as 1–5 entries, each a single port or range within **8000–12000** (excluding reserved platform ports).
- Session endpoints are created via **CreateAgentRuntime** and returned in the **InvokeAgentRuntime** response header **X‑Amzn‑Bedrock‑AgentCore‑Runtime‑Session‑Endpoint‑Url**.
- Access requires the IAM permission **bedrock-agentcore:InvokeAgentRuntimeProxy** (or a JWT bearer token for JWT‑authorised runtimes).
- URLs embed the target port as a hostname prefix, e.g., `https://8090--<session-endpoint-id>.runtime.bedrock-agentcore.<region>.on.aws/index.html`.
- The microVM forwards HTTP/1.1, HTTP/2 (including SSE and gRPC), and WebSocket traffic, enabling live preview of changes without a page refresh.
Engineers can iterate on agent‑generated web applications with seconds‑level feedback, eliminating costly redeploy cycles and accelerating prototyping in production‑like environments.
✅ Practical Steps
- Call **CreateAgentRuntime** with an **allowedPorts** list (e.g., `8090` or `8081`) to define which ports the agent’s app may expose.
- Invoke the agent via **InvokeAgentRuntime** and extract the session URL from the **X‑Amzn‑Bedrock‑AgentCore‑Runtime‑Session‑Endpoint‑Url** header to open the live app in a browser.
- Ensure the calling IAM role includes **bedrock-agentcore:InvokeAgentRuntimeProxy** (or provide a valid JWT) so each request to the session endpoint is authenticated.
Want the full story? Read the original article.
Read on AWS ML Blog ↗