> ## 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.

# AI Agents: LLM-Powered Conversational Automation in Fliqr AI

> AI Agents use a language model to interpret any message and respond based on a system prompt, knowledge base, and function calls — no script required.

When a contact asks something you did not anticipate, a scripted Flow has no path to follow. AI Agents solve that problem by replacing the explicit script with a language model that reads the contact's message, reasons about it, and generates a contextually appropriate reply. This page explains how Agents work, how to configure one, and how to integrate it with the rest of Fliqr AI.

## Overview

An AI Agent is a runtime configuration that wraps a language model with:

1. **A system prompt** — instructions that define the agent's role, constraints, and output format.
2. **A knowledge base** — documents, URLs, or text the model can retrieve to answer factual questions.
3. **Custom User Fields (CUFs)** — per-contact data the model reads and writes during the conversation.
4. **Function calls (tools)** — actions the model can invoke, such as looking up an order or updating a field.
5. **A fallback Flow** — the Flow that takes over when the Agent cannot handle a request.

Unlike a Flow, an Agent does not branch on conditions you pre-define. It decides at runtime how to respond, which makes it capable of handling requests you never explicitly programmed.

## Supported Models

Fliqr AI supports the following models. Each has different latency, capability, and cost characteristics:

| Provider      | Models                                             |
| ------------- | -------------------------------------------------- |
| **OpenAI**    | GPT-4o, GPT-4o mini, o3-mini                       |
| **Google**    | Gemini 1.5 Flash, Gemini 1.5 Pro, Gemini 2.0 Flash |
| **Anthropic** | Claude 3 Haiku, Claude 3 Sonnet                    |
| **DeepSeek**  | DeepSeek (reasoning-optimized)                     |

You can switch the model per Agent without changing the system prompt. Use a lighter model (GPT-4o mini, Gemini 1.5 Flash) during development to reduce token costs, then evaluate a more capable model before going live.

## Agent Components

<Tabs>
  <Tab title="System Prompt">
    The system prompt is the primary lever for controlling Agent behavior. A well-structured prompt follows this pattern:

    1. **Role** — state who the agent is and what company it represents.
    2. **Constraints** — what the agent must not do (e.g., "never discuss competitor pricing," "always respond in the user's language").
    3. **Output format** — how responses should be structured.

    **Example (plain-text response):**

    ```
    You are Aria, a customer support agent for Fliqr AI.
    Your job is to answer questions about pricing, integrations, and account settings.
    Never provide specific revenue figures or internal roadmap dates.
    Keep responses under 120 words. Respond in the same language the user writes in.
    ```

    **Example (structured JSON response with quick replies):**

    ```
    Respond with a single strict JSON array containing one message object.
    The message must include a text field and a quick_replies array with 4 options.
    Each quick reply must have matching title and payload values.
    ```

    Instructing the Agent to return structured JSON lets Fliqr AI render the response as quick-reply buttons, cards, or carousels — without a Flow.
  </Tab>

  <Tab title="Knowledge Base">
    The knowledge base gives the Agent access to information beyond its training data. You can add:

    * **URLs** — Fliqr AI crawls the page and indexes the content.
    * **YouTube video links** — the platform extracts and indexes the transcript.
    * **Uploaded documents** — PDF, DOCX, or plain text files.
    * **Manual text entries** — paste content directly into the editor.

    At runtime, the Agent performs a semantic search over the knowledge base before generating a reply, allowing it to cite accurate, up-to-date information from your own content.

    <Note>
      Knowledge base entries are not injected wholesale into the context window. The platform retrieves the most relevant chunks based on the contact's message, keeping token usage proportional to query complexity.
    </Note>
  </Tab>

  <Tab title="Functions">
    Functions (also called tools) are actions the Agent can call during a conversation. Fliqr AI provides built-in functions and supports custom ones via HTTP:

    **Built-in functions:**

    * Set a Custom User Field value
    * Apply or remove a tag
    * Transfer the conversation to a human agent
    * Trigger a Flow

    **Custom functions (HTTP):**
    Define a function name, description, and JSON Schema for the parameters. The Agent decides when to call it based on the conversation context. The HTTP endpoint receives the parameters and returns a result the Agent incorporates into its reply.

    <Tip>
      Write function descriptions in plain English, as if explaining to a person when to use the tool. The model reads these descriptions to decide whether and when to call each function.
    </Tip>
  </Tab>
</Tabs>

## Agent vs. Flow: When to Use Each

| Scenario                                    | Recommended approach |
| ------------------------------------------- | -------------------- |
| Fixed lead qualification questions          | Flow                 |
| Open-ended product Q\&A                     | AI Agent             |
| Appointment booking with strict validation  | Flow                 |
| Multi-turn troubleshooting                  | AI Agent             |
| Payment confirmation (exact steps required) | Flow                 |
| General FAQ with a knowledge base           | AI Agent             |

## How to Create an Agent

\[SCREENSHOT: AI Agent editor showing system prompt, model selector, and knowledge base tabs]

<Steps>
  <Step title="Navigate to AI Agents">
    In the left sidebar, click **AI Agents**, then click **Create New Agent**.
  </Step>

  <Step title="Name your Agent and select a model">
    Give the Agent a descriptive name (e.g., "Support Agent — Tier 1"). Select the LLM model from the dropdown. If you are unsure, start with GPT-4o mini or Gemini 1.5 Flash.
  </Step>

  <Step title="Write the system prompt">
    In the **System Prompt** tab, write instructions following the role → constraints → output format pattern. Be explicit: the model follows your instructions literally, so vague prompts produce inconsistent results.
  </Step>

  <Step title="Add a knowledge base (optional)">
    Switch to the **Knowledge Base** tab. Click **Add Source** and provide a URL, upload a file, or paste text. Fliqr AI indexes the content and makes it available to the Agent automatically.
  </Step>

  <Step title="Configure functions (optional)">
    In the **Functions** tab, enable any built-in functions you need or add a custom HTTP function with its JSON Schema. Write a clear description for each so the model knows when to invoke it.
  </Step>

  <Step title="Test in the playground">
    Click **Open Playground**. Send test messages that represent real user inputs. Verify that the Agent responds within your constraints, uses the correct language, and invokes functions at the right moments.
  </Step>

  <Step title="Assign or trigger the Agent">
    To make the Agent the default responder for a channel, go to **Settings → Channels**, select the channel, and set this Agent as the **Default Agent**. To trigger it from a specific point inside a Flow, use the **AI Agent** block and select this Agent by name.
  </Step>
</Steps>

## Structured JSON Output

Agents can return structured JSON responses that Fliqr AI renders as interactive UI elements — quick-reply buttons, cards, carousels, and image galleries. To enable this, instruct the Agent in the system prompt to respond in a specific JSON schema.

This approach lets a single Agent drive rich, interactive conversations without a Flow, while still benefiting from the model's ability to handle any input.

<Warning>
  Agents consume tokens with every message exchange. A long conversation with a large knowledge base can accumulate significant token usage. Monitor your consumption in **Settings → AI Usage** and set monthly budget alerts to avoid unexpected charges.
</Warning>

<Tip>
  Start your system prompt with the agent's role, then add constraints, then specify the output format. This order mirrors how a human would brief a new team member and produces the most consistent results.
</Tip>

## What's next

<CardGroup cols={2}>
  <Card title="AI Agents overview" icon="grid-2" href="/docs/core-concepts/ai-agents">
    Nested guides for setup, tools, multimodal, and handover.
  </Card>

  <Card title="Create an Agent" icon="robot" href="/docs/core-concepts/ai-agents/create-agent">
    Step-by-step: provider, prompt, files, and activation.
  </Card>

  <Card title="Functions & MCP" icon="bolt" href="/docs/core-concepts/ai-agents/functions-actions">
    Call APIs and attach MCP servers for live data.
  </Card>

  <Card title="Flows" icon="diagram-project" href="/docs/core-concepts/flows">
    Combine scripted Flows with AI Agents.
  </Card>
</CardGroup>
