Card is a provider-neutral card document. The distribution compiles it into the provider’s native
rich surface — Slack Block Kit, Teams Adaptive Cards, Google Chat cards, and similar.
Import
All public symbols are re-exported from the package root:Creation Modes
Card supports three mutually exclusive creation modes.
Inline JSX
Pass a pre-rendered JSX string when you already have the document:Remote URL
Pass a URL when the card document is hosted remotely:Builder
Pass atitle and chain .add() calls to compose the card from typed components:
jsx and url are mutually exclusive — passing both raises ValueError.
In builder mode the JSX is rendered lazily when the card is serialized.
Card Reference
| Parameter | Description |
|---|---|
title | Card heading rendered as the title attribute on the root <Card> element. Builder mode only. |
jsx | Pre-rendered JSX string. Mutually exclusive with url. Must not be empty. |
url | URL of a remotely hosted card document. Must start with http:// or https://. Mutually exclusive with jsx. |
| Property | Type | Description |
|---|---|---|
jsx | str | None | The JSX representation. Returns None for URL cards. |
url | str | None | The remote URL. Returns None for inline and builder cards. |
| Method | Returns | Description |
|---|---|---|
.add(child) | Card | Append a component and return self. Builder mode only — raises ValueError when called on a jsx= or url= card. |
Components
Components are building blocks for builder-mode cards. Each implements.to_jsx() -> str.
Text
A prose block inside the card body.
Fields and Field
Fields groups compact labeled values. Field is one labeled key-value pair inside a Fields group.
Divider
A horizontal rule, typically placed between the body and the Actions section.
Button
An interactive control. Use id for server-side callbacks, url for links. The two are mutually
exclusive.
| Parameter | Description |
|---|---|
label | Visible text on the button. |
id | Callback identifier sent to the agent when clicked. Mutually exclusive with url. |
url | URL to open when clicked. Mutually exclusive with id. |
style | Optional visual style hint, e.g. "primary" or "danger". |
Actions
Groups Button controls at the bottom of the card.
Full Example
Transport
When passed tothread.reply() or thread.post(), the SDK converts the card to an A2A
TaskStatusUpdateEvent whose message contains a single file part and
extensions: ["https://docs.aion.to/a2a/extensions/aion/distribution/cards/1.0.0"].
- Inline cards (
jsx=or builder):rawbytes (base64 in JSON),filenamederived fromtitle(e.g.deployment-approved.card.jsx), orcard.jsxwhen no title is set. - URL cards:
urlfield only, noraworfilename.