Akshay Parkhi's Weblog

Subscribe

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

EndpointMethodPurpose
/invocationsPOSTMain entrypoint — your @app.entrypoint function
/pingGETHealth check
/wsWebSocketOptional 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

DecoratorPurpose
@app.entrypointMain invocation handler
@app.healthcheckCustom health check logic
@app.websocketWebSocket handler
@app.async_taskTrack 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

This is What BedrockAgentCoreApp Does Internally by Akshay Parkhi, posted on 28th January 2026.

Next: CloudWatch Log Streams for BedrockAgentCoreApp

Previous: ClawdBot - Setup