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

# Chat Agents

> Run agents over text — configure, test, supervise live, and integrate through the API

Chat agents are the same idea as voice agents — a prompt, a model, knowledge, tools — running over text instead of audio. Use them for in-product support, lead capture, or any text channel your own system connects to Osvi over the API, and share a [public chat link](https://docs.osvi.ai/platform/public-chat.md) to try one without writing any code.

## Creating a chat agent

Create one from **Agents → New agent** by choosing **Chat Agent** as the mode. Configuration mirrors voice agents — system prompt (single or multi prompt), LLM provider and model, [knowledge base](https://docs.osvi.ai/platform/knowledge-base.md) attachments, and memory — minus everything audio-specific. The [prompt writing guide](https://docs.osvi.ai/platform/prompt-writing.md#writing-for-voice-vs-chat) covers how chat prompts should differ from voice prompts.

New chat agents start **inactive**. Use **Launch** on the agent's page once it's configured, and **Stop** to take it offline again.

## The agent tabs

| Tab | What it configures |
| - | - |
| **Agent** | The system prompt (or prompt tree for multi-prompt agents), and a built-in test panel — see [Testing in the playground](#testing-in-the-playground). |
| **Tools** | Agent tools (**Request human help**, **Knowledge base search**) and the operator commands (**Whisper**, **Tell**, **Takeover**), plus any custom or library tools you attach. |
| **LLM** | Model provider, model, and generation parameters, plus the knowledge base attachment. |
| **Memory** | State fields the agent tracks during the conversation. |
| **Advanced** | **Smart Nudges** (re-engage a silent customer), **AI Auto-Resume** (rescue a stranded support session), and **Pattern Rules** (trigger actions on message text). |
| **Settings** | The agent's description, its delivery configuration (below), and archiving. |
| **Evals** | Scenario tests and runs for the agent — see [Test Agent Before You Deploy](https://docs.osvi.ai/platform/evals.md). |

## Testing in the playground

The **Agent** tab includes a live chat panel — send messages and see the agent reply without leaving the page. **New session** drops the current test session on your screen (it stays open on the backend, so you can pick it back up), and **Operator** opens the same support console you'd use on a real customer session, letting you rehearse whisper, tell, and takeover before you go live. An **Add input fields** option lets you preview how prompt variables (like a customer's name) change the agent's first reply.

## Sessions

A conversation with a chat agent is a **session**: it belongs to one customer (identified by a `customer_id` you choose), keeps the full message history, and carries metadata you pass in — form fields, account context, prior interaction summaries.

Sessions have a **status** — `active`, `dormant` (quiet for a while), or `closed` — and a **mode**:

* **`ai`** — the agent responds autonomously.
* **`support`** — a human operator is involved.

Start with [Create Session](https://docs.osvi.ai/api-reference/endpoint/chat/create_session.md), or skip it — sending a message with no `session_id` resolves or creates the customer's active session automatically. [Inject context](https://docs.osvi.ai/api-reference/endpoint/chat/inject_context.md) mid-conversation to steer the agent (for example, a summary of a phone call that just happened).

### Two ways to send a message in

* **Synchronous** — [Send Message](https://docs.osvi.ai/api-reference/endpoint/chat/send_message.md) (`POST /v1/chat/inbound`) blocks until the agent's reply is ready and returns it in the same response. Simplest to integrate, but your caller has to hold the connection open for the length of a turn.
* **Async (callback)** — [`POST /v1/chat/inbound/async`](https://docs.osvi.ai/api-reference/endpoint/chat/inbound_async) acknowledges the message immediately, then delivers the reply later to the **Delivery URL** configured on the agent (Settings tab) — see [Delivery webhook](https://docs.osvi.ai/api-reference/endpoint/chat/delivery_webhook.md) for the payload. Use this for a gateway that can't (or shouldn't) hold a request open, or when a human operator might take longer than your customer's connection allows. A Delivery URL is required to use this endpoint.

Which endpoint you call is what decides delivery — there's no per-request flag to switch between them.

### The browser WebSocket path

For a first-party web or in-app chat surface, connect directly instead of polling: request a short-lived session token, then open a WebSocket to stream the conversation in both directions — one stream for the visitor, a separate one for an operator console. This is what Osvi's own [public chat pages](https://docs.osvi.ai/platform/public-chat.md) and operator console use. See the [Chat WebSocket guide](https://docs.osvi.ai/api-reference/chat-websocket.md) for the connection details.

## Human-in-the-loop support

Chat agents are built for supervised operation. The agent's own **Request human help** tool (Tools tab) flags a session **help requested** — when the customer asks for a person, or the agent decides it's out of its depth — and operators step in through [support commands](https://docs.osvi.ai/api-reference/endpoint/chat/support.md):

| Command | What it does |
| - | - |
| **Whisper** | Coach the AI privately — the agent incorporates your guidance, the customer never sees it. |
| **Tell** | Send a message to the customer through the AI; the reply comes back directly in the API response. |
| **Takeover** | Switch the session to support mode — you respond, the AI stands down, until you send **`/end`** to hand it back. |

Each command is toggled independently in the agent's **Tools** tab, under **Operator commands**; closing a session (`/close`) is always available.

Chat agents don't place outbound calls or schedule follow-ups on their own — that cross-channel coordination now lives in [Journeys](https://docs.osvi.ai/platform/journeys), which can call, message, or follow up with a customer based on how a conversation went.

## Interactive UI elements

A chat agent can reply with more than text: quick-reply **buttons** (optionally with an "Allow typed answer" free-text option), a **carousel** of items with images, and a **date picker** (single date or a range) instead of asking the customer to type one out. Configure these as tools in the **Tools** tab, either with fixed content or content the model fills in per turn. Osvi's [public chat pages](https://docs.osvi.ai/platform/public-chat.md) render all three natively; a custom gateway can render them itself from the same structured payload.

> [!NOTE]
>
> Interactive UI elements aren't publicly released yet. Until they are, contact [support@osvi.ai](mailto:support@osvi.ai) to have them enabled for your workspace.

## Reviewing and supervising sessions

**Conversations → Chat** is the session log, with stat tiles — active sessions, sessions in range, total session days, help requested, and AI vs human — and filters for agent, status, mode, customer ID, and **help requested**, effectively your support inbox.

Opening a session shows the full message thread with timestamps, the session's metadata, and its current mode, so an operator has full context before stepping in.

> [!TIP]
>
> Watch the *help requested* filter during your first weeks live. The sessions where customers asked for a human are your best source of prompt improvements — each one is a conversation the agent should eventually handle alone.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.