Documentation agent
Try our live implementation using the voice widget in the bottom-right corner of this page.
Overview
Build a voice-powered documentation assistant step by step. Choose between using the Dashboard interface or programmatic APIs to suit your workflow.
You’ll learn to:
- Index your docs with LlamaCloud
- Create a RAG tool for document retrieval
- Create an assistant with Claude 3.5 Sonnet and attach the tool
- Use the Web SDK to create a widget
- Analyze user sessions and improve the quality of your agent overtime
Prerequisites
- Vapi account with API access
- Documentation content -
llms.txt
file (example) could work great; it could be available out-of-box with your documentation framework (e.g. Fern, Mintlify) - LlamaCloud account for indexing
Get started
Index your documentation
Upload and index your documentation in LlamaCloud using text-embedding-3-small
.
- Create a new project in LlamaCloud
- Upload your documentation files (you can use a single consolidated file like llms-full.txt)
- Configure embedding model to
text-embedding-3-small
- Set chunking to 512 tokens with 50 token overlap
- Note your index ID and API credentials
Consolidate your documentation into a single text file for better RAG performance. You can see our example at docs.vapi.ai/llms-full.txt.
Create the RAG tool
Create a tool that connects your assistant to your LlamaCloud index.
Dashboard
TypeScript (Server SDK)
Python (Server SDK)
cURL
- Navigate to Tools in your Vapi Dashboard
- Click Create Tool
- Select API Request as the tool type
- Configure the tool:
- Name:
docsquery
- Function Name:
docsquery
- Description:
Search through documentation to find relevant information
- URL:
https://api.cloud.llamaindex.ai/api/v1/pipelines/YOUR_PIPELINE_ID/retrieve
- Method:
POST
- Headers: Add
Authorization: Bearer YOUR_LLAMACLOUD_API_KEY
- Body: Configure to send the query parameter
- Name:
- Save the tool and note the tool ID
Replace YOUR_PIPELINE_ID
with your LlamaCloud pipeline ID and YOUR_LLAMACLOUD_API_KEY
with your API key. Save the tool ID from the response for the next step.
Create an assistant with the tool
Create an assistant with the RAG tool attached.
Dashboard
TypeScript (Server SDK)
Python (Server SDK)
cURL
- Navigate to Assistants in your Vapi Dashboard
- Click Create Assistant
- Configure the assistant:
- Name:
Docs agent
- Model: Claude Sonnet 4 (Anthropic)
- Voice: Harry (Vapi)
- First Message:
Hey I'm Harry, a support agent. How can I help you today? You can ask me questions about Vapi, how to get started or our documentation.
- System Prompt: Use a helpful documentation assistant prompt with guidelines for using the docsquery tool
- Name:
- Add the
docsquery
tool in the Tools section - Configure analysis plan for call monitoring
- Publish the assistant
Replace YOUR_PIPELINE_ID
with your LlamaCloud pipeline ID and YOUR_LLAMACLOUD_API_KEY
with your API key. Save the tool ID from the response for the next step.
Update assistant properties
Customize your assistant’s behavior and responses after creation.
Dashboard
TypeScript (Server SDK)
Python (Server SDK)
cURL
- Navigate to your assistant in the Vapi Dashboard
- Edit any properties like system prompt, first message, or voice settings
- Changes apply immediately - no republishing needed
SDK changes apply immediately. Unlike Dashboard publishing, programmatic updates take effect right away.
Create test suite
Create test scenarios to validate your documentation assistant’s responses.
Dashboard
TypeScript (Server SDK)
Python (Server SDK)
cURL
- Navigate to Test > Voice Test Suites in your dashboard
- Click Create Test Suite
- Add test scenarios with expected behaviors
- Run tests to validate assistant performance
Test suites can only be executed through the Dashboard. Navigate to Test > Voice Test Suites to run your created tests.
Create a web component
Use the Vapi Web SDK to create a voice widget for your documentation assistant.
TypeScript (Web SDK)
Replace YOUR_PUBLIC_API_KEY
and YOUR_ASSISTANT_ID
with your actual values:
For a complete implementation with waveform visualization, real-time transcripts, and responsive design, check out our voice widget component on GitHub.
Improve your prompts with call analysis
Vapi automatically analyzes every call. The assistant above includes an analysisPlan
with summary and success evaluation configured.
Dashboard
TypeScript (Server SDK)
Python (Server SDK)
cURL
- Navigate to Logs > Calls in your dashboard
- Click on any completed call to view analysis
- Review summary and success evaluation
- Use insights to improve your assistant’s prompts and responses
Iterative improvements:
- Review analysis summaries to identify common user questions
- Use structured data to track conversation patterns
- Monitor success evaluations to optimize assistant performance
- Update your system prompt based on recurring issues
- Refine RAG retrieval based on query success patterns