Skip to main content
Let’s build a production-ready voice agent that can respond to users and trigger function calls. Here’s a preview of what you will build:
  • Real-time speech-to-text, text-to-speech, turn-taking, and low-latency audio delivery powered by Layercode’s edge platform.
  • A sample agent backend that monitors conversation transcripts and responds based on your prompt and the tool calls you define. Deployable anywhere.

Next steps

Keep iterating—here are the next things builders usually tackle.

Customize your prompts

Adjust the prompt or welcome_message in layercode.config.json.
layercode.config.json

Add a tool call

The project ships with an example tool in /app/api/agent/route.ts. Modify it or add your own.
/app/api/agent/route.ts
Learn more about tool calling in Next.js or review the general tool calling guide.

Store your messages

Set up persistent storage for transcripts. A fast database or data store such as Cloudflare D1 or Redis works well. A dedicated guide is coming soon.

Deploy your voice agent backend

Layercode runs the voice pipeline in our cloud, but your backend APIs (and frontend, if you are not using Next.js or telephony) need to be deployed. Use the deployment guides: Remember to set your environment variables in the hosting platform and update the Layercode dashboard with the deployed webhook URL.

Set up telephony

Follow the Twilio setup guide to add phone-call support.

Use the Layercode tunnel

We provide a tunnel utility for local development.