Build Your First Agent
Phonic already knows how to listen to callers, speak in turn, and express emotion the way a human would. What’s left to you:
- Instructions: the call flow and rules that shape behavior.
- Tools: how the agent interacts with your systems, and when.
- Configuration: the voice, languages, timing, and switches for your calls.
- Deployment: where your customers can reach your agent.
- Evals: how you improve and tune your agent over time.
This tutorial guides you through building a hypothetical agent that handles reservations for the Phantastic Phood restaurant.
Step 1: Write the instructions
The system prompt is where you define who the agent is, what a successful call looks like, and guidelines for every call.
What to notice:
- Cover business context beyond the agent configuration. Check-in timing and wording can be configured (Step 3), but the prompt guides the agent on what to do with the reservation request when the caller stops responding.
- Nothing here about brevity, contractions, or number formats. These features are already built into Phonic. See voice style.
Now, so that the agent can actually interact with the world around it, like the reservation system or transferring a caller to the events line, we need to configure tools.
Step 2: Define the tools
Each tool’s description is the agent’s manual for that tool: what it does and when to call it. The agent sees every attached tool’s description on every turn. This page builds three tools; the tools overview covers every tool type and its configuration in full.
The lookup: check_availability
- Descriptions guide when tools are called (“call this when you know…”).
- Parameter descriptions tell the agent what data to collect and how to format it (“Requested date, YYYY-MM-DD”).
- In sync mode the agent waits for the result before it responds. Use it for a lookup whose answer the next sentence depends on.
The action: book_table
- Preconditions about a tool belong on the tool. The booking tool’s description says “only call after… confirmed the spelling”.
- Tool results should return every identifier a later step needs. Availability returns a slot ID because booking requires one. If a tool doesn’t return an identifier, the agent cannot supply it later, which can result in stalling or hallucinations.
The transfer: transfer_to_events_line
- Requiring speech before the transfer has the agent announce the handoff first. This configuration works well for a transfer, where the caller is about to hear a new line, but it may not be suitable for fast tool calls like context lookups. For a handoff built as your own webhook tool, use
wait_for_speech_before_tool_call(see tool behavior configuration). - A fixed target number is configuration, not prompt content. The prompt decides when to transfer (the “parties larger than 8” rule in Step 1), and the tool guarantees where. Leave
phone_numberunset and the agent determines the number at call time instead, which is what you want when the destination depends on the conversation (see transfer tools).
Remember to update the system prompt!
The tool descriptions cover when and how to call each tool, but the agent needs context on what to do with a result, or what to say when a tool call fails. Add this information to the instructions from Step 1:
Step 3: Configure the agent
Configurations offer systematic control for the agent.
What to notice:
- Languages are configuration, never prompt content. A prompt rule like “speak Portuguese” on an agent configured for English and Spanish produces a confused agent. See multilingual agents.
- User-side silence handling has two timers: how long before the agent checks in, and how long before it gives up and ends the call. The check-in wording can be customized, or you can turn on
generate_welcome_messageandgenerate_no_input_poke_textto let the agent generate the most natural message based on the prompt and conversation context. - Help it hear and say your terms. Boosted keywords tell the transcriber which domain words to expect; the pronunciation dictionary keeps the voice from saying “fud”.
- Redaction scrubs sensitive details from transcripts (tags like
[NAME],[PHONE],[CREDIT CARD]) and bleeps them from recordings after the call, for example when the agent takes a credit-card hold for a reservation. - Enabling backchanneling lets the agent murmur “mm-hmm” while the caller is talking, which sounds more natural.
- Tune the speaking pace so the booking host speaks a little faster and keeps the call moving.
- Allow the agent to end the call naturally: many AI assistants keep speaking until the user ends the conversation. Phonic agents can hang up once the call has wrapped up.
- The agent can choose not to respond in some cases, such as when the caller is thinking out loud or appears to be talking to someone else.
Step 4: Deploy your agent
Pick how customers can reach your agent:
- Inbound phone: attach a phone number to the agent, either Phonic-provisioned or your own via Twilio/SIP.
- Outbound phone: place calls from your backend with the outbound call API, passing per-call context as template variables.
- Your web or mobile app: connect the same agent over the WebSocket surface for real-time speech-to-speech, with no phone number involved.
The same agent can serve all three at once.
Step 5: Evaluate its behavior
Write one eval criterion per behavior you care about. A rule that forbids one thing and requires another gets two criteria. A failing criterion then points at the exact line to fix:
“If the caller asked about allergens or dietary restrictions, the assistant offered a callback from the kitchen.”
“When no tables were available, the assistant offered the waitlist and did not invent times.”
The evals guide covers extraction schemas, eval prompts, and the improvement loop.