Documentsagenta
Chat Message Components
Chat Message Components
Type
Topic
Status
Published
Created
Jul 9, 2026
Updated
Jul 9, 2026
Created by
Dosu Bot
Updated by
Dosu Bot

Chat Message Components#

Agenta uses a layered set of React components to render chat messages across three distinct surfaces: the Playground (prompt configuration and live generation), Evaluations, and general-purpose chat input/display. The components share a common ChatMessage / ChatRole type contract but differ significantly in their responsibilities — from simple readonly display to fully interactive message editing with state-driven playground integration.

Core Types#

ChatMessage and ChatRole (defined in web/oss/src/lib/Types.ts) are the shared primitives used throughout all chat message components:

  • ChatRole enum: system, user, assistant, function
  • ChatMessage: { role: ChatRole, content: string, id?: string }

Component Overview#

ComponentLocationContext
ChatInputsweb/oss/src/components/ChatInputs/ChatInputs.tsxGeneral-purpose editable/readonly message list
EvaluationChatResponseweb/oss/src/components/Evaluations/EvaluationCardView/EvaluationChatResponse.tsxRead-only evaluation result display
PromptMessageConfigweb/oss/src/components/Playground/Components/PromptMessageConfig/Full message editor for prompt configuration
GenerationChatRowweb/oss/src/components/Playground/Components/PlaygroundGenerations/assets/GenerationChatRow/index.tsxLive generation output in playground

ChatInputs#

ChatInputs is the lowest-level reusable component. It renders a list of ChatMessage objects as role-selector + textarea pairs, with +/− controls to add/remove messages. Key behaviors:

  • Supports both controlled (value) and uncontrolled (defaultValue) usage
  • The readonly prop disables all editing controls (role selector, content area, add/remove buttons) simultaneously
  • Error state: messages whose content starts with receive a distinct red background
  • A copy button floats over the last assistant message
  • Exported helper getDefaultNewMessage() generates a fresh user message with a UUID

Used as the rendering primitive by EvaluationChatResponse.


EvaluationChatResponse#

EvaluationChatResponse wraps ChatInputs in read-only mode to display a single variant's chat output inside the Evaluation Card view. It:

  • Parses outputText with safeParse to extract .content from a JSON-encoded assistant message
  • Renders a VariantAlphabet badge and color-coded variant name with the revision number
  • Passes a single hardcoded assistant role message to ChatInputs with readonly

Props: variant, outputText, index, showVariantName, evaluation.


PromptMessageConfig#

PromptMessageConfig is the richest of the chat message components. It is the per-message editor inside the Playground's prompt configuration panel and supports three rendering modes based on message type :

  1. Standard message — role dropdown + Lexical-based SharedEditor for message content
  2. Tool/function call — displays function name input and JSON argument editor
  3. Function output — renders function call results

It consumes the usePlayground hook for bidirectional state synchronization, meaning edits are propagated into centralized playground state without manual prop threading . The component is wrapped by PromptMessageConfigWrapper, which sets up the Lexical editor provider and handles JSON vs. plain-text content detection.

Prop types extend BaseContainerProps and SharedEditorProps , and expose callbacks for deleteMessage, rerunMessage, and handleChange .


GenerationChatRow / GenerationChatRowOutput#

GenerationChatRow manages the chat conversation history for live generation runs in the Playground. It reads history items from centralized state via usePlayground and renders each turn using GenerationChatRowOutput, which in turn delegates to PromptMessageConfig for message display.

Notable behaviors:

  • Supports both single and comparison view modes — comparison view collapses gaps between messages
  • Handles per-variant run results via __runs[variantId] on history items
  • Tool messages (role tool) are not re-runnable
  • The withControls prop enables run/cancel and "Add Message" buttons below the history
  • Uses dynamic import for GenerationResultUtils to avoid SSR issues

Component Hierarchy#

ChatInputs ← standalone editable/readonly list
└── used by EvaluationChatResponse ← readonly evaluation display

PromptMessageConfig ← Lexical editor, playground state
└── used by GenerationChatRowOutput
    └── used by GenerationChatRow ← history loop + run controls
        └── used by Playground views

  • PromptMessageContentOptions — action menu (delete, re-run, minimize) integrated inside PromptMessageConfig
  • VariantAlphabet — color-coded letter badge used in evaluation display
  • GenerationResultUtils — token/latency metadata rendered as a footer inside GenerationChatRowOutput
Chat Message Components | Dosu