Skip to main content

r/GenkitFramework


Genkit Python 0.12: Generative UI with A2UI, typed Pydantic streaming, and Deep Research and Lyria models
Genkit Python 0.12: Generative UI with A2UI, typed Pydantic streaming, and Deep Research and Lyria models

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: https://genkit.dev/blog/genkit-python-0-12

Happy to answer any questions or hear feedback!


Advertisement: We know you want to expand your business. Advice from Shopify on global growth is a swipe away.
We know you want to expand your business. Advice from Shopify on global growth is a swipe away.
  • We know you want to expand your business. Advice from Shopify on global growth is a swipe away.
  • We know you want to expand your business. Advice from Shopify on global growth is a swipe away.
  • We know you want to expand your business. Advice from Shopify on global growth is a swipe away.
  • We know you want to expand your business. Advice from Shopify on global growth is a swipe away.
  • We know you want to expand your business. Advice from Shopify on global growth is a swipe away.


Genkit Dart 0.17: Resumable generate and agent loops, async subagents, and pluggable telemetry
Genkit Dart 0.17: Resumable generate and agent loops, async subagents, and pluggable telemetry

Hey everyone,

We just shipped Genkit Dart 0.17 as we move toward a stable 1.0 release. This update brings resumable generation and agent snapshots, background subagents, and pluggable OpenTelemetry instrumentation:

  • Resumable generate calls & agent snapshots: When a multi-turn tool loop or stateful agent turn fails or is cancelled mid-flight, Genkit preserves completed tool rounds in response.messages and checkpoints agent turns into a session snapshot (e.snapshotId), so you can resume execution where it stopped without repeating completed tool calls.

  • Background subagents: Setting async: true on the agents middleware lets your orchestrator launch subagents in the background and return a taskId immediately. The main agent can reply to the user right away while checking progress, sharing partial results, cancelling in-flight work, or sending follow-up instructions into a subagent's session across turns.

  • Pluggable telemetry & genkit_otel: Core Genkit no longer pulls in OpenTelemetry dependencies by default, keeping your app's footprint small while local tracing still works automatically with the Genkit Developer UI. For production, the new genkit_otel (v0.1.0) package exports traces, token usage, and latency following the OpenTelemetry GenAI semantic conventions.

Install or upgrade:

dart pub add genkit

See the blog for more details and code snippets: https://genkit.dev/blog/genkit-dart-0-17

Happy to answer any questions or hear feedback!


Genkit Python 0.11.0
Genkit Python 0.11.0

0.11.0 is on PyPI. Highlights:

1. Veo support. Video generation is now supported through the generate API. Start a background video generation, and poll it using Genkit.

# Background models get a dedicated generate API
operation = await ai.generate_operation(
    model=GoogleAI.veo_model('veo-3.1-fast-generate-preview'),
    prompt='A paper airplane gliding through a bright classroom',
)

# Hooks into the general-purpose generate API as well
response = await ai.generate(
    model=GoogleAI.veo_model('veo-3.1-fast-generate-preview'),
    prompt='A paper airplane gliding through a bright classroom',
)

# Operations have a first-class polling experience
operation = response.operation
while not operation.done:
    operation = await ai.check_operation(operation)
print(operation.output.media[0].url)

2. One GenkitError across the main model providers. Gemini / Claude / GPT HTTP failures are now mapped to standard status names (INVALID_ARGUMENT, UNAVAILABLE, …). Now, you handle a single GenkitError in your application code, rather than deal with unbounded spaghetti of model-specific Exception types thrown by the raw model SDKs.

3. View Python logs directly in the Dev UI. When you use the Dev UI to debug Python code locally, you'll see your Genkit logs inside specific traces.

4. In the generate API, when the model replies but the turn ends in failure, the SDK now returns a failed FinishReason alongside the pre-existing completed messages. The API used to raise in these scenarios. For example, if the model message was blocked, or you hit max tool turns, you get the ModelResponse back instead of an exception. .messages contains the completed rounds, so you can send them back and try again.

response = await ai.generate(prompt='give me a recipe', output_schema=Recipe)
if response.output is not None:
    print(response.output.title)
else:
    retry = await ai.generate(
        messages=response.messages,
        prompt='that was not a recipe. try again as JSON.',
        output_schema=Recipe,
    )

Full notes: https://github.com/genkit-ai/genkit/releases/tag/py/v0.11.0