RemixRemix
Agent surfaces

Answer

An answer body with optional sources and host-owned copy, feedback, and retry actions.

An answer body with optional sources and host-owned copy, feedback, and retry actions.

The widgets live in experimental package:remix/agent.dart, outside Remix's stability promise. Import it explicitly; package:remix/remix.dart does not export it. The registry installs editable preset recipes and their dependencies into your app. Widget, model, and styler names keep the Agent prefix. Recipe names use your app's prefix.

Install

For a new app, initialize one preset, then add the recipe and glyphs:

remix init --prefix Ui --preset fortal
remix add answer_recipe agent_glyphs_recipe

Existing apps keep their chosen preset. All three presets provide the same recipe roles. No consumer build.yaml is needed for these Agent recipes.

Behavior

Provide the rendered body through child and set status to streaming, complete, or error. The body is never a live region. Actions appear after streaming when their callbacks are supplied. The host owns clipboard writes, feedback state, retries, and announcements.

Pass AgentSources through sources. A new streaming run resets its disclosure. Use an id that identifies the answer and pass feedback back after onFeedback reports a change.

Use the recipe

This example assumes prefix Ui and the installed UiTheme above the widget. Wrap the conversation in AgentGlyphs(builder: uiAgentGlyph, child: ...) to draw preset glyphs.

import 'package:flutter/widgets.dart';
import 'package:remix/agent.dart';
import 'ui/ui.dart';

Widget buildAnswer() {
  final recipe = uiAgentAnswerRecipe();
  return AgentAnswer(
    id: 'answer-1',
    status: AgentAnswerStatus.complete,
    style: recipe.style,
    actionStyle: recipe.actionStyle,
    selectedActionStyle: recipe.selectedActionStyle,
    child: const Text('All checkout tests pass.'),
  );
}

The recipe returns these unresolved styles. Pass each into its matching widget parameter; child controls resolve hover, focus, and disabled state in their own context.

Bundle fieldStyle type
styleAgentAnswerStyler
actionStyleIconButtonStyler
selectedActionStyleIconButtonStyler

Each factory merges same-named overrides after its preset defaults. Edit the installed recipe to customize it. remix add answer_recipe --diff previews upstream differences. See migration for the previous registry API.

View page source on GitHub

On this page