Skip to main content

routes.a2ui

A2UI protocol route for the pydantic-ai restaurant agent.

A2UIQueryRequest Objects

class A2UIQueryRequest(BaseModel)

Request model for A2UI query endpoint.

A2UIResponse Objects

class A2UIResponse(BaseModel)

Response model for A2UI endpoint.

restaurant_query

@router.post("/restaurant")
async def restaurant_query(request: A2UIQueryRequest) -> list[dict[str, Any]]

Handle restaurant search and booking queries via A2UI protocol.

Supports two types of requests:

  1. Query requests (query parameter): Search for restaurants
  2. Action requests (action + context): Handle button clicks, form submissions

Returns A2A-style response with A2UI messages as data parts.

restaurant_health

@router.get("/restaurant/health")
async def restaurant_health() -> dict[str, Any]

Health check for the A2UI restaurant endpoint.