litestar-ai-serving

Serve Google ADK agents through Litestar HTTP endpoints with session persistence.

Updated Aug 17, 2026
One-click install
npx skills add https://github.com/renjianguo666/litecms --skill litestar-ai-serving-renjianguo666
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: litestar-ai-serving
Source: https://github.com/renjianguo666/litecms/tree/main/.agents/skills/litestar-ai-serving
Command: npx skills add https://github.com/renjianguo666/litecms --skill litestar-ai-serving-renjianguo666

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires litestar, dishka, google-adk, sqlspec, msgspec, and includes references (resource) components.

What problem does it solve? Building HTTP-facing AI agent endpoints requires coordinating agent runners, session memory, dependency injection, and error handling, and this Skill provides the canonical patterns for wiring Google ADK agents into Litestar applications without exposing agent internals as the API contract. ## Core Features & Use Cases - ADK Provider Wiring: Configure LlmAgent, Runner, and SQLSpecSessionService through Dishka providers with correct APP and REQUEST scopes. - Session-Backed Chat Handlers: Implement request/response chat endpoints that persist multi-turn conversation state across HTTP requests via session IDs. - Credential and Failure Guards: Convert missing Vertex AI credentials into HTTP 503 responses and enforce tool-use-first prompt patterns to prevent hallucinated answers. - Use Case: You are building a support assistant API where users send chat messages, the agent classifies intent, calls search tools, and remembers prior turns; this Skill gives you the controller, runner, and DI structure to ship it. ## Quick Start Use the litestar-ai-serving skill to create a Litestar chat endpoint backed by a Google ADK agent with persistent session memory.

Frequently Asked Questions about litestar-ai-serving

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I serve a Google ADK agent from a Litestar endpoint?

Wrap the LlmAgent and Runner in a service class, register it as an APP-scoped Dishka provider, and inject it into a Litestar controller with FromDishka. The handler awaits the runner's process_request coroutine and returns a typed response DTO.

How to persist multi-turn chat sessions with Google ADK?

Use SQLSpecSessionService backed by an ADK-compatible store such as OracleAsyncADKStore. The Runner loads prior history with get_session before each turn and persists new events automatically, keyed by app name, user ID, and session ID.

Why does Dishka fail when I use from __future__ import annotations?

Dishka inspects @provide signatures at runtime, and the future-annotations import defers type evaluation, breaking DI introspection. Omit that import in modules defining Dishka providers.

Does this pattern support streaming AI responses?

The canonical reference pattern is synchronous request/response only; it awaits the full ADK event iteration and returns JSON. Streaming via Litestar Stream or SSE is documented as not yet canonical in the reference material.

How should missing Vertex AI credentials be handled in the API?

Catch ValueError exceptions whose message mentions API keys or credentials and re-raise them as HTTP 503 Service Unavailable. This signals a configuration problem to clients instead of returning a 500 with a stack trace.