Package-level declarations
Types
Where AgentComputerScaffold shows the agent's computer.
What the agent's computer view shows (Manus-style): which reply, which step, whether it follows the live run, and a replay in progress. Create with rememberAgentComputerState; Chat and Conversation make one when none is provided.
Where the agent's run stands, for surfaces outside the chat (notifications, widgets, a watch): derived from the conversation's model alone, whatever protocol produced it.
A tool an agent can call; schema is its JSON input schema, if shown.
The library's own FileProvider, so opening a file never collides with the app's provider.
App-wide overrides for how parts render — the extension point for customising the chat without forking Conversation or the message rows. Provide it with CompositionLocalProvider(LocalAiElementsRenderers provides AiElementsRenderers(...)).
Renders a fenced code block of one language (``` ```lang ```) in place of the code view. */
Renders one data part in place of the built-in DataPartView shapes.
Loads the bytes behind a file URL for attachment previews (data: URLs are decoded without it). Replace it to use your app's HTTP stack, cache or authentication.
What a model can do; shown as small tags.
A model offered by ModelSelector; provider groups the list, contextWindow is in tokens.
A destination for OpenInChat; {q} in urlTemplate is replaced by the encoded prompt.
What the user answered: chosen option ids and/or their own text.
A choice in a Question; id is what QuestionAnswer.selected reports.
Plays a reply's run back from its recorded events, at their original pace, when a recording exists — e.g. AG-UI's event log (AgUiEventLog.replayOf in ai-elements-core). The flow's events are folded into a fresh reply as they arrive, exactly as a live run is.
Progress of a plan / task / chain-of-thought step.
"Stick to bottom" for a chat list (the idea behind AI Elements' use-stick-to-bottom), for a normal top-to-bottom LazyListState:
Renders one tool call in place of the built-in ToolCall / Subagent. The decision callback carries approval, denial reason, edited arguments and remember choice. A null callback means read-only rendering: do not show approval actions. Respect ToolPart.approvalAnswers when offering edits or a reason.
One step of a plan, task or chain of thought; badges are short tags such as files or URLs.
Properties
The chat apps OpenInChat offers by default; pass your own list to change them.
Whether a tool call is a delegation to a sub-agent (render it with Subagent).
The agent's computer view of the enclosing AgentComputerScaffold.
Functions
What this call is doing, for people ("Running command · ls -la"), for surfaces outside composition (notifications, widgets).
An agent's definition (AI Elements <Agent>): name and model, its instructions, the tools it may call (each expands to its schema) and the shape of its output. Also renders a remote agent's card (e.g. A2A): pass its description and its skills as tools with toolsTitle.
The agent's computer: the selected step as the agent saw it — its screenshot, a terminal for a command, the diff of an edit, the file it read, the page it fetched (ToolPart.category) — with a timeline to scrub, step or play through, "back to live" while the reply streams, and a replay of the recorded run when there is one (RunReplay).
Lays out content (a conversation) with the agent's computer view of state: by default (AgentComputerLayout.Auto) a side pane next to it when there is room (at least 720dp, as Material 3's supporting pane on expanded widths), a bottom sheet otherwise. The width is the scaffold's own, so it adapts inside a list–detail layout too; an app that has an adaptive scaffold of its own hosts the panel there (AgentComputerLayout.Hosted).
Full-screen WorkflowCanvas of one agent run.
The steps of message: each tool call with the image files that follow it (a screenshot of what the call did — AI SDK file parts, AG-UI media tool results, on-device tools' files), whatever protocol produced them.
The assistant's expressive "sparkle" avatar; spins while streaming.
A whole assistant message in one composable (for non-virtualized lists); Conversation renders replies block by block instead.
Pending attachments above the composer (AI Elements <PromptInputAttachments>), each removable.
A multi-step reasoning trace (AI Elements <ChainOfThought>): a vertical timeline of steps with status, descriptions and result badges.
A complete chat screen body: the Conversation (streaming Markdown, tools and approvals, sub-agents, plans, branches, checkpoints) above a PromptInput with stop and queueing, all wired to controller. With voiceMode (and speech recognition on the device), the send button of an empty input starts a VoiceMode conversation. Wrap it in AiElementsTheme; add your own buttons to the input with toolbar.
Empty-conversation hero: a slowly turning expressive shape, a greeting and suggestions. Pass showHero = false on short windows (phone landscape).
A restore point between turns (AI Elements <Checkpoint>): a divider with a "Restore" action that rewinds the conversation to here, after confirming.
Bottom sheet listing cited sources, each opening in the browser.
Human-in-the-loop approval (AI Elements <Confirmation>): what the agent wants to do, with approve / deny actions. Null callbacks render read-only. With onDecide the user can also deny with a reason or edit the call's JSON input before approving (AG-UI approve-with-edits, AI SDK reason); pass a null input or withReason = false where the backend cannot carry them.
Token / context-window usage (AI Elements <Context>): a compact chip that opens a breakdown. With contextWindow it shows how full the window is.
The scrolling message list (AI Elements <Conversation>).
A document in a message (an artifact the agent made or a file it read): its type and name, with the first page and page count for a PDF. Tapping a PDF opens PdfViewerDialog; other formats (Word, Excel, PowerPoint, …) open in an app that can show them.
A file part inside a message: images, videos and audio inline; documents (PDF preview, others open in an app).
An image from a FilePart (AI Elements <Image>): decodes data: URLs and fetches http(s) URLs off the main thread, downsampled to maxDecodePx.
An image full screen, on black: pinch to zoom, drag to pan, double-tap to zoom in or back, and rotate a quarter turn at a time (for images whose orientation is wrong at the source).
An inline citation badge (AI Elements <InlineCitation>): the first source's host plus "+N" for the rest; tapping opens the cited sources.
The agent (or a tool's server) asks the user for something: a form built from the request's JSON Schema, a link to complete out of band, or a plain confirmation. Protocol-neutral — the same card answers an AG-UI interrupt and an MCP elicitation.
file as a file in the app's cache: data: URLs decoded, http(s) and content: URLs loaded (through loader, the app's LocalFileLoader); file: URLs as they are.
Renders any Message: a bubble for the user, a full-width part list for the assistant.
Pick a model (AI Elements <ModelSelector>): a chip showing the current model opens a searchable sheet grouped by provider, with capability tags and context window per model.
Opens file in an app that can view it (the user's PDF reader, WPS / Office for documents, …), the mobile way to show formats without an in-app renderer. Returns false when no app can.
Continue a prompt in another assistant (AI Elements <OpenIn>), or hand it to any app through the Android share sheet.
A PDF full screen: every page, pinch to zoom, and "Open with" for a full reader.
A URI the platform media stack can open for file: http(s), content: and file: URLs as they are; a data: URL is written to the app's cache once (media players cannot read it).
The composer (AI Elements <PromptInput>): a roomy rounded field with a toolbar row. The submit button morphs into a spinning cookie-shaped stop button while a reply is streaming.
The agent asks the user something (AI Elements <Question>): one or several of options, and/or a free-text answer when allowOther. Once answered, the card shows the answer read-only.
Prompts waiting for the agent (AI Elements <Queue>). Each can be removed; when the queue is paused (after stop or an error) each can be sent now.
Collapsible "thinking" block. Opens automatically while the model reasons and collapses to "Thought for Ns" when it's done — like AI Elements' <Reasoning>.
A ChatController kept for as long as this composition: for prototypes and previews. In an app, create the controller in a ViewModel (with viewModelScope) so the conversation survives configuration changes, and pass it to Chat.
Remembers a StickToBottomState for listState; install its connection with Modifier.nestedScroll.
A form for a flat JSON Schema object (MCP elicitation's restricted schema, AG-UI responseSchema): text (with format email / uri / date), numbers with minimum / maximum, booleans, single choices (enum, oneOf / anyOf of {const, title, description}) and multiple choices (arrays of those, minItems / maxItems). A choice whose anyOf also allows a plain {"type": "string"} offers the user's own answer ("Other"), as Pydantic AI Harness AskUser questions do. Choices with descriptions or an own answer show as a list, others as chips. Defaults pre-fill; required fields must be set before submitting.
Text with a sweeping highlight, used for in-progress labels ("Thinking…").
"Used N sources" with a row of link chips (AI Elements <Sources>).
One step as the agent saw it, by what the call did: its screenshot (in a browser frame when it acted on a web page), a terminal for a command, a diff for an edit, the file or matches it read, the page text it fetched, else its output.
A delegated agent run (the sub-agent pattern): who was asked, what they were asked to do, and their live work — reasoning, tool calls (approvable in place) and answer — nested under the delegating tool call.
Prompt suggestion chips (AI Elements <Suggestions>), wrapping across lines.
A unit of agent work (AI Elements <Task>): a collapsible title with the items done so far; file names render as monospace chips.
A tool invocation card (AI Elements <Tool>): tool name, a status pill, and an expandable section with the JSON input and the output / error. While the call awaits approval it shows a Confirmation with approve / deny actions.
A user message: attachments above a right-aligned bubble.
A video in a message: its first frame, duration and a play button; tapping plays it full screen (platform VideoView, with the system media controls).
Plays file full screen with the platform player and media controls.