agent library

Agent chat surfaces for Remix.

Experimental. This library is outside Remix's stability promise: its API may change in any release, including minor and patch releases, until it is declared stable. package:remix/remix.dart does not export it.

It owns the structure and the behavior of an agent conversation; presets supply the look as registry recipes. Import it beside package:remix/remix.dart, which provides the base widgets and stylers.

Public API names

Models:

Behavior: AgentLiveEdgeController, AgentLiveEdgeScrollPhysics and AgentLiveEdge; AgentDisclosurePolicy and AgentDisclosureController; AgentComposerController; AgentApprovalGuard; AgentRunClock; AgentAnnouncer and AgentAnnouncement.

Widgets, each with a spec and a generated styler, and empty visual defaults: AgentConversation with AgentTurn, AgentMessage, AgentSteps, AgentToolCall (the row and the approval card), AgentAnswer, AgentSources, AgentSuggestions and AgentComposer. They draw no icons: each names an AgentGlyph for an AgentGlyphBuilder, supplied per widget or by AgentGlyphs, whose AgentToolIconBuilder can choose a leading icon by tool name. AgentToolRenderers registers a renderer per tool name.

Screen-reader announcements are wired by the host: AgentAnnouncer decides what to announce, but no widget calls it. See AgentAnnouncer.

Still to come: AgentMarkdown and AgentCodeBlock, with the AgentFenceBuilder and AgentCodeHighlighter hooks.

A tool call's data is AgentToolCallPart, so AgentToolCall names its widget alone.

Classes

AgentActivityItem
One row in an activity ledger.
AgentAnnouncement
One transition worth telling a screen reader about.
AgentAnnouncer
Decides which Agent transitions a screen reader hears, once each.
AgentAnswer
The assistant's answer: a body, its sources and an actions bar.
AgentAnswerSpec
Resolved visual properties for an AgentAnswer.
AgentAnswerStyler
AgentApprovalGuard
Accepts one decision per approval request.
AgentComposer
The prompt input of a conversation: a growing text field over a toolbar with the host's actions and Send, which becomes Stop while a run is live.
AgentComposerController
The draft behind an Agent composer, with the rules for sending it.
AgentComposerSpec
Resolved visual properties for an AgentComposer.
AgentComposerStyler
AgentConversation
The scrolling transcript of an Agent conversation.
AgentConversationSpec
Resolved visual properties for an AgentConversation.
AgentConversationStyler
AgentDataPart
Host data the conversation renders with a registered builder.
AgentDisclosureController
The open state of one collapsible Agent surface.
AgentDisclosurePolicy
When a collapsible Agent surface opens and closes on its own.
AgentGlyphs
Supplies the glyphs of the Agent widgets below it.
AgentLiveEdge
Connects the scrollable that builder returns to a live edge.
AgentLiveEdgeController
Keeps a scrollable at its live edge while output grows, and lets the reader leave it.
AgentLiveEdgeScrollPhysics
Keeps a following scrollable at its end during the layout that grew it.
AgentMessage
One message of a conversation: the reader's bubble or the assistant's reply.
AgentMessagePart
One piece of an Agent message's content.
AgentMessageSpec
Resolved visual properties for an AgentMessage.
AgentMessageStyler
AgentPlanItem
One row in a task plan.
AgentRunClock
Measures how long a run worked, for "Thought for 6s".
AgentSource
A file, page or document an answer refers to.
AgentSources
The sources an answer refers to, as one line that opens a list.
AgentSourcesPart
The sources an answer refers to, such as "2 files referenced".
AgentSourcesSpec
Resolved visual properties for AgentSources.
AgentSourcesStyler
AgentStep
One step of a run: something the agent read, found or did.
AgentSteps
The steps of a run: one line that summarizes them, over a rail that lists them.
AgentStepsPart
The steps of a run, shown as "Thought for 6s ยท 3 steps" once it settles.
AgentStepSpec
Resolved visual properties for one step on the rail of AgentSteps.
AgentStepsSpec
Resolved visual properties for the line and the rail of AgentSteps.
AgentStepsStyler
AgentStepStyler
AgentSuggestion
A prompt offered to start or continue a conversation.
AgentSuggestions
Suggested prompts, such as the starters of an empty conversation.
AgentSuggestionsSpec
Resolved visual properties for AgentSuggestions.
AgentSuggestionsStyler
AgentTextPart
Text the assistant wrote, usually markdown.
AgentToolCall
One tool call, changing in place through its lifecycle.
AgentToolCallPart
One call to a tool: its input, its lifecycle and its result.
AgentToolCallSpec
Resolved visual properties for an AgentToolCall: the row, the output well and the approval card.
AgentToolCallStyler
AgentToolRenderers
Registers a renderer per tool name for the AgentToolCalls below it.
AgentTurn
One turn of an AgentConversation: the reader's message and the blocks the assistant replied with, spaced by the conversation's AgentConversationSpec.blockSpacing.

Enums

AgentActivityItemStatus
Status of one row in an activity ledger.
AgentAnnouncementKind
What an AgentAnnouncement reports.
AgentAnswerFeedback
The reader's verdict on an answer.
AgentAnswerStatus
Status of a streamed answer.
AgentApprovalDecision
The reader's decision on a tool call that needs approval.
AgentExecutionStatus
Status of a tool execution disclosure.
AgentGlyph
A functional glyph an Agent widget asks its host to draw.
AgentPermissionStatus
Status of an in-transcript tool permission.
AgentPlanItemStatus
Status of one item in a task plan.
AgentRole
Who authored a transcript row.
AgentRunStatus
Status of a turn or a run of steps.
AgentStepStatus
Status of one step in a run.
AgentToolCallStatus
The lifecycle of one tool call.
AgentWorkPhase
Where a piece of Agent work is in its lifecycle.

Typedefs

AgentGlyphBuilder = Widget? Function(BuildContext context, AgentGlyph glyph, IconSpec spec)
Draws glyph with the slot's resolved icon spec, or returns null to draw nothing.
AgentLiveEdgeBuilder = Widget Function(BuildContext context, ScrollController scrollController, ScrollPhysics physics)
Builds the scrollable an AgentLiveEdge drives.
AgentShimmerBuilder = Widget Function(BuildContext context, Widget child)
Wraps the steps line in a shimmer while the run works.
AgentStepsLabelBuilder = String Function(AgentRunStatus status, int steps, Duration? duration)
Builds the steps line from the run's status, its number of steps and, once it settles, how long it worked (duration, null when unknown).
AgentToolIconBuilder = Widget? Function(BuildContext context, String name, IconSpec spec)
Draws a tool's leading icon from its name and resolved spec. Returning null falls back to AgentGlyph.tool.
AgentToolInput = ({String label, String value})
One labelled input value of a tool call, such as Command and flutter test.
AgentToolRenderer = Widget Function(BuildContext context, AgentToolCallPart call)
Renders one tool's calls as a host widget, from the call's input, output, result and status.