AI Customer Service
PraisonAI Call is a feature that enables voice-based interaction with AI models through phone calls. This functionality allows users to have natural conversations with AI agents over traditional phone lines.
Installation
Step 1
pip install "praisonai[call]"
export OPENAI_API_KEY="enter your openai api key here"
export NGROK_AUTH_TOKEN="enter your ngrok auth token here"
praisonai call --public
Step 2
Buy a number at PraisonAI Dashboard
Step 3
Enter the Public URL in the PraisonAI Dashboard phone number field
Authentication
Breaking Change: When upgrading from earlier versions, the call server requires authentication configuration or it will fail with a 503 error.
The PraisonAI Call server now requires authentication configuration for security. You have two options:
Option 1: Token Authentication (Recommended)
Set a secure token for API authentication:
export CALL_SERVER_TOKEN="your-secure-token-here"
praisonai call --public
API requests must include the token in the Authorization header:
curl -H "Authorization: Bearer your-secure-token-here" \
-H "Content-Type: application/json" \
-d '{"message": "Hello"}' \
http://localhost:8090/api/v1/agents/assistant/invoke
Option 2: Disable Authentication (Local Development Only)
For local development, you can explicitly disable authentication:
export PRAISONAI_CALL_AUTH=disabled
praisonai call --public
Never use PRAISONAI_CALL_AUTH=disabled in production environments.
Authentication Flow
When CALL_SERVER_TOKEN is not configured and the environment is not development, the server returns:
503 Service Unavailable
CALL_SERVER_TOKEN is not configured. Set CALL_SERVER_TOKEN or PRAISONAI_CALL_AUTH=disabled to run without authentication.
Features
- Make and receive phone calls with AI agents
- Natural language processing for voice interactions
- Support for multiple phone carriers and providers
- Call recording and transcription capabilities
- Integration with other PraisonAI features
- Create a file called
tools.py
- Add the following code:
import yfinance as yf
# Get Stock Price definition
get_stock_price_def = {
"name": "get_stock_price",
"description": "Get the current stock price for a given ticker symbol",
"parameters": {
"type": "object",
"properties": {
"ticker_symbol": {
"type": "string",
"description": "The ticker symbol of the stock (e.g., AAPL, GOOGL)"
}
},
"required": ["ticker_symbol"]
}
}
# Get Stock Price function / Tool
async def get_stock_price_handler(ticker_symbol):
try:
stock = yf.Ticker(ticker_symbol)
hist = stock.history(period="1d")
if hist.empty:
return {"error": f"No data found for ticker {ticker_symbol}"}
current_price = hist['Close'].iloc[-1] # Using -1 is safer than 0
return {"price": str(current_price)}
except Exception as e:
return {"error": str(e)}
get_stock_price = (get_stock_price_def, get_stock_price_handler)
tools = [
get_stock_price
]
-
pip install yfinance
4. ```bash
export OPENAI_API_KEY="enter your openai api key here"
export NGROK_AUTH_TOKEN="enter your ngrok auth token here"
praisonai call --public
Manage Google Calendar Events
See Google Calendar Tools
Deploy
Docker Deployment
# Use an official Python runtime as a parent image
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set work directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install PraisonAI with the 'call' extra and ensure it's the latest version
RUN pip install --no-cache-dir --upgrade "praisonai[call]"
# Expose the port the app runs on
EXPOSE 8090
# Run the application
CMD ["praisonai", "call"]