Document Collection with Outbound Calls

View as Markdown

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 with Gemini Live. Full source: agentduet-samples / document-collection.

State flow: Outbound make_call()dial() with pre-connected voice bridge → LIVE compliance briefing → confirm_notification_delivereddisconnect()

Prerequisites

  • Python 3.12+
  • Get an API key and connector UUID at agentduet.com
  • Google Gemini API key (GEMINI_API_KEY) with Gemini Live access

Tutorial

Step 1: Clone the sample

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

Step 2: Install

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

Step 3: Configure .env

$cp .env.example .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

$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

PieceRole
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.jsonlPersistent audit trail of compliance delivery