THE DEMO VIDEO SOMEHOW NOT SHOWING AUDIO OF LIVE AGENT BUT PLEASE CHECK WEBSITE (AstrologyBot.ai) to verify Audio
Inspiration Last year I went to see the Taj Mahal. Beautiful place, incredible experience. On the way out, I ended up with this jyotish ji (astrologer) who offered to look into my life. I've never really believed in astrology, but just for fun I said why not. He did his reading, we laughed about some predictions, moved on, forgot about it. Then a couple weeks back, me and my wife were talking about some life stuff, and one of his predictions actually came true. That got us thinking. Is there really something to this? Do I believe in astrology now? Still not much. But the curiosity was enough. I thought, what if I build an AI that combines two ancient divination systems, palm reading and birth chart analysis, in one live real-time voice conversation? Not a chatbot. A live experience where you show your palm to the camera and the AI reads it while talking to you, cross-referencing everything with your Vedic birth chart. That's how AstrologyBot.ai was born.
What it does AstrologyBot is the first AI that reads your palm AND your birth chart together, live. You enter your birth details, and Nano Banana generates an astronomically accurate Vedic Kundli chart image on the fly. This is the most complicated chart I've seen any image model generate correctly. Then you start a live voice and camera session. Show your palm. The AI Guru reads your lines, cross-references them with your birth chart, and talks to you naturally in real-time. You can interrupt it mid-sentence. It responds in under 200 milliseconds. Beyond the live session, there's an ADK-powered multi-agent system for text-based astrology chat, personalized life readings covering past, present, and future, and monthly cosmic analysis. A jargon filter automatically replaces every technical astrology term with plain English so you never see "Saturn in your 10th house" but instead get "the discipline energy in your career area."
How I built it Three Gemini models working together. The Live API handles bidirectional audio plus video streaming for the palm reading session. Nano Banana generates the Vedic Kundli chart images. And Gemini Flash powers an ADK multi-agent system for conversational advice. The hardest engineering problem was the Kundli image generation. The North Indian Kundli is a diamond grid with 12 triangular houses, and planet abbreviations need to land in exactly the right section. Telling Gemini "put Rahu in House 4" produced hallucinated positions every time. So I developed a technique I call Spatial Prompt Engineering where instead of abstract house numbers, the prompt describes physical positions: "write Ra 13°24' inside the LOWER-RIGHT triangle." That got us to 100% accurate planet placement. Planet positions themselves come from Swiss Ephemeris calculations, so the astronomy is real, not made up. For the live palm reading, the user's birth chart data is pre-fetched from the agent API and baked into the Gemini Live system instruction before the session connects. That means zero API calls during the actual streaming session. Just audio and video flowing back and forth. The browser's built-in Acoustic Echo Cancellation handles the echo problem for free, so the mic stays always hot and Gemini's server-side VAD detects when the user speaks. No push-to-talk, no half-duplex gating. The ADK layer uses ParallelAgent to run Past, Present, and Future readings concurrently, making the initial reading 3x faster than doing them one at a time. A SequentialAgent handles monthly readings with a two-step pipeline: first a planner agent fetches the scored data, then a writer agent formats it into plain English bullets. Callbacks on every agent automatically scan Gemini's output for astrology jargon and replace it before the user ever sees it. The frontend uses two separate AudioWorklet processors. One for mic capture that downsamples from 48kHz to 16kHz and converts Float32 to Int16 PCM. Another for playback that queues incoming PCM chunks at 24kHz and streams them as one continuous audio output. Getting that playback worklet right was its own saga. The Web Audio API's process() method takes (inputs, outputs) not just (outputs). Using the wrong signature silently fails because the outputs parameter binds to the inputs argument, the queue fills up, but nothing ever plays. That one cost a full day.
Challenges I ran into Audio was the biggest challenge by far. The first version played each tiny PCM chunk as a separate AudioBufferSourceNode. Worked for the greeting, then died. Sounded like a robot having a seizure. The second version added half-duplex mic gating to prevent echo, but that blocked the mic for 15 seconds after every Guru response because turn_complete signals from Gemini arrived way later than the actual last audio chunk. Third version tried timer-based ungating. Fourth version had no audio at all because of the AudioWorklet signature bug. Fifth version crashed the backend with CancelledError because Python's asyncio.CancelledError is a BaseException, not an Exception. Sixth version finally worked after reading the O'Reilly "Multimodal Real-Time AI Agent Systems" book cover to cover and studying Google's official bidi-demo reference implementation. The answer was embarrassingly simple: let the browser handle echo cancellation, keep the mic hot, use a proper playback worklet with a queue, and catch CancelledError explicitly. The Kundli chart generation went through its own evolution. Early prompts produced charts where planets appeared in wrong houses, duplicated across multiple sections, or had made-up degree values. The breakthrough was realizing that Gemini's image model thinks spatially, not abstractly. It doesn't understand "House 4" but it perfectly understands "the triangle in the lower-right corner of the diamond."
Accomplishments that I am proud of The live palm reading actually works. You show your palm, the AI sees it through the camera, reads the lines, and talks about what it sees while referencing your birth chart. All in real-time with natural interruption support. That felt like science fiction when it first worked end to end. The Kundli chart generation is something I haven't seen any other AI product do correctly. A geometrically accurate North Indian diamond grid with 9 planets placed in their astronomically correct houses, proper abbreviations with degree values, zodiac symbols, Sanskrit text, and a traditional parchment aesthetic. All generated from a single prompt on the fly. The jargon replacement system means a user with zero astrology knowledge can use the product and understand every word. No "Rahu mahadasha in your 7th house." Just "a period of intense ambition energy in your relationship area." And the whole thing runs on two services. A GCE VM for the database and private agent, and a single Cloud Run container for all Google integrations. Simple, cheap, production-ready.
What I learned Browser echo cancellation is free and it's good. We spent days building half-duplex mic gating when the answer was just letting the browser handle it. The O'Reilly book on real-time AI agents literally says "the browser handles AEC for us for free" and it's right. AudioWorklet APIs are unforgiving. Wrong method signature? No error, no warning, just silence. You have to read the spec carefully. Spatial prompt engineering is a real technique for image generation. When the model doesn't understand your abstract concept, describe the physical result you want instead. Works for charts, diagrams, layouts, anything with spatial structure. Pre-baking context into system instructions beats real-time tool calls for streaming sessions. The latency difference is night and day. ADK's ParallelAgent is a genuine productivity win. Running three independent readings concurrently instead of sequentially cuts response time from 30 seconds to 10. Same quality, 3x faster. And Gemini's model ecosystem is deeper than most developers realize. Live API, Nano Banana with multiple flavors, Flash for agents, native audio models. Each strong on its own. Together it's a full platform.
What's next for AstrologyBot.ai Moving PostgreSQL to Cloud SQL with a graph database solution for the astrological knowledge relationships. Adding persistent memory so the Guru remembers previous sessions and can track how predictions play out over time. Exploring Gemini's affective dialogue capabilities so the Guru can detect emotional tone in the user's voice and adjust its responses accordingly. Building a mobile app with react-native-audio-api for native AudioWorklet support. And eventually, multilingual support so the Guru can speak Hindi, Tamil, and other Indian languages where Vedic astrology has the deepest cultural roots. The jyotish ji outside the Taj Mahal started this whole thing. Maybe the AI version will surprise people too.
Built With
- apache-age
- artifact-registry
- fastapi
- gemini-2.5-flash
- gemini-3-pro-image-preview-(nano-banana)
- google-adk-(agent-development-kit)
- google-cloud-run
- google-compute-engine
- google-gemini-live-api
- google-genai-sdk
- javascript
- pgvector
- postgresql
- python
- react
- web-audio-api
- websockets
Log in or sign up for Devpost to join the conversation.