Skip to content

Interface: UseMastraChatOptions

Options for useMastraChat.

optional agentId?: string

Agent to converse with. Defaults to the Mastra plugin’s registered default agent (clientConfig().defaultAgent).


optional enableExport?: boolean

Enable chat export. Off by default (opt-in). When on, the header shows an “Export” menu for the whole conversation and each assistant bubble shows a per-message export menu. Both offer PDF (via the browser print dialog) and Markdown; charts and data tables are inlined into the export so it renders reliably offline.


optional enableFeedback?: boolean

Surface per-message feedback controls (thumbs up/down + a comment popover) that log to MLflow as trace assessments.

Defaults to whatever enableExport is (feedback and export are the two “quality loop” affordances, so turning on export opts into feedback too); pass an explicit true / false to override. Regardless of this flag, controls only actually render when the server reports MLflow logging is enabled (clientConfig.feedbackEnabled) and the turn produced a trace id - so enabling it on a deployment without MLflow tracing is a safe no-op.


optional enableThreads?: boolean

Enable built-in conversation (thread) management: the chat tracks a client-selected thread id, persists it across reloads, lists the resource’s conversations, and renders a sidebar to switch between them / start new ones / delete them. On by default. Set false for the classic single-thread chat anchored to the per-session cookie (no sidebar, no thread tracking).

Shorthand for threadPlacement: false is "disabled". When both are passed, enableThreads: false wins.


optional showModelPicker?: boolean

Surface the built-in model picker in the header, letting the user override the serving endpoint per turn (via X-Mastra-Model). Off by default so the drop-in renders a clean single-model chat; when false the model catalogue isn’t even fetched.


optional suggestions?: string[]

Starter questions shown as one-tap buttons on the empty state. When omitted, the drop-in auto-sources them from the agent’s Genie space sample questions (via the plugin’s /suggestions endpoint); when the agent has no Genie space the empty state stays bare. Pass an explicit list to override that lookup, or [] to force no suggestions.


optional threadPlacement?: ThreadPlacement

Where conversation management renders: "left" / "right" dock the list to that edge, "top" shows the open conversations as an editor-style tab strip with a history menu, "disabled" turns thread management off, and the default "auto" picks "left" while the chat is wide enough for a side panel and "top" once it gets too narrow for one (measured on the chat’s own width, so an embedded panel decides on its own space).