Time Travel Machine

PreviousNext

The Time Traveler calls your phone from any era (Bronze Age to 3000 AD) with real voices shaped by their time.

Time Travel Machine

Time Travel Machine

Overview

The Time Traveler lets you receive a real phone call from any point in history — from the Bronze Age to the year 3000. Each voice you hear is alive in its own era, speaking naturally in English or Spanish, shaped by the beliefs, sounds, and tools of their time.

Built with ElevenLabs, it mixes historical storytelling with real-time audio synthesis — creating an illusion so vivid it feels like you’re truly speaking across centuries.

Demo

Watch the demo

About this project

  • 17 Historical Eras: From Late Bronze Age (1500 BC) to Far Future (3000+ AD) with authentic personalities
  • Multiple agents & personalities: Several ElevenLabs agents with distinct styles; the system selects and adapts personality per era
  • Diverse voices: Language-specific voice pools with gender/age metadata; voices are randomized while voice settings adapt to the era
  • Bilingual Immersion: Complete English/Spanish support with era-specific expressions
  • Beautiful UI: Modern, responsive frontend with stunning animations and user experience
  • Real-Time Audio: Seamless Twilio ↔ ElevenLabs integration with optimized audio conversion
  • Smart Randomization: Voice and agent selection with character consistency
  • Production Ready: Complete deployment infrastructure with comprehensive documentation

Key Features

  • Live Phone Calls: Real-time conversations via Twilio integration
  • Dynamic Context: ElevenLabs agents receive era-specific prompts and expressions
  • JSON API: Simple REST API for initiating calls with {to, lang, year} parameters
  • JWT Authentication: Secure token-based authentication for all API endpoints
  • Rate Limiting: Built-in protection against abuse with configurable limits
  • Status Monitoring: Real-time rate limit status and call monitoring endpoints

How It Works

The system delivers an outbound voice experience: a visitor submits a form (phone, language, year) and immediately receives a call. On pickup, a live ElevenLabs Agent converses naturally with era-flavored style.

  1. User submits phone number, language, and target year.
  2. Backend dials via Twilio Voice and opens a Media Streams WebSocket.
  3. Realtime bridge streams audio between Twilio and ElevenLabs Conversational AI.
  4. Dynamic prompts inject era context (time period, expressions, first line); voice/agent are chosen to match the era and language.
  5. Streaming replies return instantly to the caller; monitoring tracks rate limits and call state.

Technologies Used

  • ElevenLabs: Conversational AI (Agents), realtime streaming TTS/STT.
  • Twilio: Voice + Media Streams for bidirectional audio.
  • Backend: FastAPI, WebSockets, JWT, rate limiting.
  • Frontend: Next.js + React, modern responsive UI.
  • Infra/Dev: Vercel (web), Railway (server), ngrok (local tunneling), Poetry/PNPM, PyTest.

Getting Started

Please check the source repo for detailed instructions: github.com/dan1dr/time-traveler

⚠️ Disclaimer: While the UI is available at time-traveler-one.vercel.app, only calls to my predefined Twilio number will work (to avoid expenses charged to my account). If you want to run your own version, follow the setup instructions below.

There are two options:

  • local development using ngrok
  • production deployment with Railway and Vercel

Prerequisites

  1. ElevenLabs Agent Setup: Create and configure your conversational agents → apps/server/README.md
  2. Twilio Integration: Set up Twilio phone number and webhooks → infra/twilio/README.md
  3. Environment Variables: Configure .env files (see Configuration section below)

Local Development

1. Start the Backend

cd apps/server
# Install dependencies with Poetry (creates/uses a virtualenv)
poetry install
 
# Run the API
poetry run uvicorn main:app --host 0.0.0.0 --port 8000 --reload

2. Start ngrok (separate terminal)

ngrok http 8000

3. Start the Frontend (localhost)

cd apps/web
pnpm install  # or: npm install / yarn
 
# Create .env.local with your ngrok URL
echo "NEXT_PUBLIC_BACKEND_URL=https://YOUR_NGROK_URL" > .env.local
 
# Run dev server
pnpm dev  # or: npm run dev / yarn dev
# Open http://localhost:3000

4. Test with cURL (optional)

# Get authentication token
TOKEN=$(curl -s -X POST https://YOUR_NGROK_URL/auth/login | jq -r '.token')
 
# Make a test call
curl -X POST https://YOUR_NGROK_URL/outbound-call \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{
    "to": "+1234567890",
    "lang": "en",
    "year": 1350
  }'

Production Deployment

Configuration

Environment Variables

Backend (apps/server/.env)

# ElevenLabs Configuration
ELEVENLABS_API_KEY=sk_...
ELEVENLABS_AGENT_ID_1=agent_...
ELEVENLABS_AGENT_ID_2=agent_...  # Optional
ELEVENLABS_AGENT_ID_3=agent_...  # Optional
 
# Twilio Configuration
TWILIO_ACCOUNT_SID=AC...
TWILIO_AUTH_TOKEN=...
TWILIO_PHONE_NUMBER=+1...
 
# JWT Authentication
JWT_SECRET=your_secure_jwt_secret_here
JWT_EXPIRATION_HOURS=24
 
# Rate Limiting (Optional - defaults shown)
RATE_LIMIT_CALLS=5
RATE_LIMIT_WINDOW_MINUTES=5
 
# CORS and Debug
ALLOWED_ORIGINS=http://localhost:3000,https://your-app.vercel.app
DEBUG_LOGS=true

Frontend (apps/web/.env.local)

NEXT_PUBLIC_BACKEND_URL=https://your-railway-app.railway.app

Future Plans

  • Extended agent memory: Persist conversational memory in a database to recall prior calls and tailor responses
  • Advanced rate limiting & monitoring: More granular quotas, per-route policies, dashboards, and deeper test coverage
  • Live tool access for the agent: Controlled tools (search, retrieval, functions) with auditing and safety rails

Acknowledgments