What BedrockAgentCoreApp Does Internally
28th January 2026
It’s Starlette (not FastAPI)!
from starlette.applications import Starlette
class BedrockAgentCoreApp(Starlette): # Line 76
Starlette is a lightweight ASGI framework — FastAPI is actually built on top of Starlette.
Built-in Routes/Endpoints
| Endpoint | Method | Purpose |
|---|---|---|
/invocations | POST | Main entrypoint — your @app.entrypoint function |
/ping | GET | Health check |
/ws | WebSocket | Optional WebSocket handler |
Server: Uvicorn
def run(self, port: int = 8080, host: Optional[str] = None, **kwargs):
import uvicorn
uvicorn.run(self, **uvicorn_params) # Line 464
SSE Streaming Magic
When your function yields data, it gets converted to SSE format:
def _convert_to_sse(self, obj) -> bytes:
json_string = self._safe_serialize_to_json_string(obj) # json.dumps()
sse_data = f"data: {json_string}\n\n" # SSE format
return sse_data.encode("utf-8")
So when you do:
yield {"text": "Hello"}
It becomes:
data: {"text": "Hello"}
Available Decorators
| Decorator | Purpose |
|---|---|
@app.entrypoint | Main invocation handler |
@app.healthcheck | Custom health check logic |
@app.websocket | WebSocket handler |
@app.async_task | Track long-running tasks for health status |
Summary
BedrockAgentCoreApp
├── framework: Starlette (ASGI)
├── server: Uvicorn
├── endpoints:
│ ├── POST /invocations → your @app.entrypoint function
│ ├── GET /ping → health check
│ └── WS /ws → optional websocket
└── auto-converts yields to SSE format
More recent articles
- OpenUSD: Advanced Patterns and Common Gotchas. - 28th March 2026
- OpenUSD Mastery: From Composition to Pipeline — A SO-101 Arm Journey - 25th March 2026
- Learning OpenUSD — From Curious Questions to Real Understanding - 19th March 2026