For the complete documentation index, see llms.txt. This page is also available as Markdown.

Agent Reply Modes and Structured Output Fields

Maps Agent reply modes (replyMode) to their names in the admin console, and explains the combination rules and response shape for the structured output fields outputMode and rawOutputFormat.

The replyMode, outputMode, and rawOutputFormat fields in GET/PATCH /api/v1/chatbots/{id}/ determine how an Agent responds. For field types, refer to the API documentation for AI Assistants. This page explains what the values mean and which combinations are allowed.

Reply Mode Mapping

The following table maps the names shown under “Reply Mode Settings” in the admin console to API replyMode values. replyMode does not control streaming versus synchronous responses; streaming is determined by isStreaming in the completions request.

Admin console name

replyMode

Behavior

Agent mode (the default for new Agents)

agent

The model decides what to retrieve and which tools to call, and can execute multiple steps. Tools, Code Interpreter, databases, skills, MaiGPT connectors, and Agent UI are available only in this mode

RAG Q&A

normal

Retrieves from the knowledge base once per message before responding. See RAG Knowledge Base Retrieval System

Template (other modes)

template

Responds by category based on the knowledge base and FAQ, rather than letting the model generate responses freely

Hybrid (other modes)

hybrid

Uses a template format for some content and generates the rest freely

The legacy workflow value has been retired. For how existing Agents are handled, see Retirement of the Built-in Workflow Reply Mode. For instructions on configuring each mode, see the user manual: Create an Agent: Choose a Suitable Reply Mode.

Structured Output

Field
Values
Description

outputMode

text (default)/json_schema

json_schema means every reply is JSON that conforms to rawOutputFormat

rawOutputFormat

JSON Schema object or null

The structure that replies must conform to. Use "type": "object" at the top level and specify type and description for each field. The schema is validated on save; an invalid JSON Schema returns 400

Combination constraints:

  • These fields take effect only when replyMode is normal (RAG Q&A). Agent mode ignores both fields.

  • The model must support structured output. Each model returned by GET /api/v1/large-language-models/ has an outputMode array listing its supported values; only models whose array includes json_schema can use it. If the “Output Format” field is not visible in the admin console, the current model or reply mode does not support it.

  • When outputMode is json_schema, rawOutputFormat cannot be null. When switching back to text, you can keep the existing schema, but it will not take effect.

Response Shape

Structured output does not change the outer response structure: content in completions and message objects remains a string containing JSON text that conforms to the schema. Parse it yourself (JSON.parse, json.loads). Because the entire reply must be generated before it can be validated, when isStreaming: true, SSE contains only one event with done: true, and content contains the complete JSON. See Cases Where Streaming Does Not Occur. Web Chat displays this JSON as text, so Agents using structured output are typically accessed only through the API.

If the model generates content that does not conform to the schema (rare, and usually due to insufficient model capabilities), the reply is still sent as text, and the platform does not return an error code. If parsing fails, have your application fall back to human handling, or switch to a model with better support.

Last updated

Was this helpful?