How to Build an AI Calling Agent: Step-by-Step Guide

anil
November 20, 2026
How to build an AI calling agent shown as modular blocks assembling into a phone with sound waves

If you want to know how to build an AI calling agent, the good news is that you no longer need a research team. The pieces exist: phone connectivity, speech recognition, a language model, a voice. The hard part is choosing them well and wiring them so a real caller on a real Indian phone line has a smooth conversation. This step-by-step guide walks through that process from the first decision to the first live call.

We use a clinic appointment desk as the running example, but the same steps apply to sales qualification, payment reminders or customer support.

Step 1: Define one job for the agent

The most common mistake is building an agent that “handles all calls”. Start with one job that has a clear finish line.

  • Good: “Book, reschedule or cancel an outpatient appointment.”
  • Good: “Call new leads within five minutes and ask four qualification questions.”
  • Too vague: “Answer anything callers ask.”

Write down what success looks like (appointment booked, lead scored), what the agent must never do (give medical advice, promise discounts) and when it should hand over to a person.

Step 2: Choose inbound, outbound or both

Direction Example What you need
Inbound Patients call the clinic number Route your number or PBX extension to the agent
Outbound Agent calls patients to confirm tomorrow’s slot API or campaign tool to trigger calls, caller ID, retry rules
Both Agent answers calls and also runs reminders Same bot, two entry points

Outbound calling in India also brings telecom rules. TRAI’s framework separates promotional calls (140-series numbers, with registration under TCCCPR) from service and transactional calls (the 1600 series for regulated entities). Check with your operator which applies to your calls. Our AI outbound calling guide covers outbound design in more detail.

Step 3: Pick your stack

An AI calling agent has five layers. Decide each one deliberately.

  1. Telephony: a SIP trunk from an Indian operator, your existing Asterisk/FreePBX server, or an IP-PBX such as Panasonic, Avaya IP Office or Grandstream.
  2. Speech-to-text: pick by language. Sarvam, Google, Deepgram and self-hosted options differ a lot on Hindi, Tamil or Malayalam phone audio.
  3. Language model: a fast model for short, scripted calls; a stronger one for open conversations. See the LLM providers guide for the trade-offs between Groq, OpenAI, Gemini, Sarvam and local Ollama.
  4. Text-to-speech: a natural voice in your callers’ language that can stream audio.
  5. Orchestration: the gateway or framework that streams audio, detects when the caller has finished, handles interruptions and transfers.

Step 4: Write the system prompt

The prompt is your agent’s job description. For a voice agent, keep it specific and short-reply oriented.

You are the appointment assistant for Sunrise Clinic, Kochi. Speak in the caller’s language (English, Malayalam or Hindi). Keep every reply under two sentences. You can book, reschedule or cancel OP appointments using the tools provided. Always confirm the patient’s name, doctor and time before booking. Never give medical advice. If the caller is in an emergency, tell them to call 112 and transfer the call.

Prompt tips that matter on the phone:

  • Ask one question at a time.
  • Spell out how to read numbers, dates and times aloud.
  • Tell the agent never to read URLs or email addresses aloud.
  • Give it a polite fallback line for things it cannot do.

Step 5: Add tools and knowledge

A calling agent becomes useful when it can act, not just talk.

  • Tools: small functions the model can call, such as checkSlots, bookAppointment or createLead. Each needs a clear description of when to use it, because the model decides from that description.
  • Knowledge base: upload documents like doctor schedules, fee lists and FAQs so the agent can search them instead of you stuffing everything into the prompt.
  • Webhooks: send call outcomes to your CRM, HIS or Google Sheet when the call ends.

Step 6: Connect the phone line

This is where most do-it-yourself projects slow down. You need to get audio from the phone network to your AI and back, in real time.

Option A: SIP trunk

Point a SIP trunk (or a route on your PBX) at the voice gateway. The SIP trunk setup docs show the configuration, and our article on a SIP trunk AI voice agent explains the choices for Indian operators.

Option B: Asterisk or FreePBX

If you already run Asterisk, a single dialplan line sends a call to the AI over AudioSocket:

AudioSocket(${SESSION_UUID},127.0.0.1:8080)

You keep your existing numbers, queues and extensions, and only the calls you route reach the agent.

Option C: Browser or app

For testing, or for a “talk to us” button on your website, a browser widget or WebSocket connection lets people speak to the agent without a phone call.

Step 7: Test like a real caller

Do not test only from a quiet office on a good phone. Test the way your callers call.

  • Call from a mobile on a busy road and from a weak-signal area.
  • Switch languages mid-call.
  • Interrupt the agent while it is talking.
  • Give an unusual name, a landmark-based address, a wrong date.
  • Ask for a human.

Measure the gap between when you stop speaking and when the agent starts. If it feels slow, our voice AI delay fixes list the usual causes, from slow models to non-streaming TTS.

Step 8: Launch small and watch transcripts

Go live on a slice of calls first, such as after-hours calls or one department. Read transcripts daily for the first two weeks. Fix the prompt, add knowledge-base entries and tighten tool descriptions. Track three numbers: calls completed without a human, transfers, and cost per call.

Mistakes to avoid

  • Writing a prompt for chat and expecting it to work on the phone.
  • Skipping the read-back of names, dates and numbers before booking.
  • Launching without a transfer path to a human.
  • Choosing the speech provider by its English demo instead of your callers’ languages.

How VEXYL fits

VEXYL covers steps 3 to 8 without you writing the orchestration layer:

  • Agent brain: LiteBot holds your bots. Each bot is a system prompt, an LLM, tools (book appointment, webhook, lookup) and an optional knowledge base, built in a dashboard or a visual flow editor. Conversations, analytics and cost per turn are logged for review.
  • Phone connection: the VEXYL Voice Gateway accepts SIP trunks, Asterisk AudioSocket, FreePBX and documented IP-PBX vendors, plus a browser widget and APIs. It handles streaming STT and TTS, barge-in and transfer to a human.
  • Outbound: trigger single calls by API with per-call context, or run CSV campaigns with retries through the AI Auto-Dialer.
  • Deployment: self-host as a single binary or Docker, or use VEXYL Studio on VEXYL Cloud if you prefer not to manage servers.

The Developer edition is free and self-hosted with 4 concurrent calls, which is enough to build and test a full agent. You bring your own API keys for speech and LLM providers.

FAQ

How long does it take to build an AI calling agent?

A working prototype on a ready platform can take a day or two. A production agent with tools, tested prompts and proper handoff usually takes a few weeks, most of it spent on testing with real callers.

Can I make an AI calling agent for free?

You can build and test on free tiers: the VEXYL Developer edition is free, and some speech and LLM providers offer free credits. Real calls still cost telephony minutes and usually some API usage, unless you self-host speech and the LLM.

Do I need coding skills?

Basic setup through a dashboard needs little code. Custom tools that talk to your CRM or HIS need some JavaScript or a webhook to a tool like n8n.

Which LLM is best for an AI calling agent?

There is no single best. Prioritise response speed and tool-calling reliability over raw intelligence for most phone tasks, and test with your own scripts.

What does an AI voice agent builder need to support for India?

Indian-language STT and TTS, SIP trunks and PBXs used by Indian businesses, code-mixed speech, and a way to keep call data under your control for DPDP purposes.

Ready to build? Start with the free Developer edition, or book a call and we will help you scope your first agent.