> ## Documentation Index
> Fetch the complete documentation index at: https://fliqr.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Send rich responses from an AI Agent

> Instruct Fliqr AI Agents to return JSON that renders as buttons, quick replies, images, videos, carousels, and files across channels.

By default, Agents reply with plain text. With the right prompt, Fliqr AI converts structured JSON into rich messages — buttons, quick replies, media, carousels, and more — and adapts them per channel.

## Why rich responses matter

Text-only answers often dump links. Rich messages keep customers in the chat: tap a button, browse a carousel, or view an image inline.

<Note>
  Support varies by channel. Fliqr AI maps message types where possible; unsupported types fall back gracefully.
</Note>

## Instruct the Agent

Append strict JSON rules to your system prompt. Require a `messages` array using the Messenger-style message schema Fliqr AI understands.

```text theme={null}
You must always return responses as valid JSON.

Rules:
1. Include a "messages" array.
2. Each item contains a "message" object.
3. Supported types: text, text with buttons, quick_replies, images, videos, carousel (generic templates), files.
4. Return only valid JSON — no markdown fences or commentary outside JSON.
```

### Example: text + quick replies

```json theme={null}
{
  "messages": [
    {
      "message": {
        "text": "How can I help you today?",
        "quick_replies": [
          { "content_type": "text", "title": "Track order", "payload": "Track order" },
          { "content_type": "text", "title": "Talk to a human", "payload": "Talk to a human" }
        ]
      }
    }
  ]
}
```

## Rich messages + actions

You can combine rich output with tool use:

1. Agent calls a [function](/docs/core-concepts/ai-agents/functions-actions) or MCP tool
2. Agent formats the result as rich JSON (cards, buttons)
3. Fliqr AI renders the message on the channel

Keep one responsibility clear in the prompt: fetch data with tools, then format the customer-facing JSON.

<Tip>
  Always include a concrete JSON example in the prompt. Models follow examples more reliably than abstract schema descriptions.
</Tip>

## Test checklist

* Playground returns parseable JSON only
* Buttons/quick replies appear on a real channel test
* Fallback text exists if JSON parsing fails
* Handover still works when the user asks for a human

## Next

<CardGroup cols={2}>
  <Card title="Prompt engineering" icon="pen-nib" href="/docs/core-concepts/ai-agents/prompt-engineering">
    Broader prompt patterns, including JSON output.
  </Card>

  <Card title="Human handover" icon="headset" href="/docs/core-concepts/ai-agents/human-handover">
    Route out when rich AI replies are not enough.
  </Card>
</CardGroup>
