Build your first restaurant voice agent in 5 minutes
Install the Foreva AI SDK using pip:
$ pip install foreva-ai
Note: The SDK will be published to PyPI once ready. For now, you can install from our private repository.
Set up your API key for authentication:
from foreva_ai import ForevaClient
# Initialize the client with your API key
client = ForevaClient(api_key="your-api-key-here")
# Or set as environment variable
# export FOREVA_API_KEY="your-api-key-here"
# client = ForevaClient() # Will use env var
Create a simple restaurant ordering agent:
from foreva_ai import ForevaClient, Agent
# Initialize client
client = ForevaClient(api_key="your-api-key-here")
# Create a new agent
agent = client.create_agent(
name="Mario's Pizza Assistant",
restaurant_type="italian",
phone_number="+1-555-PIZZA-01",
menu_items=[
{
"name": "Margherita Pizza",
"price": 18.99,
"description": "Fresh mozzarella, basil, tomato sauce"
},
{
"name": "Pepperoni Pizza",
"price": 21.99,
"description": "Pepperoni, mozzarella, tomato sauce"
}
],
business_hours={
"monday": {"open": "11:00", "close": "22:00"},
"tuesday": {"open": "11:00", "close": "22:00"},
# ... other days
}
)
print(f"Agent created! ID: {agent.id}")
print(f"Phone number: {agent.phone_number}")
Customize how your agent handles calls:
# Update agent configuration
agent.update_config(
greeting="Hello! Thank you for calling Mario's Pizza. How can I help you today?",
voice_style="friendly",
language="en-US",
max_call_duration=300, # 5 minutes
enable_ordering=True,
enable_reservations=False,
custom_prompts={
"upsell": "Would you like to add garlic bread for just $4.99?",
"closing": "Thank you for choosing Mario's! Your order will be ready in 20-25 minutes."
}
)
print("Agent configuration updated!")
Test your agent before going live:
# Start a test call simulation
test_call = agent.simulate_call(
customer_input="Hi, I'd like to order a large pepperoni pizza"
)
print(f"Agent response: {test_call.agent_response}")
print(f"Detected intent: {test_call.intent}")
print(f"Extracted order: {test_call.order_details}")
# Get call analytics
analytics = agent.get_analytics(days=7)
print(f"Total calls: {analytics.total_calls}")
print(f"Successful orders: {analytics.successful_orders}")
print(f"Average call duration: {analytics.avg_duration}")
You've successfully created your first voice agent. Here's what to do next:
Ready for production? Contact sales to enable live mode and get a real phone number.
Check your dashboard to monitor API usage and agent performance.
Join our community or email us at support@foreva.ai
Explore integrations, webhooks, and custom voice training options.