Skip to main content

genkit-a2ui

Experimental A2UI middleware for Genkit Python.

Add Surfaces() to use=[...] on ai.generate or define_agent. The model may emit ```a2ui fences; the middleware rewrites them into application/a2ui+json data parts. On the next turn, those parts become text again so the model can see prior surfaces and button clicks.

from genkit import Genkit
from genkit_a2ui import Surfaces, envelopes_from_parts
from genkit_google_genai import GoogleAI

ai = Genkit(plugins=[GoogleAI()])

response = await ai.generate(
    model='googleai/gemini-2.5-flash',
    prompt='Show me the weather in Tokyo',
    use=[Surfaces()],
)
envelopes = envelopes_from_parts(response.message.content)

Surfaces() uses the bundled basic catalog. To use your own components, register a catalog and pass its id:

from genkit_a2ui import Surfaces, A2uiCatalog, A2uiCatalogComponent, load_catalog

catalog = A2uiCatalog(
    id='https://my-app.org/catalogs/custom.json',
    components=(
        A2uiCatalogComponent(name='Banner', description='A prominent alert.', props='title: string.'),
    ),
)
load_catalog(ai, catalog)

response = await ai.generate(
    model='googleai/gemini-2.5-flash',
    prompt='Show a warning banner',
    use=[Surfaces(catalog=catalog.id)],
)

load_catalog_file(ai, './my-catalog.json') does the same from disk. register_basic_catalog(ai) puts the bundled catalog on the registry so the Developer UI can list it next to custom ones (GET /api/values?type=a2ui-catalog).

Status: experimental.

Release files for genkit-a2ui 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for genkit-a2ui 0.12.0
File Size Uploaded
genkit_a2ui-0.12.0.tar.gz 26.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for genkit-a2ui 0.12.0
File Interpreter ABI Platform
genkit_a2ui-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.9 kB

Release files / genkit_a2ui-0.12.0.tar.gz

Download URL genkit_a2ui-0.12.0.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
47c757119a3bb495c964a2a6d01832ceacef82badc0dcc10874bd8fa6157d11f
BLAKE2b-256 checksum
How to use checksums
97c9e061b9b94f8d7aead88fc303bbc2b71eca7531a01e33463fc26a0007f674
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release files / genkit_a2ui-0.12.0-py3-none-any.whl

Download URL genkit_a2ui-0.12.0-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bcb56eeab93e8982e4fd5b43cdcb1cbf68de5d1edc609d3bdcf262629654fcc
BLAKE2b-256 checksum
How to use checksums
ea63b14cad7802daf3f11670f69f7e962dafd9d602d85c298fc7e44487abe573
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.12.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page