The voice agent starter

How to build a Vapi voice agent that books calls

The 11-tool schema, the n8n webhook wiring, and the booking flow from a voice agent running in production — plus why the agent goes silent for 20-30 seconds mid-call and what that silence actually costs you.

Maksym BondarenkoSystems & Automation Engineering, Azuro AILast updated
11-tool scheman8n + Vapi + Cal.comReal production incident

A production Vapi voice agent is four moving parts: the assistant on Vapi that handles speech, a webhook into an orchestrator like n8n that runs the logic, a set of function tools the model can call mid-call, and a calendar that owns availability. The agent never books directly. It asks your backend to book.

Most voice-agent tutorials stop at "the agent answers the phone." That part is easy now. The part that takes the time is everything after the caller says something you have to act on: checking a calendar that already has meetings in it, writing the caller down somewhere you can find them again, telling the owner it happened, and hanging up cleanly. This page skips the five-layer skeleton (that's in the agent blueprint) and spends its words on the Vapi-specific parts: the tools schema, the import scripts, the conflict check, and the knowledge base — plus the two failures that actually cost time in production.


What is a Vapi voice agent actually made of?

Four parts, and they belong to different owners.

   Caller
     |  phone number
     v
+--------------+   webhook   +-----------------+
|     Vapi      |----------->|  n8n workflow    |
|  (the voice:  |<-----------|  (the logic:     |
|   STT, model, |   result   |   one branch per |
|   TTS, tools) |            |   tool call)     |
+--------------+            +--------+---------+
                                      |
                 +--------------------+--------------------+
                 v                    v                    v
         +--------------+    +--------------+    +--------------+
         |   Cal.com     |    | Twilio / SMTP |    |   Supabase    |
         | (availability |    | (tell the     |    | (contacts +   |
         |  + conflict   |    |  owner)       |    |  call logs)   |
         |  check)       |    +--------------+    +--------------+
         +--------------+
                                      |
                                      v
                             +--------------+
                             | BetterStack   |
                             | (errors only) |
                             +--------------+

Vapi owns the conversation. Your orchestrator owns the decisions. The calendar owns the truth about time. Keep those three separated and the thing stays debuggable; collapse them and you will not be able to tell a bad transcription from a bad booking.

How do you give a Vapi agent tools?

You define them once in a schema file and push them to Vapi's /tool store, then attach their IDs to the assistant. The agent in production runs eleven tools in three groups.

GroupTools
Caller record (3)createCallerRecord, updateCallerRecord, flagForOwner (escalate to a human)
Calendar (5)getCalendarAvailability, bookCalendarEvent, searchCalendarEvents, rescheduleCalendarEvent, cancelCalendarEvent
Knowledge (3)searchKnowledgeBase (a Vapi-native query tool, not a function tool), company_info, contracts_agreements

The split matters more than the names. function tools and query tools both live in Vapi's /tool store and are keyed by function.name. Non-function tools like endCall and transferCall do not — they go on the assistant's own model.tools array. Miss that distinction and you get the failure further down this page.

Why can't the Vapi CLI bulk-import tools?

Because vapi tool create is interactive only. There is no file-import or bulk flag, so eleven tools means eleven dashboard sessions — and no version control over any of them. The fix is to skip the CLI and talk to the REST API directly. Three scripts, each with one job:

ScriptDoesMethod
import-vapi-tools.mjsFirst-ever import. Creates tools that don't exist yetGET /tool to list, POST /tool per tool, then PATCH /assistant/:id to append the new IDs to model.toolIds
update-vapi-tools.mjsDay-two sync. Edits live tools in place from the schema fileGET /tool to map name to id, PATCH /tool/:id per tool
enable-vapi-assistant-request.mjsMoves the phone number from a static assistant to a dynamic onePATCH /phone-number/:id, swapping assistantId for server.url
Two details worth copying

The import script skips what already exists. It lists live tools first and refuses to create a duplicate, so re-running it after adding one new tool to the schema touches only that tool. Without the check, a second run gives you eleven duplicates and an assistant that calls the stale copies.

type is immutable on PATCH. The update script sends everything except type. Include it and the request fails.

The dynamic-assistant script ships a --revert. Moving a phone number to assistant-request means every inbound call now asks your webhook which assistant to use. If that branch is not live, every call hits a webhook that cannot answer. The script restores the static binding with one flag, which is the difference between a bad deploy and a dead phone line.

How does the booking flow avoid double-booking?

By never letting the agent be the authority on availability.

caller: "can we do Thursday?"
   |
   v
getCalendarAvailability --> n8n --> Cal.com
                                      |  Cal.com checks the owner's
                                      |  connected Outlook calendar
                                      v
                            free/busy for Thursday
   <--------------------------------+
agent offers only real slots
   |
   v
bookCalendarEvent --> n8n --> Cal.com creates the event
                                 |
                                 +- virtual? Google account on Cal.com's
                                 |  side attaches the Meet link
                                 +- in-person? separate event type
   |
   v
Twilio / SMTP tells the owner --> Supabase logs the call

The orchestrator never touches Outlook or Google Calendar directly. Both are connected on Cal.com's side — Outlook for the conflict check, Google for the Meet link — and the workflow only ever talks to Cal.com. One integration to maintain instead of three, and the owner's existing calendar stays the source of truth for "busy" without the agent needing permission to read it. Two meeting types, virtual and in-person, are two event-type slugs on one account. Not two calendars, not two agents.

How does the agent answer questions about your documents?

Through a separate ingestion flow that runs nowhere near a live call.

OneDrive folders        n8n ingestion        Vapi file store
(company_info,    -->   (2 branches)   -->   + patch the fileIds into
 contracts)             on new file          searchKnowledgeBase's
                                              matching bucket

The owner drops a file in a OneDrive folder. The ingestion workflow uploads it to Vapi's file store and patches the file ID into the matching knowledgeBases[] bucket on the searchKnowledgeBase query tool. Then at call time, the agent queries that knowledge base through Vapi's own infrastructure — no webhook round-trip. This is the one tool in the whole system that does not come back to the orchestrator, and it is why document questions answer at conversational speed while a booking takes a beat. If you are wondering why your agent feels slow on simple questions, this is usually the reason: you routed knowledge lookups through your backend when they did not need to go there.

What breaks first? The endCall incident

A tool that was in the schema file the whole time and never reached the live assistant. {"type":"endCall"} sat in the tools schema from the beginning. But the sync script's loop only handled function and query tools — the two kinds that live in the /tool store — and endCall is neither. It was filtered out by the line immediately after the one that read it. Every run reported success. The live assistant never received it.

A model with a missing tool does not error — it substitutes

So the agent had no way to hang up. When instructed to end the call, it reached for the nearest-named tool it did have and called cancelCalendarEvent instead. The logs showed a successful tool call the whole way down.

Verify against the live assistant, not your deploy script's output. GET /assistant/:id and read the actual model.toolIds and model.tools. A script that prints "attached 11 tools" is reporting its own intent.

Push non-function tools separately and on purpose. endCall and transferCall go onto model.tools via PATCH /assistant/:id. They are not part of the /tool store sync, so a loop built for function tools will silently drop them.

Why does the agent go silent for 20-30 seconds mid-call?

Because a function tool blocks the conversation while it runs, and the runtime will not let the agent speak until the tool returns. This mechanism is commonly stated backwards, so it's worth getting the direction right: session.say() is not what causes the hang. It is the mitigation. The hang is caused by the tool itself.

In LiveKit Agents, when the model decides to call a function tool, the runtime awaits that tool and only lets the agent speak once it returns. For a fast tool that is invisible. For a tool that takes six seconds to verify an order and eight more to issue a refund, the caller gets fourteen seconds of nothing — and LiveKit's own write-up names the consequence: the customer assumes the call dropped and hangs up before the work finishes.

  • Nothing speaks unless you make it speak. There is no automatic progress channel. Silence is the default.
  • The running call never enters the chat context, so the model cannot see that it is already working — and tends to call the same tool again.
  • An unbounded backend hangs the session, not just the turn. A backend that hangs blocks the session, the close callback does not run, and the next turn never starts. That is not a 20-second pause, that is a dead call.

The documented fix: make the tool non-blocking. ctx.update() on RunContext is the mechanism, and it did not exist before livekit-agents 1.6. Any ordinary @function_tool is synchronous right up until the moment it calls ctx.update().

LiveKit Agents: hand control back mid-tool
@function_tool
async def issue_refund(self, ctx: RunContext, order_id: str) -> str:
    # ctx.update() hands control back to the LLM immediately,
    # uses this message as the tool's synthetic return value, and
    # marks the call non-blocking. The agent voices it right away
    # while the tool keeps running in the background.
    await ctx.update("Looking that order up now.")
    order = await orders_api.verify(order_id)      # slow
    await ctx.update("Found it, processing the refund.")
    return await refunds_api.issue(order)          # slow
  • session.say() inside the tool plays a short pre-determined filler line — LiveKit's recommended way to mask dead air. ctx.with_filler(...) automates it, playing audio through session.say() during quiet gaps and bypassing the model entirely.
  • ctx.wait_for_playout() waits for pre-tool speech to finish before continuing.
  • Set a timeout on every tool that calls an external system. The unbounded case above is why.

HONEST BOUNDARY: the voice agent documented on this page runs on Vapi, not LiveKit, so we have not hit this failure in our own production stack — the hang is a LiveKit Agents mechanism, read from LiveKit's official documentation and engineering blog on 16 November 2026, not from our incident log. The architectural lesson generalises: any orchestrator that awaits a tool before permitting speech has this shape. If you are on Vapi instead, the equivalent levers are different objects — rotating tool messages let a tool play one of several variants while it works, which is not the same thing as handing control back mid-tool. The fastest way to detect this before a customer does is a simulation with a deliberately slow tool; Vapi ships simulation suites you can run against an assistant, including background sounds, so you can hear what fourteen seconds of silence sounds like on a noisy line.

Why does the bill climb faster than the call volume?

Because almost every layer bills by the minute or the token, and the things you do to fix latency make calls longer.

LayerTypical billing basisScales with
Telephonyper minutecall duration x volume
Speech-to-textper minute of audiocall duration x volume
The modelper token, in and outturns, prompt size, tool-call round trips
Text-to-speechper character or per minutehow much the agent says
Orchestratorper minute, or self-hosted computecall duration x volume

The compounding part, and the bit that surprises people: fixing the hang above costs money. Filler lines are text-to-speech characters. Progress updates are extra model calls. Keeping the caller engaged instead of letting them hang up means the call lasts longer, which bills on every per-minute layer at once. A better-feeling call is a more expensive call, and the two goals pull against each other.

  • Longer prompts ride on every turn. A system prompt that grew to several hundred lines is re-sent on each exchange. At ten calls a day nobody notices; at a thousand it is the line item.
  • Retries and duplicate tool calls bill twice. The model not seeing its own in-flight call and calling again is a correctness bug with a billing symptom.
  • Concurrency caps turn cost into a queue. Past your orchestrator's concurrency limit, calls wait or fail. The failure mode at volume is often operational before it is financial.
What to do about it, concretely

Log the duration of every call, per call, from day one. That single field is what lets you see creep instead of discovering it on an invoice. Our own convention is to write a row per run into a shared automation_logs table with the duration and a derived value figure — for a voice booking we record roughly ten minutes of staff time saved per booking, valued against a $100/hour baseline, which works out to $1.67 per minute.

$1.67/minute is our internal value baseline for time saved, not a vendor cost. It is the number we measure benefit against, and it is illustrative arithmetic you should replace with your own labour rate.

We are not publishing per-minute vendor prices here on purpose. Voice pricing is tiered, changes often, and differs by plan and region; a stale price on a page like this is worse than no price. Get current numbers from each vendor and build the model yourself — the structure in the table above is the part that stays true.

Frequently asked questions

FAQ

Why does my voice agent pause for 20 seconds during a tool call?

  • Because the runtime awaits the tool before letting the agent speak, so a slow tool produces silence. session.say() inside the tool is the mitigation, not the cause. The real fix is making the tool non-blocking — in LiveKit Agents, calling ctx.update(), which hands control back immediately and lets the agent talk while the tool keeps running. Also set a timeout: an unbounded backend blocks the whole session, not just the turn.
FAQ

Do I need n8n specifically?

  • No. Vapi posts a webhook; anything that can receive HTTP and return JSON on time works. n8n is used here because the branch-per-tool shape is easy to read and easy to hand to someone else. The constraint is latency, not vendor.
FAQ

Can the agent do this without a calendar product?

  • You could write directly to a calendar API, but then you own conflict detection, timezones, and the owner's existing meetings. Cal.com is doing real work in this stack, not acting as a wrapper.
FAQ

How many tools is too many?

  • Eleven is comfortable. The practical limit is the model reliably choosing the right tool, and the main cause of wrong choices is two tools whose names and descriptions overlap. Name them for what they do to your data, not for what the caller said.
FAQ

Where does the transcript go?

  • Supabase: a contacts table and a call-logs table, written by the orchestrator at the end of the call. Errors go to BetterStack separately, so an ops alert is never buried in business data.
Companion Claude Skill

Take the tool-sync pattern with you

The import / update / revert scripts and the function-vs-model.tools distinction, as a Claude Skill. Point it at your own Vapi assistant and avoid the eleven-dashboard-sessions problem.

vapi-tool-sync/SKILL.md
---
name: vapi-tool-sync
description: Keep a Vapi assistant's tools in sync with a schema file over the REST API, since the Vapi CLI cannot bulk-import tools.
version: 1.0.0
license: MIT
---

# Sync Vapi tools from a schema file

Use this when you are managing a Vapi voice assistant's tools and do not want
eleven (or more) manual dashboard sessions with no version control.

## When to use

- "Import these tools into my Vapi assistant."
- "I added one tool to the schema, push just that one."
- "Move this phone number to a dynamic assistant-request flow."

## Why not the CLI

Vapi's "tool create" command is interactive only. No file-import flag, no
bulk flag. Talk to the REST API directly instead.

## The three scripts

| Script | Does | Method |
|---|---|---|
| import-vapi-tools.mjs | First-ever import | GET /tool to list, POST /tool per new tool, PATCH /assistant/:id to append IDs to model.toolIds |
| update-vapi-tools.mjs | Day-two sync, edits live tools in place | GET /tool to map name to id, PATCH /tool/:id per tool |
| enable-vapi-assistant-request.mjs | Moves a phone number from static to dynamic assistant | PATCH /phone-number/:id, swaps assistantId for server.url |

## Hard rules

1. **Skip what already exists.** List live tools first (GET /tool) before
   creating. Re-running an import without this check duplicates every tool
   and leaves the assistant calling the stale copies.
2. **"type" is immutable on PATCH.** Send everything except type when
   updating a tool, or the request fails.
3. **Non-function tools go on model.tools, not the /tool store.**
   function and query tools live in /tool, keyed by function.name.
   endCall and transferCall do not — they go on the assistant's own
   model.tools array via PATCH /assistant/:id. A sync loop written only
   for function/query tools will silently drop them, and the model will
   substitute the nearest-named tool it does have with full confidence (the
   known incident: a missing endCall got silently replaced by
   cancelCalendarEvent).
4. **Ship a --revert flag on any dynamic-assistant switch.** Moving a number
   to assistant-request means every call now asks your webhook which
   assistant to use. If that branch is not live, every inbound call hits a
   webhook that cannot answer. Always carry a one-flag rollback to the static
   binding.
5. **Verify against the live assistant, not your script's stdout.**
   GET /assistant/:id and read the actual model.toolIds and model.tools.
   A script that prints "attached 11 tools" is reporting its own intent,
   not the server's state.

## Pitfalls

- Trusting "success" output from a sync script instead of the live assistant object.
- Forgetting non-function tools exist at all — they're easy to leave out of a schema file built around the /tool store.
- No timeout on the dynamic-assistant rollback path.

## Verification

- [ ] GET /assistant/:id shows every intended tool ID in model.toolIds or model.tools.
- [ ] Re-running the import script creates zero duplicates.
- [ ] endCall/transferCall present on model.tools, not in the /tool store.
- [ ] The dynamic-assistant script's --revert flag has been tested once before relying on it in production.

Save it as vapi-tool-sync/SKILL.md in your skills directory. Works in Claude Code, Claude Desktop, or any agent that reads SKILL.md files.

Want this wired into your business instead of your weekend?

Happy to walk through how this maps onto your own voice agent build — no pitch, just answers.

Azuro AI · Built from our own production n8n workflows and engineering notes. Client names, tenant identifiers, credential IDs and endpoints have been removed. Every incident described is real and dated in our internal records.