Dograh

How to Build an AI Collections Agent, Step by Step in Dograh

How to Build an AI Collections Agent, Step by Step in Dograh
TutorialDecember 4, 2026·13 min read

How to Build an AI Collections Agent, Step by Step in Dograh

Pritesh Kumar
Pritesh Kumar·Co-founder, Dograh AI

Building Dograh, the open-source alternative to Vapi. OSS and Voice AI. Exit founder and YC alum.

To build an AI collections agent, load the account before the call, confirm identity before any detail, play the notices as fixed text, send payment links so no card number is spoken, route disputes to people and set calling hours. Collectors can build it on Dograh, the open-source AI voice agent platform, and self-host it or use Dograh Cloud.

Key Takeaways

  • Treat dispute and stop paths as core paths, since disputed debts lead complaints.
  • Keep card numbers off the call and let your payment system send a link.
  • In Dograh, notices play as fixed Transition Speech, never words the model writes.

Here we build a collections agent step by step in Dograh, from an empty agent to a running campaign. Each step names the screen, the setting and the rule behind it, and the build ends with test calls and where the call records are kept.

What you need before you start

Everything below matches the published Dograh docs, and a trial server is the place to run it before production. The build is for a collection agency calling consumers under Regulation F. A creditor collecting its own debts sits under different rules, covered in our post on first-party collections, and EU callers are covered in our post on GDPR rules for collection calls.

  • An endpoint you run that looks up an account by phone number and returns only the fields the call needs.
  • A payment system that can send a consumer a secure payment link by text or email when asked.
  • An endpoint that records disputes, stop requests and attorney details on the account.
  • Call wording your counsel has approved. Our debt collection call script templates give a starting set, and this post shows where each line goes.

What the rules decide in the build

Rules shape the agent more than the prompt does, so it helps to see which setting each one drives. Start with disputes. In the CFPB's Consumer Response Annual Report for 2025, the bureau received about 387,400 debt collection complaints, and the most common issue was attempts to collect debt not owed. So the dispute path gets built with the same care as the payment path.

Regulation F drives most settings below. The identity check exists because a collector does not discuss the debt with anyone else. The notices sit on a fixed edge because the initial communication, letter or call, and every later one need set wording. The campaign's calling window follows the rule that calls before 8 a.m. or after 9 p.m. at the consumer's location are presumed inconvenient. Seven calls in seven days per debt is the presumed call limit, and no call should follow within seven days of a phone conversation about that debt. A written dispute in the validation period pauses collection of the disputed part.

The FCC's ruling on AI-generated voices treats an AI voice as an artificial voice under the Telephone Consumer Protection Act (TCPA). The call needs the consent those rules require, and it names the business at the start and gives a number. States add their own notices, covered in our post on compliance-safe collection disclosures. None of these settings makes a call compliant on its own, so have counsel confirm your wording, notices and call limits before the first campaign.

Step 1: Plan the account data and the endpoints

Decide what the agent may know before you build anything. Your lookup endpoint should return the consumer's first name, the identity check value, the balance, the plan options your rules allow and a flag for first contact or follow-up. Leave out everything the call does not use, since the agent receives the whole reply.

Then plan three writes, each an endpoint on your side. One asks your payment system to send a link. One records a dispute, a stop request, an attorney or a hardship note on the account. One receives the call outcome after the call. Keep each request small and named, so the agent's tools stay easy to read.

Check: calling your lookup endpoint with a test number returns only the fields above, and an unknown number returns an empty result rather than an error.

Step 2: Create the first-contact and follow-up agents

Describe each call in plain language to the Agent Builder. It runs on Dograh's models, so a self-hosted install connects to a free Dograh account to use it. Check Your agent requirements, then choose Approve & build or Request changes, and fine-tune the flow on the canvas, where edits save as drafts.

Build two agents, one for first contact and one for follow-up calls, because the notice wording differs between them. Build the first one completely, then use Duplicate Workflow in the editor header and change only the notice on the copy. Your system decides which list each consumer goes on, based on whether any communication has already reached them.

Check: both agents appear under Voice Agents, and the follow-up agent differs from the first only in its notice.

Step 3: Fix the greeting and load the account

The opening is a legal line, so make it fixed text. In the Start Call node, set Greeting Type to Text (TTS) and write a Greeting Text that names your business in the form your counsel approves and asks for the consumer by name, with nothing about a debt. Use a fallback for the name, such as {{initial_context.first_name | there}}, so a missing value is never spoken as a blank. Turn Allow Greeting Interruption off so it plays in full.

At the bottom of the Start Call node, set Pre-Call Data Fetch to Outbound calls only. It sends a POST with the caller's details to an endpoint you run, which looks the consumer up and returns the fields from Step 1. The greeting waits for the reply, so keep the lookup fast.

Check: in the Variables tab, set direction to outbound, start a test, and the greeting uses the test consumer's first name.

Step 4: Build the identity check with two edges

Identity comes before any detail of the account. Add an Agent Node named Identity whose prompt asks the person to confirm their date of birth or the last digits of their account number, and compares the answer with the fetched value. Tell it never to mention the debt, the balance or the company's business before a match.

Draw two edges out of it. The first has the Condition "the person confirmed their identity and it matches" and leads to the payment step. The second has the Condition "this is not the person, or the details do not match" and leads to End Call, with Transition Speech that ends politely and says nothing about why you called. Taking an edge is the model reading its Condition, so test it with near-miss dates until no wrong answer gets through.

Check: a test with a wrong date of birth reaches End Call, and the transcript contains no word about the account.

Dograh

Open Source Alternative to Vapi / Retell

Self-hosted voice agent platform — no per-minute fees

dograh-hq/dograh

Star on GitHub

Step 5: Put the notices on the identity edge

Notices must be said the same way on every call, and only fixed text guarantees that. Put the first-contact notice, that the call is an attempt to collect a debt and any information obtained will be used for that purpose, in the Transition Speech of the identity-confirmed edge. On the follow-up agent, that edge says the call is from a debt collector.

Transition Speech plays fixed text or a recorded clip. Text lines play on agents with separate speech and language models, so an agent on a speech-to-speech model needs a recording of the notice instead. Take the exact wording from your counsel. A notice written into a node's prompt gets reworded by the model on every call.

Check: the identity-confirmed path plays the notice word for word in three test runs in a row.

Step 6: Offer payment without taking card numbers

The payment step never hears a card number. Recordings and transcripts are kept for every call, and PCI Security Standards Council guidance says to keep card data out of the phone environment where possible. So the agent agrees the amount and date, and your payment system does the rest.

A three-panel comic. On a call, after the identity check, the voice agent reads back the amount and date and the consumer says yes, with the call's recording and transcript below. Next the agent's tool asks the agency's payment system to send a secure link by text or email. Last, the consumer at a kitchen table sees the link on their own phone, with their card beside it and the card number kept off the call.
A card number said aloud on a collections call would end up in the recording and transcript the agency keeps as evidence. Letting the agency's own payment system deliver the link keeps that number out of both.

Add an Agent Node named Payment. Its prompt offers only the plan options from the fetched account, reads back the amount and date the consumer picks and waits for a yes. Our post on payment plan calls covers how to word the offer.

Then give the node an HTTP API tool that asks your payment system to send its secure link by text or email. Add a Preset Parameter named workflow_run_id with {{initial_context.workflow_run_id}}, so your system never sends two links for one call. Set a short line in the tool's Messages under When the tool starts, so the consumer hears something while the request runs. The tool waits 5 seconds by default and does not retry by itself, so tell the prompt what to say if it fails.

Check: a test payment ends with one link sent by your payment system and the amount and date read back, with no card digits in the transcript.

Step 7: Route disputes, stop requests and attorneys

These paths decide whether the agent is safe to run, so give each one a written rule. Tell the Payment node's prompt to stop collecting the moment the consumer disputes the debt, asks you to stop calling, names an attorney or describes hardship. For each, an HTTP API tool writes the flag to the account before anything else happens.

Then the call goes to a person or ends. Transfer Call works on Twilio, Telnyx, Plivo, Cloudonix and Asterisk ARI. Dograh calls the destination first and connects the consumer only when someone answers. Use Context Mapping to send disputes to the disputes team and hardship to the hardship team, with a fallback. If nobody answers within the Transfer Timeout, 30 seconds by default, the transfer returns "transfer_failed" and the agent books a callback through an HTTP API tool.

A stop request ends the call with a short confirmation and no further pitch. Turn on call dispositions under Settings, General, keep do_not_call and callback_requested, and add custom codes such as dispute_raised, cease_requested, attorney_represented and hardship.

Check: test runs for each of the four phrases write the right flag, reach the right team or end the call, and record the right disposition.

Step 8: Set voicemail to a limited message

Voicemail is where a collector most easily tells a third party about a debt. In the agent's Settings, open Voicemail & Screening and turn on Enable voicemail and screening handling. When voicemail is detected starts on Disconnect the call, and a message plays only if you choose Leave a message. It applies to outbound calls on agents with separate speech and language models.

If you leave a message, keep it to a limited-content message under Regulation F. It names the business with a name that does not show it collects debts, asks for a call back, names a person to contact and gives a number. Template 6 in our scripts post follows that shape. Anything more risks telling whoever plays the voicemail what the call is about.

Check: a test call to your own voicemail leaves the approved message and nothing else.

Step 9: Set calling hours and retries in the campaign

The campaign is where calling hours and call counts are set. Upload a CSV with a phone_number column, plus the columns your agent uses, and pick the first-contact or follow-up agent. Dograh's guide to campaigns covers the file rules.

Turn Call Schedule on. Without time slots, a started campaign dials continuously. Each campaign runs its Call Schedule in one Timezone. It starts on your browser's time zone, or your last scheduled campaign's, so set it to your callers' zone. Then add Time Slots inside 8 a.m. to 9 p.m. for that zone, and split a national list into one campaign per time zone.

Under Enable Retries, set Max Retries, Retry Delay (seconds) and Retry On yourself rather than keeping what the page shows. A campaign counts retries within itself only, so your own system keeps the seven-in-seven count and the seven-day pause after a conversation, per consumer and debt, and leaves capped consumers off the next list. The Circuit Breaker pauses the campaign if too many calls fail in a window.

Check: the campaign's Timezone shows the consumers' zone, its Time Slots sit inside the allowed hours, and the retry numbers are the ones you chose.

Join the Dograh Community

Dograh is an OSS alternative to Vapi. Join our Slack community for queries, releases, best practices & community interactions.

Step 10: Test every path, then start small

Walk every path before a consumer hears one. In the Variables tab, set direction to outbound and fill in the account fields, then use Test Chat for a wrong date of birth, a dispute, "stop calling me", an attorney, hardship and a bad time to talk. Then run a one-row campaign to your own phone, because transfers only run on phone calls.

Add a QA Analysis node so every call gets a score and tags for each node. Ask its prompt to flag any call where account details came before the identity match or the notice was missing. QA runs on test calls and on live calls, and a Sample Rate below 100 picks calls at random.

Then start with the lowest-risk calls. MaxContact's deployment playbook argues for early reminders and promise-to-pay confirmations first, with disputes, distress and vulnerable consumers sent to people. Read the transcripts and dispositions of the first campaign before you widen it.

Check: every Test Chat path ends where you designed it, and QA flags none of your test calls.

Keeping call records on your own servers

Every call leaves a recording and a transcript, and for a collector those are evidence. You can self-host Dograh so recordings sit in storage you control, next to the account system. On a self-hosted install, recording can be switched off only server-wide, and transcripts are still saved.

Self-hosting has no per-minute platform fee, but servers, model keys and phone minutes still cost money. Your team looks after the database and upgrades. Dograh Cloud runs the platform for a 1¢-a-minute platform fee instead.

Glossary

Limited-content message
A Regulation F voicemail that names a business without showing it collects debts, asks for a call back, names a person and gives a number.
Validation period
The window after a consumer gets validation information. A written dispute inside it pauses collection of the disputed part until verification is sent.
Transition Speech
Fixed text or a recording that plays when the call takes an edge in Dograh. It is where notices go, because the model cannot reword it.
Context Mapping
A Transfer Call setting that matches a value the agent gathered, such as dispute or hardship, to a destination team, with a fallback.

Frequently Asked Questions

Get started with Dograh

Build, deploy, and scale AI agents with Dograh. Join the community of developers building the future.