Hey everyone,
We just shipped Genkit Python 0.12 with new support for generative UI, typed Pydantic streaming, and new Google AI models:
-
Generative UI with A2UI (genkit-a2ui): Passing Surfaces() to ai.generate or ai.define_agent lets your agent respond with interactive UI components instead of plain text, tracking screen state and user actions across turns. You can pair a Python backend with JavaScript/TypeScript web frontends (@genkit-ai/a2ui/client) or multi-platform Dart and Flutter apps (package:genkit_a2ui/client.dart).
-
Typed Pydantic streaming: generate_stream(..., output_schema=Country) now yields partial Country Pydantic instances on chunk.output as tokens arrive, with the fully validated model returned on (await sr.response).output.
-
Deep Research & Lyria 3 models: genkit-google-genai adds GoogleAI.deep_research_model for long-running background research reports (generate_operation / check_operation) and GoogleAI.lyria_model for generating music and audio clips from text prompts.
-
Mid-turn error recovery on ModelResponse: Once a turn starts, ai.generate returns a ModelResponse instead of throwing an exception on model or tool errors, preserving response.messages and response.text alongside response.error so you can inspect or retry failed turns.
Install or upgrade:
uv add genkit genkit-google-genai
See the blog post for details and code examples:
Happy to answer any questions or hear feedback!