Skip to main content

a2ui-chart-strands

Agent-side A2UI chart producer for @haystackedai/a2ui-chart-react clients.

This package does not wrap your runtime — bedrock, agentcore, strands and your own business logic stay yours. It packages the one reusable, hard part: the A2UI chart (richer than a hand-rolled one, validated against the shared catalog). You keep your agent and add a few lines where you already build the response — mirroring how a React dev drops in useA2UIChart + A2UIChartView without wrapping their server.

from a2ui_chart_strands import Chart, a2ui_frame, version_frame

chart = Chart()                                   # once (baked contract)

# in your existing entrypoint, where YOUR pipeline already produced the data:
rows, columns, answer = my_pipeline(prompt)       # your biz logic, untouched
yield a2ui_frame(chart.surface(rows, columns, answer))

# the UI's chart-type toggle:
if action and action["name"] == "rechart":
    yield a2ui_frame(chart.rechart(action["context"]["plotType"]))

# the contract-version handshake the client fires on mount:
if action and action["name"] == "version":
    yield version_frame(chart.version())

No a2ui-core wiring, catalog assembly, surface-message building or validation to write. Dependencies are only a2ui-core + pydantic — nothing about your runtime.

The contract

The contract — catalogId + the plotType vocabulary + the series shape + the version — is the one thing this agent and the React client must byte-match. It is not fetched from the client at runtime; both sides are generated independently from a single source (A2UI_catalog_src/*.json) by a generator you run before every deploy.

The package ships a DEFAULT_CONTRACT baked from the contract/ modules, so pip install → Chart() just works for a smoke test. The shipped versions are deliberate mock placeholders (MOCK.*.regen-before-deploy) — your pre-deploy generator overwrites them with the real, matching versions in both the client and this agent. Deploy without regenerating and the client's handshake fails loudly (chart input disabled) by design.

A deployment with its own catalog overrides everything via a custom Contract:

from a2ui_chart_strands import Chart, Contract
chart = Chart(contract=Contract(catalog_id=..., control_model=..., datashape_model=...,
                                control_version=..., datashape_version=...))

Layout (separation of concerns)

Grouped to mirror the React client (entry / render / transport), plus a first-class contract concern (the agent bakes a default; the client injects one):

src/a2ui_chart_strands/
  __init__.py          public surface (barrel)
  entry/    chart.py        the Chart drop-in
  render/   catalog.py · surface.py · drill.py    catalog build, series shaping + validation, drill prompt
  transport/frames.py       a2ui / version / trace wire frames the gateway forwards
  contract/ __init__.py + chart_control.py · chart_datashape.py · contract_version.py   the baked, overridable default

Each concern's module docstring is the detailed guide; entry/chart.py documents the two insertion points and the drill/rechart/version handling.

Metadata

Release files for a2ui-chart-strands 0.9.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 a2ui-chart-strands 0.9.0
File Size Uploaded Provenance
a2ui_chart_strands-0.9.0.tar.gz 64.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for a2ui-chart-strands 0.9.0
File Interpreter ABI Platform
a2ui_chart_strands-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 81.5 kB

Release files / a2ui_chart_strands-0.9.0.tar.gz

Download URL a2ui_chart_strands-0.9.0.tar.gz
Size 64.0 kB
Tags Source
SHA-256 checksum
How to use checksums
be1c2d3cd2355225badad013ae78454b1c990847f75d1f74a739b4c6af2f086b
BLAKE2b-256 checksum
How to use checksums
c400d49a0ff82916cfab0ab394fefeb7f48d41ee6133413f129e25c53a160788
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / a2ui_chart_strands-0.9.0-py3-none-any.whl

Download URL a2ui_chart_strands-0.9.0-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd1161d80ac92c74b355ccc03717226eca586ba5909732c895ec27256bc977b5
BLAKE2b-256 checksum
How to use checksums
78443c67bdec67a693196a574ea15abd307c6638b2639de1f9e77f72c2d9e740
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Security for a2ui-chart-strands 0.9.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files No provenance

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