Dograh

How to Build an Agent Like ElevenLabs Agents With Open Source

How to Build an Agent Like ElevenLabs Agents With Open Source
TutorialDecember 4, 2026·14 min read

How to Build an Agent Like ElevenLabs Agents With Open Source

Abhishek Kumar
Abhishek Kumar·Co-founder, Dograh AI

Co-founder of Dograh, building the future of open-source voice AI agents. Own your voice AI stack.

To build an agent like ElevenLabs Agents with open source, choose your voice and language models, add a knowledge base, tools and a call flow, then connect a website widget and phone numbers. To keep ElevenLabs voices, Dograh, the open-source AI voice agent platform, runs them on your own key. Self-host it or run it on Dograh Cloud.

Key Takeaways

  • Pick each agent's voice and language model, ElevenLabs voices included.
  • Your own ElevenLabs key puts the contract in your name, but audio still leaves.
  • In Dograh, one agent answers on your website widget and your phone numbers.

ElevenLabs Agents puts a voice, a knowledge base, tools, a call flow, a web widget and phone numbers into one hosted product. We build the same shape in Dograh, our open-source AI voice agent platform, and finish with a test on a real phone line.

What you need and where Dograh runs

These steps follow the published Dograh and ElevenLabs docs. Run them on a trial server before production, with a test number and a copy of your documents, so no real caller meets a half-built agent. You need an ElevenLabs API key if you want its voices, keys for the other models you pick, and a phone number on a carrier such as Twilio, Telnyx or Plivo. You also need the APIs the agent should call and the documents it should answer from.

The platform itself is open code. Dograh is open source under the BSD 2-Clause license, so the whole platform, recordings and transcripts included, can sit on your own servers. The Docker Compose setup runs it on one machine with at least 8 GB of RAM and 4 vCPUs, and Enterprise plans add on-prem deployment.

Self-hosting Dograh drops the per-minute platform fee. Servers, model keys and phone minutes still cost money, and your team looks after the database and upgrades. Community support covers the open-source version, and Enterprise brings custom SLAs. Dograh Cloud runs the same product for a 1¢-a-minute platform fee and includes 10 concurrent calls. Either way, ElevenLabs bills voice usage to your own ElevenLabs account, at the rates in our ElevenLabs pricing breakdown.

Check: You can sign in to the dashboard, and Providers, Models and Telephony show in the sidebar.

How ElevenLabs Agents' parts map to Dograh

ElevenLabs lists its agent features on its ElevenAgents overview, and each one this build uses has a clear home. The table maps them at product level, and our guide to moving an existing ElevenLabs agent covers the export and the field-by-field detail.

ElevenLabs AgentsWhere it lives in this build
Agent prompt and first messageAgent Node prompt, plus Greeting Text on the Start Call node
Workflow subagent nodes and LLM-condition edgesAgent Nodes joined by pathways, each with a written condition
Agent transfer and transfer to number nodesTransfer To Agent and Transfer Call tools
Knowledge baseKnowledge Base Files, attached per node
Webhook tools and MCP toolsExternal HTTP API tool and MCP Server tool
Choice of LLMs or a custom LLMAny registered LLM provider, an OpenAI-compatible base URL or a speech-to-speech model
ElevenLabs voicesElevenLabs on your own key, or more than a dozen other voice providers
Web widgetAdd to Website, with a Voice Agent or Chat Agent widget
Twilio and SIP trunkingTwilio, Telnyx, Plivo, Vonage, Vobiz, Exotel, Cloudonix and Asterisk ARI
Batch callsCampaigns from a CSV file
Tests and evaluationsTest Audio, Test Chat, QA Analysis node and View Trace
Experiments (A/B tests)Traffic split between agents or versions on a campaign
Post-call webhookWebhook node

Step 1: Choose the voice and models first

Model choice comes first, because it shapes everything the caller hears. Dograh handles the call flow, tools and telephony, and the speech and language models form a separate layer that you pick for each agent.

To keep ElevenLabs voices, add ElevenLabs under Providers with your own API key, then create a configuration under Models that uses it for the voice. You pick a model such as eleven_flash_v2_5 or eleven_v3, a voice ID from your Voice Library, and, on an ElevenLabs data residency plan, its regional base URL, such as the EU endpoint. Our comparison of Dograh and ElevenLabs walks through the same screens in more detail.

Any other voice works the same way. The voice settings cover more than a dozen providers, such as Cartesia, Deepgram, Rime and Inworld, plus Speaches for a voice model you run yourself. For listening, ElevenLabs' Scribe v2 Realtime sits beside Deepgram and other transcribers. For the language model, you can pick OpenAI, Google, Groq or OpenRouter, or point an OpenAI-compatible base URL at a model on your own server.

For one speech-to-speech model in place of separate ones, add a Realtime configuration in Models, such as OpenAI Realtime or Gemini Live, though separate models handle heavy tool calling better. Whichever you choose, your own key makes the contract yours with that provider, while the audio still reaches ElevenLabs or any other hosted provider, so for full control run open-weight models on your own servers too.

Check: The agent's Model tab shows the voice you picked, and a browser test call speaks with it.

Step 2: Create the agent with the builder or a canvas

Every agent starts from Create Agent under Voice Agents. Choose Use Agent Builder to describe the agent in plain language, or Blank Canvas to draw the flow yourself.

In the builder, describe the job in plain words, for example "Build me an agent that answers plan questions from our help docs and books demos". It may ask a few questions, then shows Your agent requirements, with the information to collect, the business rules, the successful outcome and any assumptions to confirm. Read it closely, then select Approve & build, or Request changes, and it builds the agent.

The builder runs on Dograh's hosted models, so a self-hosted install connects to a free Dograh account to use it. Later edits by chat in the Builder tab save as a draft until you publish, and you can fine-tune any node on the canvas.

Check: The editor opens with Builder, Canvas, Model, Variables and Settings tabs, and the canvas shows a Start Call node.

Step 3: Draw the call flow on the canvas

The canvas is where the ElevenLabs workflow idea lives in this build. ElevenLabs' agent workflows route between subagent nodes on LLM conditions or expressions. Here, Agent Nodes do the work and pathways join them, each with a condition written in plain words that the model reads to decide where to go next.

Start with the Start Call node. Its Greeting Text is spoken word for word, so put the business name there, and give every variable a fallback, such as {{initial_context.first_name | there}}. Each Agent Node then holds one job, such as answering plan questions or booking a demo, with its own prompt and tools.

Shared rules go in a Global Node, whose prompt is added to every step that has Add Global Prompt switched on, so the persona and the handoff rules live in one place. An End Call node closes each branch, and Enable Variable Extraction on a node records answers such as a demo time for use after the call.

Models are chosen per agent, which keeps the voice the same from greeting to goodbye. When one part of a call needs a different voice or model, such as a second language, build that part as its own agent and hand the caller across with Transfer To Agent, without dropping the call.

Check: Every pathway has a written condition, the Global Node holds the shared rules, and each branch ends at an End Call node.

Dograh

Open Source Alternative to Vapi / Retell

Self-hosted voice agent platform — no per-minute fees

dograh-hq/dograh

Star on GitHub

Step 4: Ground answers in a knowledge base

Facts belong in files, so the prompt stays short and the facts stay easy to change. Open Files in the sidebar, the page headed Knowledge Base Files, and upload your help articles, price list or policies. PDF, DOCX, DOC, TXT, JSON and Markdown files are accepted, up to 5 MB each. On a self-hosted install, Dograh's model service parses and chunks each file and returns the text, which is stored in your own database.

Each file gets a mode. Full Document hands the agent the whole file, which suits short documents. Chunked Search splits a long file into pieces and fetches only the ones that match the question, and it uses the embedding model in your model configuration. Then open each node that answers questions and pick its files under Knowledge Base Documents, since the agent searches only the files attached to the node it is on.

A short policy page goes onto a pin board for the plan questions step whole, while a long file of help articles is cut into strips and only the two strips that match a caller's question are pinned beside it. The voice agent stands at that board, and a second board for booking a demo holds its own file.
A brief policy can be read in full, while a thick manual gets split so each question pulls only the parts that fit it. Pin every file to the node that answers from it, since the agent never looks at files pinned elsewhere.

Files written for reading often sound wrong when spoken, and our post on knowledge-base grounding shows how to rewrite them for the ear.

Check: In Test Chat, a question your file answers gets the answer from that file.

Step 5: Add tools for lookups and handoffs

Tools let the agent act during the call, and they live under Tools in the sidebar. An External HTTP API tool does the job of an ElevenLabs webhook tool, sending a request to your system with the method, endpoint, credential and parameters you set. An MCP Server tool connects a whole MCP server, and its tools become available to the agent.

Write each tool's Description as a rule, such as "Use only after the caller confirms the demo time." The tool waits 5 seconds and does not retry, so the prompt should say what to do when one fails. For a slow API, the tool's Messages card plays a line When the tool starts, and another While the tool is running if the request takes longer.

Per-caller data, the job dynamic variables do in ElevenLabs Agents, comes from Pre-Call Data Fetch at the bottom of the Start Call node. It sends a POST with the caller's details to an endpoint you run, which looks the caller up and returns only the fields the agent needs. The greeting waits for the reply, and the caller hears ringing meanwhile.

For handoffs to people, add a Transfer Call tool with your team's number or SIP address. 87% of customers in a Gartner survey said it is essential for companies using GenAI in customer service to offer a way to reach a human agent. Transfer Call works on Twilio, Telnyx, Plivo, Cloudonix and Asterisk ARI. Dograh calls the destination first and connects the caller only when someone answers.

The team's line rings for up to 30 seconds unless you set another ring time in the tool. If nobody picks up, the agent gets "transfer_failed" and the call goes on, so have it take a callback request through an HTTP API tool. Transfer To Agent hands the caller to another agent instead, and it works on any call with separate speech and language models, web calls included.

Check: On a browser test call, each tool runs only when its Description allows, and a failed tool gets the fallback line from the prompt.

Join the Dograh Community

Dograh is an OSS alternative to Vapi. Join our Slack community for queries, releases, best practices & community interactions.

Step 6: Put the agent on your website

The website widget runs the same agent you built for the phone. Open Settings in the agent editor, scroll to Add to Website and select Configure Widget. Add your site to Allowed Domains, then choose a Widget Type, Voice Agent for spoken calls or Chat Agent for typed chat, and an Embed Mode.

Floating Widget puts a button in a corner of the page, Inline Component draws the panel inside a section you choose, and Headless gives you only the audio or chat plus a JavaScript API for your own buttons. The Add to Website guide shows each mode, and our post on adding a voice widget safely covers domains and page context in depth.

The page can also tell the agent who is visiting. Once the widget loads, window.DograhWidget.setContext() passes details your app already knows, here the visitor's first name in customer_name and their plan in plan.

window.DograhWidget.setContext({
  customer_name: user.firstName,
  plan: user.plan
});

What this does: It hands customer_name and plan to the next conversation, where a prompt reads them as {{initial_context.customer_name}} and {{initial_context.plan}}. A visitor can change page data, so treat these as hints for phrasing and fetch anything the agent must trust from your own API.

Check: On an allowed page, the widget opens, the agent greets the visitor by name, and the conversation shows in the agent's call history.

Step 7: Connect phone numbers for calls in and out

Phone calls run through your own carrier account. Open Telephony in the sidebar, select Add configuration and pick your carrier, from Twilio, Telnyx, Plivo, Vonage, Vobiz, Exotel and Cloudonix to Asterisk ARI for your own trunk or PBX. Then add a number and set its Inbound workflow to this agent.

Outbound calls, the job of ElevenLabs batch calls, run as Campaigns. Upload a CSV with a phone_number column, and every other column becomes a variable the prompt can read, such as {{initial_context.first_name}}. Each campaign runs its Call Schedule in one Timezone. It starts on your browser's time zone, or your last scheduled campaign's, so set it to your callers' zone.

Set the retry numbers yourself under Enable Retries, with Max Retries, Retry Delay and the Retry On switches written to match your own calling policy. For outbound calls on agents with separate speech and language models, also open the agent's Settings and switch on Enable voicemail and screening handling. When voicemail is detected then offers Disconnect the call or Leave a message.

Check: A call to the number reaches the agent, and a one-row test campaign to your own phone rings inside the schedule.

Step 8: Test, trace and measure before launch

Browser tests are quick, and phone tests show what callers will really hear. In the editor, Test Audio runs a spoken call and Test Chat a typed one, with sample values on the Variables tab. Test Chat's Rerun this turn and Edit and rerun this turn buttons replay one step after you change a prompt.

Then call the agent with Phone Call. Transfer Call needs a real phone call to run, and phone audio changes what the agent hears. Most phone calls still reach the agent as 8 kHz audio, while a browser demo runs at 16 kHz, so a name the agent caught in the browser can come through wrong on a call.

For measurement, once Langfuse tracing is connected in Platform Settings, View Trace on a run shows what the agent heard on each turn, the prompt sent to the language model, its reply and any tool calls. A QA Analysis node scores each step of a call, and its Sample Rate picks a random share of calls. A Webhook node posts each call's results to your system after the call, adds a call_disposition key, retries temporary failures up to five attempts in all, and also fires on every unanswered try.

Check: A real phone call finishes the main path, one transfer connects, and your endpoint receives one record with its call_disposition.

Before you ship it

Start with one number or a small share of a campaign. From our work with teams, scoring a random 5 to 10% of live calls with the QA node finds most mistakes while the review pile stays small.

To compare two versions the way ElevenLabs Experiments do, add both to one outbound campaign under Agents & traffic split and read the results side by side. Then widen the rollout one step at a time, and add each new kind of call to the flow as callers bring it.

Glossary

Greeting Text
The Start Call node's text, spoken word for word at the start of the call, with a fallback for every variable.
Chunked Search
A Knowledge Base mode that splits a long file into pieces and fetches only the ones that match the question. It uses the embedding model in your model configuration.
Pre-Call Data Fetch
A Start Call setting that sends a POST with the caller's details to an endpoint you run, so the agent starts the call with the right record.
Transfer To Agent
A Dograh tool that hands a live call to another agent without dropping the caller, for example to switch voice or language.

Frequently Asked Questions

Get started with Dograh

Build, deploy, and scale AI agents with Dograh. Join the community of developers building the future.