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

# The AI chat agent

> How your agent answers questions, looks up data, and knows when to hand off.

Your agent is the heart of EmaDesk. It answers customer questions using everything you have given it: your knowledge base, your tables, and your API tools. You can try it in the live preview on the **Configuration** page before it goes live.

<Frame>
  <img src="https://mintcdn.com/emadesk/W6r7hMim7OVGPBK1/images/ai-chatbot/01-chat-preview-working.png?fit=max&auto=format&n=W6r7hMim7OVGPBK1&q=85&s=3ceef2f6b41fa6d0a7241313c7ed42ac" alt="Agent answering in the live preview" width="1920" height="1009" data-path="images/ai-chatbot/01-chat-preview-working.png" />
</Frame>

## How it answers

On every message, the agent decides how best to respond:

<CardGroup cols={3}>
  <Card title="From knowledge" icon="book-open">
    Retrieves the most relevant passages from your docs and answers with sources.
  </Card>

  <Card title="From tables" icon="table">
    Looks up a matching row, for example an order by its ID, and uses it in the reply.
  </Card>

  <Card title="From APIs" icon="plug">
    Calls one of your connected endpoints to fetch live data or take an action.
  </Card>
</CardGroup>

### Look up structured data

When a question maps to a table, the agent queries it and answers from the row it finds.

<Frame>
  <img src="https://mintcdn.com/emadesk/W6r7hMim7OVGPBK1/images/ai-chatbot/02-chat-table-query.png?fit=max&auto=format&n=W6r7hMim7OVGPBK1&q=85&s=e06c5b479e503ea905245b244577a3c7" alt="Agent answering from a table lookup" width="1920" height="1009" data-path="images/ai-chatbot/02-chat-table-query.png" />
</Frame>

### Combine sources

The agent can combine knowledge and data in a single answer, drawing on documents and a table lookup together.

<Frame>
  <img src="https://mintcdn.com/emadesk/W6r7hMim7OVGPBK1/images/ai-chatbot/03-chat-rag-and-table-lookup.png?fit=max&auto=format&n=W6r7hMim7OVGPBK1&q=85&s=18c01c8339d37ba544bb684621f38aa2" alt="Agent combining knowledge and table lookup" width="1920" height="1009" data-path="images/ai-chatbot/03-chat-rag-and-table-lookup.png" />
</Frame>

## Handing off to a human

When a conversation needs a person, the agent offers to connect the visitor to your team. It never transfers silently. Once the visitor confirms, the chat is routed to your support team and appears in the [Inbox](/inbox).

<Tip>
  Shape how the agent behaves, including when it escalates, from the **Agent** tab in [Configuration](/configuration).
</Tip>
