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

# Document Collection with Outbound Calls

An automated outbound compliance voice agent acts on behalf of a bank (Omni Bank) to notify remote employees and global contractors of incoming foreign inward remittances, prompting them to declare Purpose Codes and upload invoices before funds are credited.

## What it does

- Dials account holders to notify them of incoming foreign remittances (e.g. $4,250.00 USD from Acme Global Corp)
- Clearly explains the regulatory requirement to submit Purpose Codes (such as P0802 for Software Consulting) and supporting invoices
- Answers recipient questions regarding Purpose Codes, portal navigation, and processing turnaround times
- Records structured delivery audit records with timestamps and recipient intent in `data/remittance_notifications.jsonl`
- Pre-connects the voice bridge during dialing for zero startup latency upon answering
- Respects full speech playback before hanging up cleanly

## This sample

**Omni Bank Compliance Assistant** on [AgentDuet](https://pypi.org/project/agentduet/1.0.0/) with **Gemini Live**. Full source: [agentduet-samples / document-collection](https://github.com/AgentDuet/agentduet-samples/tree/main/use-cases/document-collection).

**State flow:** Outbound `make_call()` → `dial()` with pre-connected voice bridge → `LIVE` compliance briefing → `confirm_notification_delivered` → `disconnect()`

## Prerequisites

- Python **3.12+**
- Get an API key and connector UUID at [agentduet.com](https://agentduet.com)
- Google Gemini API key (`GEMINI_API_KEY`) with Gemini Live access

## Tutorial

### Step 1: Clone the sample

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

### 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
AGENTDUET_SUBSCRIBER=+1XXXXXXXXXX      # Bank outbound caller ID
DESTINATION_NUMBER=+1XXXXXXXXXX        # Recipient phone number
GEMINI_API_KEY=your-gemini-api-key
GEMINI_MODEL=models/gemini-3.1-flash-live-preview
GEMINI_VOICE=Zephyr
SAMPLE_RATE=24000
```

### Step 4: Run

```bash
python main.py
```

### Step 5: Test the Compliance Flow

1. **Answer the Phone:** The agent greets warmly: *"Hi there! I'm calling from Omni Bank's remittance processing team regarding your incoming foreign remittance of $4,250.00 USD from Acme Global Corp. Do you have a quick moment?"*
2. **Confirm & Inquire:** Say *"Sure"* or *"What is it about?"*. The agent explains the need to submit Purpose Codes and invoices on portal.omnibank.com within 48 hours.
3. **Ask Questions:** Ask about Purpose Codes. The agent clarifies that Purpose Code P0802 applies to software consultancy and funds credit within 2 hours of upload.
4. **Acknowledge:** Confirm that you will submit the documents. The agent logs the acknowledgment, speaks its warm closing greeting, and disconnects cleanly.

## Key APIs

| Piece | Role |
|---|---|
| `session.make_call(Address.telco(number))` | Mints the outbound telephone leg |
| `call.dial(ring_time_seconds=25)` | Places outbound SIP call |
| `call.callee.audio_stream()` | Captures recipient microphone audio |
| `call.send_audio(chunk)` | Delivers synthesized agent voice |
| `call.clear_send_audio_buffer()` | Clears speech buffer on barge-in |
| `call.disconnect()` | Clean call hangup after completion |
| `data/remittance_notifications.jsonl` | Persistent audit trail of compliance delivery |

## Related

- [Voice AI Agent for Appointment Booking](/use-cases/voice-ai-agent-for-appointment-booking)
- [AI Receptionist with CRM Lookup](/use-cases/ai-receptionist-with-crm-lookup)
- [Feedback Collection with Outbound Calls](/use-cases/feedback-collection-with-outbound-calls)