Quickstart
Enable voice on your agent and place your first call
This guide takes you from an existing text agent to a working phone agent in three steps.
Prerequisites
- A sender with an AI agent configured. See AI Agent Setup.
- A phone number assigned to that sender (required for inbound calls). See Purchasing Phone Numbers.
Step 1 — Enable Voice on the Agent
Voice is a property of the agent. Patch the agent with a voice object to turn it on and set a greeting.
import Zavudev from "@zavudev/sdk";
const zavu = new Zavudev({
apiKey: process.env["ZAVUDEV_API_KEY"],
});
await zavu.senders.agent.update("sender_12345", {
voice: {
enabled: true,
greeting: "Hi, thanks for calling Acme. How can I help you today?",
language: "en",
interruptible: true,
maxCallDurationMinutes: 15,
},
});
The agent keeps its existing provider, model, system prompt, tools, and knowledge bases. Voice only adds how it behaves on a call.
Step 2 — Place an Outbound Call
Call POST /v1/calls with the recipient's number. Zavu dials them, and the agent takes over when they answer.
npx zavudev calls create --to "+56912345678" --sender sender_12345
The response is 202 with the call in queued or ringing status. senderId is optional — the project's default sender is used when omitted.
Step 3 — Receive Inbound Calls
Inbound calls need no extra code. When someone dials a phone number assigned to the sender, Zavu answers with the voice agent automatically.
To set it up:
- Assign a phone number to the sender (see Purchasing Phone Numbers).
- Confirm the sender's agent has
voice.enabledset totrue(Step 1). - Call the number. The agent answers with its greeting and holds the conversation.
Read the Call and Transcript
Retrieve a call to read its outcome and full transcript. The transcript is a list of turns in order.
npx zavudev calls get call_abc123
npx zavudev calls list --status completed --limit 10
To stop a call in progress, hang up:
npx zavudev calls hangup call_abc123