✨ How I Built Philosophy AI Agent for WLH Project



This content originally appeared on DEV Community and was authored by Pravesh Sudha

This is a submission for the World’s Largest Hackathon Writing Challenge: Building with Bolt.

✨ Inspiration

I graduated from university last year with a Philosophy degree — but for me, philosophy isn’t just a qualification written on paper. It’s how I try to live, think, and grow.

So, I thought: What if people could interact with a philosopher by simply speaking to one — just like we imagine having a chat with Socrates?

That’s what led me to create Ask a Philosopher — an AI Voice Agent that listens, thinks, and speaks back.

It was built using the following stack:

  • 🎨 Frontend: HTML + JavaScript + WebAudio API + Text-to-Speech
  • 🧠 Backend: Flask, hosted on AWS EC2
  • 🔌 External APIs: AssemblyAI for Speech-to-Text + Gemini API for philosophical responses
  • 🚀 Deployment: Single EC2 instance with Nginx as a reverse proxy

⚙ Getting Started with Bolt

I visited bolt.new and gave it this prompt:

“I want to build a specialized voice agent with deep domain knowledge that can learn and improve from conversations. It should use Python, AssemblyAI Voice Agent, and Gemini. I’m a Philosophy student, so I want the agent to understand both Western and Eastern Philosophy. Also, I want to integrate AssemblyAI’s Universal-Streaming technology. Guide me step-by-step.”

From that prompt, I started building out the application.

🏗 Dev.to Challenges – by Pravesh Sudha

This repository contains my submissions for various Dev.to Challenges. Each folder in this repo includes a hands-on project built around specific tools, APIs, or themes — from infrastructure to frontend and AI voice agents.

📁 Projects

⚙ pulumi-challenge/

An infrastructure-as-code project built using Pulumi.
It automates cloud infrastructure setup using Python and TypeScript across AWS services.

🎨 frontend-challenge/

A UI/UX-focused project that demonstrates creative frontend solutions using HTML, CSS, and JavaScript — optimized for responsiveness and accessibility.

📩 postmark-challenge/

A transactional email solution built with the Postmark API, showcasing email templates, delivery tracking, and webhook handling.

🧠 philo-agent/

A voice-based AI Philosopher built with AssemblyAI + Gemini — part of the World’s Largest Hackathon.

🗂 Project Structure

dev-to-challenges/
│
├── pulumi-challenge/
├── frontend-challenge/
├── postmark-challenge/
├── philo-agent/
└── README.md

🙌 Why This Repo?

This repo is my playground to:

🛠 Implementation Challenges & Learnings

Setting up the base app was smooth — but voice clarity and response flow were tricky.

I tried multiple voice styles: siri, uk-female, en-us, and more, but finally landed on a simple, clear "male" voice. It felt just right — calm, grounded, and philosopher-like.

Here’s a peek at the code 👇🏻

Then, to give the UI a more classical feel, I enhanced the frontend with a Socrates watermark in the background — minimal but thoughtful.

🌐 Deploying with Bolt

I wanted a reliable and repeatable way to deploy the app to AWS. So, I used Bolt again — and it generated a full deployment bash script for my EC2 instance.

Here’s the deployment script:

#!/bin/bash

# Update system
sudo apt update -y
sudo apt upgrade -y

# Install dependencies
sudo apt install -y python3 python3-pip python3-venv nginx git

# Clone GitHub repo
cd /home/ubuntu
git clone https://github.com/Pravesh-Sudha/dev-to-challenges.git
cd dev-to-challenges/philo-agent

# Set up Python environment
python3 -m venv venv
source venv/bin/activate

# Install packages
pip install -r requirements.txt
pip install gunicorn

# Set up Gunicorn systemd service
sudo tee /etc/systemd/system/voiceapp.service > /dev/null <<EOF
[Unit]
Description=Gunicorn instance to serve Philosophy Voice App
After=network.target

[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/dev-to-challenges/philo-agent
Environment="PATH=/home/ubuntu/dev-to-challenges/philo-agent/venv/bin"
ExecStart=/home/ubuntu/dev-to-challenges/philo-agent/venv/bin/gunicorn --workers 4 --bind 127.0.0.1:8000 app:app

[Install]
WantedBy=multi-user.target
EOF

# Start and enable Gunicorn
sudo systemctl daemon-reload
sudo systemctl start voiceapp
sudo systemctl enable voiceapp

# Configure Nginx with SSL
sudo tee /etc/nginx/sites-available/voiceapp > /dev/null <<EOF
server {
    server_name philosophy.praveshsudha.com;

    location / {
    proxy_pass http://127.0.0.1:8000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade \$http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host \$host;
        proxy_set_header X-Real-IP \$remote_addr;
        proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
        proxy_cache_bypass \$http_upgrade;
    }

    location /static/ {
        alias /home/ubuntu/dev-to-challenges/philo-agent/static/;
    }

    listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/philosophy.praveshsudha.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/philosophy.praveshsudha.com/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
    listen 80;
    server_name philosophy.praveshsudha.com;
    return 301 https://\$host\$request_uri;
}
EOF

# Permissions
sudo chmod -R 755 /home/ubuntu/dev-to-challenges/philo-agent/static
sudo chown -R ubuntu:ubuntu /home/ubuntu/dev-to-challenges/philo-agent/static

# Enable Nginx config
sudo ln -s /etc/nginx/sites-available/voiceapp /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t && sudo systemctl restart nginx

echo "✅ Deployment complete. Visit your app at https://philosophy.praveshsudha.com"

🎙 Final Output

The app is now live at:
🔗 https://philosophy.praveshsudha.com

You can speak your philosophical questions, and the agent responds in a natural, spoken voice — powered by Gemini’s wisdom and AssemblyAI’s transcription magic.

🙌 Shoutout & Thanks

A big thanks to Dev.to and AssemblyAI for organizing these amazing challenges. I learned a lot through this project — from AI voice tech to deploying a full-stack app on the cloud.

If you liked this project or want to connect, follow me on:

Let me know what you’d ask the AI Philosopher! 🤔💭


This content originally appeared on DEV Community and was authored by Pravesh Sudha