A functional AI voice agent built with VAPI (Voice AI Platform) that handles natural, human-like conversations based on predefined logic and prompts.
- ✅ Natural voice conversations using VAPI
- ✅ Complete assistant CRUD operations (create, list, get, update, delete)
- ✅ Phone number management
- ✅ Call management and status tracking
- ✅ Configurable conversational flows and prompts
- ✅ Speech-to-text and text-to-speech integration
- ✅ Context-aware interactions
- ✅ Flexible agent logic configuration
- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
cp env.example .env
# Edit .env with your VAPI API key-
Configure the agent in
config/agent_config.py(optional) -
Run the agent:
PYTHONPATH=. python src/main.pyfrom src.config_loader import load_config
from src.agent import VAPIVoiceAgent
# Load configuration
config = load_config()
# Initialize agent
agent = VAPIVoiceAgent(config)
# Create an assistant
assistant = agent.create_assistant()
print(f"Assistant ID: {assistant['id']}")
# List assistants
assistants = agent.list_assistants()
# Get assistant details
details = agent.get_assistant(assistant['id'])
# List phone numbers
phone_numbers = agent.list_phone_numbers()
# Close agent
agent.close()See the examples/ directory for complete examples:
basic_usage.py- Basic usage examplecomplete_example.py- Complete example with all featuresconversation_demo.py- Demo showing how to have a conversation with the agent
To see how the agent handles conversations, run:
PYTHONPATH=. python3 examples/conversation_demo.pyThis will demonstrate a sample conversation with the agent, showing:
- User messages
- Agent responses
- Conversation state transitions
- Conversation history
For an interactive conversation (where you can type messages), run:
PYTHONPATH=. python3 examples/conversation_demo.py --interactiveSee config/agent_config.py for agent configuration options.
See docs/ directory for detailed documentation:
API.md- API referenceUSAGE.md- Usage guide
create_assistant(assistant_data)- Create a new assistantlist_assistants()- List all assistantsget_assistant(assistant_id)- Get assistant detailsupdate_assistant(assistant_id, assistant_data)- Update an assistantdelete_assistant(assistant_id)- Delete an assistant
list_phone_numbers()- List all phone numbersget_phone_number(phone_number_id)- Get phone number details
create_phone_call(assistant_id, phone_number_id)- Create a phone callget_call_status(call_id)- Get call statuslist_calls()- List all calls