> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.agentduet.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.agentduet.com/_mcp/server.

# AI Receptionist with CRM Lookup

An intelligent voice receptionist answers incoming telephone calls, looks up caller identity in CRM records, delivers personalized greetings with context from open tickets, creates new leads for first-time callers, and logs call intents.

## What it does

- Identifies incoming callers in real-time using caller ID and CRM lookup
- **Known Customers:** Greets patients by name, surfaces open support or billing tickets, and provides tailored assistance
- **New Callers:** Automatically provisions new lead records and prompts for contact details
- Answers general clinic questions (operating hours, location, services, and department directory)
- Records structured caller intent (`billing`, `sales`, `support`, `general`) to persistent audit logs
- Immediately clears audio playback buffers on caller barge-in
- Concludes calls with a professional closing greeting and hangs up cleanly

## This sample

**Meridian Clinic AI Receptionist** on [AgentDuet](https://pypi.org/project/agentduet/1.0.0/) with **Qwen Omni Realtime** and **CRM backend** (Local JSON or live Pipedrive). Full source: [agentduet-samples / ai-receptionist](https://github.com/AgentDuet/agentduet-samples/tree/main/use-cases/ai-receptionist).

**State flow:** `NEW → LIVE` (`answer()`) → Qwen Omni bidirectional voice loop + CRM lookup → `disconnect()` / `close()`

## Prerequisites

- Python **3.12+**
- Get an API key and connector UUID at [agentduet.com](https://agentduet.com)
- Alibaba Cloud DashScope API key (`DASHSCOPE_API_KEY`) for Qwen Omni Realtime
- Optional: Pipedrive API token and company domain for live CRM sync

## Tutorial

### Step 1: Clone the sample

```bash
git clone https://github.com/AgentDuet/agentduet-samples.git
cd agentduet-samples/use-cases/ai-receptionist
```

### Step 2: Install

```bash
python3.12 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```

### Step 3: Configure `.env`

```bash
cp .env.example .env
```

```env
AGENTDUET_API_KEY=your-connector-api-key
AGENTDUET_CONNECTOR_UUID=your-connector-uuid
DASHSCOPE_API_KEY=your-dashscope-api-key
DASHSCOPE_REGION=intl
COMPANY_NAME="Meridian Clinic"
CRM_BACKEND=json

# Optional Pipedrive settings
# PIPEDRIVE_API_TOKEN=your-pipedrive-token
# PIPEDRIVE_COMPANY_DOMAIN=your-company
```

### Step 4: Run

```bash
python main.py
```

### Step 5: Place a call and test

1. **Known Customer Test:** Call from a number configured in `data/customers.json`. The receptionist recognizes you by name and mentions your open tickets.
2. **New Caller Test:** Call from an unregistered number. The receptionist welcomes you, creates a new lead entry in `data/leads.json`, and asks for your name.
3. **General Inquiries:** Ask about clinic hours or services. The assistant answers immediately and logs your classified intent to `data/reception_calls.json`.

## How it works

When an inbound call arrives, the agent queries the CRM backend by caller telephone number. If a customer profile is found, historical context (name, open tickets, preferred department) is injected into the model's system prompt before the call is answered. During the conversation, Qwen Omni processes 24 kHz audio bidirectionally and invokes structured tools to fetch tickets, update lead details, and record call intents.

## Key APIs

| Piece | Role |
|---|---|
| Qwen Omni Realtime | Low-latency speech-to-speech dialogue and function calling |
| CRM Backend | Customer lookup, ticket retrieval, and lead management |
| `call.caller.audio_stream()` | Captures caller microphone audio |
| `call.send_audio(chunk)` | Delivers synthesized receptionist voice |
| `call.clear_send_audio_buffer()` | Zero-latency barge-in interruption handling |
| `data/reception_calls.json` | Persistent structured audit log of call outcomes and intents |

## Related

- [Qwen Omni Integration](/integrations/qwen-omni)
- [Voice AI Agent for Appointment Booking](/use-cases/voice-ai-agent-for-appointment-booking)
- [Feedback Collection with Outbound Calls](/use-cases/feedback-collection-with-outbound-calls)
- [Document Collection with Outbound Calls](/use-cases/document-collection-with-outbound-calls)