Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

streamlit-a2ui

Status: pre-1.0 release candidate

Render A2UI surfaces inside Streamlit apps.

The basic example: a contact form rendered from A2UI messages, filled in and sent; the agent's reply updates the form and the returned action is shown below it

A2UI is a protocol in which an agent describes a user interface as JSON messages and a renderer draws it with a trusted catalog of components. streamlit-a2ui wraps the official web renderer (@a2ui/react and @a2ui/web_core) in a Streamlit Components v2 component. You pass it the agent's messages; it draws the surface, and it returns the user's actions so you can send them back to the agent.

It is for Python developers who already have an agent that speaks A2UI, or want one, and want to show its UI in a Streamlit app without writing frontend code.

Status

Pre-1.0. 0.1.0rc1 is the first release candidate: try it and report problems, but expect the API and the supported versions to change before 1.0.

  • A2UI 1.0 only, with the official basic catalog. 0.9.x and 0.8 are not supported.
  • Streamlit >= 1.59 (Components v2). CI runs the floor (1.59) and the latest release; developed on 1.67.
  • Python >= 3.10.
  • Pinned to @a2ui/react and @a2ui/web_core 0.15.0. These upstream renderer packages are themselves pre-1.0 (see Security below for the overrides they need).

Install

pip install --pre streamlit-a2ui

0.1.0rc1 is a pre-release, so pip installs it only with --pre or an exact version (pip install streamlit-a2ui==0.1.0rc1); with uv, use uv pip install --prerelease=allow streamlit-a2ui or the exact version. Until 0.1.0 is out, a plain pip install streamlit-a2ui finds nothing to install. The wheel contains the built frontend, so no Node is needed.

Then run the example: download examples/basic_app.py and run streamlit run basic_app.py.

From source

You need uv, Node 24 and npm.

git clone https://github.com/josechudev/streamlit-a2ui.git
cd streamlit-a2ui/streamlit_a2ui/frontend
npm install
npm run build
cd ../..
uv venv
uv pip install -e .
.venv/bin/streamlit run examples/basic_app.py

npm run build writes the frontend bundle into streamlit_a2ui/frontend/build/ and generates streamlit_a2ui/renderer_capabilities.json and streamlit_a2ui/THIRD_PARTY_LICENSES.txt. Build it before installing, and again after changing the frontend. To build a wheel, run uv build after npm run build.

Quickstart

Keep the agent's messages in an append-only list in st.session_state, pass the whole list on every run, and forward whatever comes back to your agent. This is a shortened examples/basic_app.py, with a scripted function in place of a real agent:

import streamlit as st

from streamlit_a2ui import a2ui_surface

CATALOG = "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json"


def initial_messages():
    return [
        {
            "version": "1.0",
            "createSurface": {"surfaceId": "contact", "catalogId": CATALOG},
        },
        {
            "version": "1.0",
            "updateComponents": {
                "surfaceId": "contact",
                "components": [
                    {
                        "id": "root",
                        "component": "Column",
                        "children": ["name_field", "send", "reply"],
                    },
                    {
                        "id": "name_field",
                        "component": "TextField",
                        "label": "Name",
                        "value": {"@path": "/name"},
                    },
                    {
                        "id": "send",
                        "component": "Button",
                        "child": "send_label",
                        "variant": "primary",
                        "action": {
                            "event": {
                                "name": "send_message",
                                "context": {"name": {"@path": "/name"}},
                            }
                        },
                    },
                    {"id": "send_label", "component": "Text", "text": "Send"},
                    {
                        "id": "reply",
                        "component": "Text",
                        "text": "The agent's reply will appear here.",
                    },
                ],
            },
        },
    ]


def scripted_agent(event):
    name = event["action"]["context"].get("name") or "there"
    return [
        {
            "version": "1.0",
            "updateComponents": {
                "surfaceId": "contact",
                "components": [
                    {"id": "reply", "component": "Text", "text": f"Thanks, {name}!"},
                ],
            },
        }
    ]


log = st.session_state.setdefault("a2ui_log", initial_messages())
event = a2ui_surface(log, key="contact")
if event is not None:
    st.session_state["last_event"] = event
    log.extend(scripted_agent(event))
    st.rerun()

st.json(st.session_state.get("last_event", {}))

When the user presses Send, a2ui_surface returns, once:

{"version": "1.0",
 "action": {"name": "send_message", "surfaceId": "contact", "sourceComponentId": "send",
            "timestamp": "2026-11-17T06:41:12.836Z", "context": {"name": "Ada"}}}

The reply is appended to the log and the surface updates in place: text the user has typed but not sent is kept.

Take message shapes from the A2UI 1.0 specification. The installed @a2ui/web_core package has the schemas and examples under node_modules/@a2ui/web_core/src/v1_0/schemas/.

Streaming

A keyed component can be called only once per script run, so a surface cannot be repainted in the middle of a run. To show an agent's messages as they arrive, put the component in a fragment that reruns on a timer and moves whatever the stream has produced into the log:

@st.fragment(run_every=0.5)
def surface():
    log = st.session_state["a2ui_log"]
    log.extend(drain_new_messages())  # whatever your agent's stream produced
    event = a2ui_surface(log, key="stream")
    if event is not None:
        handle(event)  # only this fragment reran: handle the event here
        st.rerun(scope="fragment")


surface()

An action fired from a component inside a fragment reruns only that fragment, and the returned message is visible only there. Handle it inside the fragment, and use st.rerun(scope="app") when the rest of the page must change. examples/streaming_app.py streams a dashboard over a few seconds, accepts an action during and after the stream, and switches the timer off when the stream ends.

Do not change the key to force a repaint: a new key mounts a new component and loses its state.

Using it with a real agent

The package draws what an agent sends and returns what the user does; connecting the agent is your app's code. Pass renderer_capabilities() to the agent (with Google's a2ui-agent-sdk, under the a2uiRendererCapabilities key), run the agent's stream in a background thread or task that only appends complete A2UI messages to the log list, and draw the log with a2ui_surface inside @st.fragment(run_every=...) as above. Never call st.* from that thread. Send each message a2ui_surface returns back to the agent. This was checked with a minimal Google ADK agent built on a2ui-agent-sdk 0.12.0: an action round trip and a streamed response worked unchanged.

API

a2ui_surface(messages, *, key) -> dict | None

Renders the A2UI 1.0 messages in messages and returns at most one renderer-to-agent message per rerun.

  • messages: the full, append-only list of agent-to-renderer messages. Pass the whole list on every run; the browser processes only the entries it has not seen. If the list gets shorter, or an entry it has already processed changes, the browser discards its state and replays the list from the start.
  • key: a stable key. The surface keeps its state for as long as the key stays mounted.
  • Returns the message produced since the last rerun, such as an action or a callAgentFunction, exactly as the A2UI 1.0 wire format defines it; otherwise None. Python does not inspect or validate messages.

renderer_capabilities() -> dict

Returns the renderer's A2UI capabilities, to pass to your agent (for example in A2A metadata). It is generated from @a2ui/web_core when the frontend is built:

{
    "1.0": {
        "supportedCatalogIds": [
            "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json"
        ]
    }
}

Limitations

  • A2UI 1.0 and the basic catalog only. No custom or inline catalogs.
  • One renderer-to-agent message per rerun. A second message produced before the app reruns replaces the first: in testing, a double or triple click on a button returned only one action to Python. Do not rely on every click of a rapid burst reaching your agent.
  • Errors stay in the browser. A message the renderer rejects, or an exception while one surface renders, shows a plain-text notice inside the component and a console.warn, and the other surfaces stay rendered; nothing is returned to Python, so your agent cannot see validation errors yet.
  • The full log is sent to the browser on every rerun.
  • Text typed into a surface but not sent is lost if the component remounts or the log is replaced.
  • Streaming repaints at the fragment's interval, not per message.
  • callAgentFunction times out after 30 seconds in @a2ui/web_core, so the agent's response must be appended to the log within that time.
  • @a2ui/web_core adds a page-wide stylesheet (color-scheme and --a2ui-* defaults). It caused no visible change to Streamlit's widgets in testing.
  • Only one build of the frontend can run on a page. After rebuilding it, reload the page.

Security

The component runs in your app's page with no iframe. Read docs/security.md for the security model, the dependency overrides and the known residual risks.

Development

See CONTRIBUTING.md for how to build, test and release; the full command list is in CLAUDE.md, and docs/testing-playbook.md has the manual checks. On every pull request CI runs the build, the unit tests, pytest, ruff and one Playwright browser test on Python 3.10 with Streamlit 1.59 and on Python 3.13 with the latest Streamlit, then builds the wheel and sdist once and runs the browser test against the installed wheel. The architecture is summarised in docs/architecture.md, design decisions are in docs/adr/, and changes are in CHANGELOG.md.

License

Apache-2.0. See LICENSE. The wheel bundles third-party JavaScript; their licenses are in streamlit_a2ui/THIRD_PARTY_LICENSES.txt, generated by npm run build and also listed as a license file in the package metadata.

Metadata

Release files for streamlit-a2ui 0.1.0rc1

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

Source distribution (sdist)

Source distribution for streamlit-a2ui 0.1.0rc1
File Size Uploaded Provenance Actions
streamlit_a2ui-0.1.0rc1.tar.gz 270.4 kB With provenance Details for streamlit_a2ui-0.1.0rc1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-a2ui 0.1.0rc1
File Interpreter ABI Platform Actions
streamlit_a2ui-0.1.0rc1-py3-none-any.whl Python 3 none any Details for streamlit_a2ui-0.1.0rc1-py3-none-any.whl

Total release size: 551.3 kB

Release files / streamlit_a2ui-0.1.0rc1.tar.gz

Download URL streamlit_a2ui-0.1.0rc1.tar.gz
Size 270.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4c4f5c3d06513670b648e16f5a9bcf240c8f2c7f0cde989e7f4d08144ec0f995
BLAKE2b-256 checksum
How to use checksums
6833d37684edd34704709f76be0ed20d0527c6130ed6794ca0fffcc34a0bc950
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 18, 2026.

Transparency log

Release files / streamlit_a2ui-0.1.0rc1-py3-none-any.whl

Download URL streamlit_a2ui-0.1.0rc1-py3-none-any.whl
Size 281.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e376a871eec012c22462c08966ad4a038170aa3d734f92e4ad63c9911a91738b
BLAKE2b-256 checksum
How to use checksums
9d53dbe9188ebdd2b56b28b0d8cdee70db8f10b573c6bbe331660095eb4c4d81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 18, 2026.

Transparency log

Security for streamlit-a2ui 0.1.0rc1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for streamlit_a2ui-0.1.0rc1.tar.gz

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 Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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