TSAI_CHENG-HUNG
ALL PROJECTS
PROJECT_FILE · 2025–2026 · ★ FEATURED

Ziwei Doushu AI Platform — From a Take-Home Test to a Full Multi-Agent Product

An account-based AI fortune-telling platform pairing a deterministic Ziwei Doushu chart engine (iztro) with a genuine parallel multi-agent LangGraph pipeline, RAG knowledge base, and a full subscription/token system — deployed on Docker + Render.

Solo developer
LangGraphGoogle GeminiiztroChromaDB RAGFastAPIPostgreSQLNext.js 14Docker

TL;DR

An AI platform that turns a Ziwei Doushu (Chinese astrology) reading into something you can actually trust and inspect: the chart is computed by a real astrology engine — never guessed by an LLM — and the analysis is produced by three independently-personaed AI agents working in parallel, then merged by a fourth. Around that core sits a full product shell: accounts, saved charts, a streaming chat with a fortune-teller persona, and a subscription system with usage-based tokens.

Why I Built This

This project began as a take-home test before an internship — a simple linear pipeline where an LLM both "drew" and interpreted a chart. Two things bothered me about that approach. First, LLMs hallucinate charts: ask the same birth data twice and you can get two different star placements, which is a non-starter for anything claiming to be an analysis tool. Second, most "multi-agent" demos I'd seen were really just one model switching personas in a loop — convincing in a demo, but not an actual multi-agent system. I kept rebuilding this project, partly to fix both problems properly, and partly to push it from a weekend script into something with the shape of a real product: accounts, persistence, billing logic, and deployment.

System at a Glance

Ziwei Doushu Multi-Agent AIZiwei Doushu Multi-Agent AI

  1. The frontend computes the chart with the official iztro engine directly in the browser — the same JSON is used to render the chart board and sent to the backend, so what the user sees and what the AI reasons over are guaranteed to match.
  2. The chart is POSTed to a FastAPI backend, where a LangGraph graph runs: a researcher node retrieves shared context from a ChromaDB RAG knowledge base, then fans out to three parallel Gemini agents — a reasoning analyst, a domain expert, and a creative interpreter — and fans back in to a coordinator that synthesizes the final report.
  3. Around that core sits an account layer (PostgreSQL + JWT + Google OAuth), a sidebar app shell (saved charts, career/love fortune tools, a real-time streaming chat with the persona "玄機子"), and a subscription system that meters usage with "star tokens."

Why These Technology Choices

What I'm Most Proud Of

1. A genuinely parallel multi-agent pipeline, not role-play. The graph fans out from researcher to three independently-personaed Gemini calls running concurrently, and fans back in to a coordinator. The tricky part was the shared state: three branches writing to the same agent_outputs field at once would normally clobber each other, so I used LangGraph's operator.add reducer to merge concurrent writes safely. The frontend then exposes each agent's individual analysis in an expandable "multi-agent process" view — and LangSmith traces show the three calls overlapping on the timeline, which is the actual proof that this is parallel execution, not sequential persona-switching dressed up as one.

2. The chart as a single source of truth. The same iztro-computed JSON renders the on-screen chart board and is what the backend reasons over — so the chart a user sees is, by construction, identical to the chart the AI is interpreting. This single design decision removed an entire class of "the AI made up a star that isn't even on my chart" complaints.

3. A real subscription/token economy. Three plans (free / basic / premium) gate features (career tools, love tools, compatibility analysis) and meter usage through "star tokens" — every chat message, analysis, and profile creation has a token cost, backed by an atomic balance-and-ledger system with monthly refresh. It's a small thing to describe, but it's the difference between a demo and something that could actually run as a product.

Challenges & How I Solved Them

Results

Looking Back, Looking Forward

The biggest lesson was learning to tell the difference between "an LLM playing multiple roles" and "an actual multi-agent system" — and, more importantly, how to prove which one you've built using tracing tools rather than taking the architecture diagram's word for it. The second was learning to anchor an LLM product on a deterministic ground-truth data source whenever one exists, instead of asking the model to do something it's structurally bad at.

Looking ahead: wiring the subscription system to a real payment provider (it currently runs on manual plan assignment), adding more fortune domains beyond career/love/compatibility, exploring automated quality scoring across the agents' outputs, and tightening the mobile experience.

Ziwei Doushu AI Platform — From a Take-Home Test to a Full Multi-Agent Product — Tsai Cheng-Hung