A WebSocket-based service for interactive voice response demonstrations using agentic AI.
docker-compose.yml # Docker Compose configuration
.env.example # Example environment variables
ws-service/ # WebSocket service
Dockerfile # Service container definition
main.py # FastAPI WebSocket application
config.py # Configuration management
pyproject.toml # Python project configuration
uv.lock # Dependency lock file
- Docker
- Docker Compose
-
Configure environment variables:
cp .env.example .env # Edit .env with your preferred settings -
Build the services:
docker-compose build
-
Start the services:
docker-compose up
-
Access the WebSocket service:
- WebSocket endpoint:
ws://localhost:8000/ws/test - Health check:
http://localhost:8000/
- WebSocket endpoint:
-
Stop the services:
docker-compose down
Rebuild and restart after code changes:
docker-compose up --buildView logs:
docker-compose logs -f ws-serviceRun in detached mode:
docker-compose up -dThe application uses environment variables for configuration. Copy .env.example to .env and customize as needed:
cp .env.example .env| Variable | Description | Default | Options |
|---|---|---|---|
APP_NAME |
Application name | "Agentic AI IVR Demo" | any string |
APP_VERSION |
Application version | "0.1.0" | any string |
HOST |
Server host | "0.0.0.0" | any valid host |
PORT |
Server port | 8000 | any valid port |
LOG_LEVEL |
Logging level | "INFO" | DEBUG, INFO, WARNING, ERROR, CRITICAL |
LOG_FORMAT |
Log output format | "text" | text, json |
ENVIRONMENT |
Environment name | "development" | development, staging, production |
TWILIO_AUTH_TOKEN |
Auth token for Twilio API usage | None | valid API token as a string |
The application supports two logging formats:
Text Format (Human-Readable):
2025-11-12 10:30:45 - main - INFO - Application starting
JSON Format (Structured):
{
"timestamp": "2025-11-12T10:30:45.123456",
"level": "INFO",
"logger": "main",
"message": "Application starting",
"module": "main",
"function": "startup_event",
"line": 85
}To change log level or format, update your .env file:
LOG_LEVEL=DEBUG
LOG_FORMAT=jsonOr override in docker-compose.yml:
environment:
- LOG_LEVEL=DEBUG
- LOG_FORMAT=jsonYou can test the WebSocket connection using a simple HTML client or a WebSocket testing tool:
<!DOCTYPE html>
<html>
<body>
<script>
const ws = new WebSocket('ws://localhost:8000/ws');
ws.onopen = () => {
console.log('Connected');
ws.send('Hello from client');
};
ws.onmessage = (event) => {
console.log('Received:', event.data);
};
</script>
</body>
</html>The docker-compose setup is designed to easily accommodate additional services. Simply add new service definitions to docker-compose.yml and they will automatically join the app-network.