Skip to content

WhiteStoneTak/Sonae

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

187 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Sonae

Beyond alerts. Personal action. One personalized disaster-response agent for every citizen β€” 8,000 of them, all running locally on a single GPU. Built for the AMD Hackathon 2026 β€” Track 3 (Vision & Multimodal AI).

Pick someone from Mirai District, Kawasaki. Live with their typhoon night. Talk to Aki.

License: MIT ROCm vLLM Model Demo


What is Sonae?

You've gotten the same emergency alerts as your friends. You've never gotten one made just for your situation.

The same message β€” to a hundred thousand different people. A warning. Not a plan.

But what if every alert knew exactly what to tell you? And the chain of disasters that follow?

Sonae is one personalized agent per citizen, running entirely on local hardware:

  • AMD Instinct. A single MI300X (192 GB HBM3) β€” no cloud, no sharding, no internet round-trip.
  • Alibaba's Qwen. 122-billion parameters, FP8 quantized.
  • One agent for every citizen, all at once. 8,000 of them, in parallel on the same GPU.
  • For every disaster, and the one after. Cascades are tracked as a chain β€” typhoon β†’ flood β†’ power outage β†’ comms failure β€” not as separate events.

Same typhoon. Three different lives.

A single Cat-4 typhoon hits Mirai-ku. Three of those 8,000 agents reason in parallel β€” same typhoon, three different locations, three different bodies, three different instructions:

  • Wood-frame house, 2nd floor. Insulin nearby. Neighbor Yamada arrives at 11 PM.
  • Concrete tower, 2nd floor. Drive south. Family meets at the relative's home.
  • Ground floor, near the flood zone. Lift vehicle arrives at 8:15 PM.

8,000 personal agents, one for each citizen. Through every disaster, and the next.


What is on the screen

The pitch tells the story across three admin views:

  • /admin/phones β€” the pitch headline. "Three citizens, three cascades." Three preset phones (Hana / Kenta / Misaki) replay hand-authored conversations across three different disasters β€” typhoon flood, M6.8 quake, building fire β€” animating message-by-message to show how the same Aki surface adapts to different lives, profiles, and photos. A real OSM map of Mirai-ku sits underneath with all 8,000 citizen dots placed on actual OSM building footprints (62,753 polygons, Tama River exclusion applied). Static-by-design β€” the live equivalent is the next page.
  • /admin/citizen/[id] β€” the live drill-down. Cascade event feed on the left, one phone in the middle, full citizen profile on the right. The strip is STANDBY until you press Play (no foreknowledge leak); then the agent goes live: every new event triggers a real vLLM 122B call, mocked GPS auto-progresses through at_home β†’ en_route β†’ arrived (6 s / 14 s timers, ref-held so they survive Skip / auto-advance), and Aki's tone shifts from broadcaster to dispatcher commentary ("Detected you left home; proceed directly to Mirai Elementary School.") at each transition. Each Aki bubble carries a tiny ↳ at home Β· 6F RC mid-rise footer (or ↳ arrived at Mirai Elementary School once at the shelter) so the conditioning context is visible at a glance. Three scenario pills (Typhoon & Flood / Earthquake M6.8 / Building Fire) reset and re-seed the timeline; free-form chat (text or photo) interleaves at any time.
  • /admin/live β€” the proof of scale. Three sample agents show the full 5-step reasoning ladder (observation β†’ local impact β†’ predicted secondary effect β†’ personal context β†’ pre-emptive instruction) and classify each event as UPDATE / NO_CHANGE / ESCALATE, while an aggregate bar above counts what every one of the 8,000 agents independently decided for that same event. 5 disaster scenarios anchored to past real events (JMA warning / Kawasaki evacuation / J-ALERT schemas): Typhoon Hagibis 2019, Noto 2024 + Kobe 1995 quake patterns, West Japan 2018 + Kanto-Tohoku 2015 torrential rain, Japan 2018 heatwave, Greater Tokyo 2014 snow. The pitch host can spin a roulette over them on camera.
  • A live vLLM widget ("Pull a live inference") proves the endpoint is real: Next.js API β†’ FastAPI β†’ Qwen3.5-122B-A10B-FP8 on MI300X, returning Aki's headline + body + tool-call trace and showing the wall-clock round-trip (warm target ~6–8 s; cold starts spike higher).

Synthetic disaster scenario demo. All 8,000 citizens are Faker-generated; scenarios are anchored to real records but are not real events. Final decisions rest with humans β€” Sonae surfaces options, it does not issue orders.


Try it β€” touchable visitor demo

Live URL: https://sonae-visitor-lp.vercel.app/

A single-page, role-play experience for hackathon judges and visitors. Pick someone from the 8,000 β€” an 82-year-old wood-frame homeowner, a parent of two in a high-rise, a wheelchair-using web designer β€” and live through their typhoon night with Aki, their in-home Sonae agent.

What you can do in the demo:

  • Be one of 8,000. Random pick + shuffle until a person feels right.
  • Live the cascade. Six narrative events unfold automatically β€” typhoon advisory β†’ evacuation order β†’ river critical β†’ landfall β€” paced as if you were there. No "T-3h" timestamps, just RPG-style "Last evening / Right now / Soon."
  • Talk to Aki. Real chat. Ask anything ("Should I evacuate?" / "My kids are scared" / "Where's my insulin?"). Type freely or tap one of the rotating example prompts tailored to your character.
  • Show Aki photos. Five dummy photos (flooded street / cracked stairs / smoke / heavy rain / calm view) to send during the storm β€” Aki's response shifts based on what you send.
  • Choose where to go. RPG-style location picker after each event β€” stay home, climb to a higher floor, walk to Mirai Elementary, ask Aki to call a neighbor. Aki tracks your current location and tailors advice.
  • Watch the family agents. Mention "kids" or "husband" in chat and a side panel slides in showing each family member being coordinated by their own agent.
  • Watch a neighbor pickup. Pick "Ask Aki to call for help" if you're a wheelchair user β€” Aki contacts a nearby agent, and you see the multi-agent handoff unfold in real time.

Powered by OpenAI gpt-5.4-mini for accessibility (the actual production system runs locally on AMD MI300X with Qwen3.5-122B-A10B-FP8). Disclaimers visible on every screen: synthetic disaster scenario, final decision rests with you, cloud LLM is demo-only β€” production is local for privacy + offline operation during disasters.


Live demo evidence

Checkpoint Scale Result Wall time Throughput
CP3 100 agents βœ“ 100 / 100 54.3 s β€”
CP4 1,000 agents βœ“ 1,000 / 1,000 410 s β€”
Beyond CP4 8,000 agents βœ“ 8,000 / 8,000, 0 errors 2802 s (β‰ˆ47 min) 2.86 agents/s sustained

All measured end-to-end on a single AMD Instinct MI300X (192 GB HBM3) running vLLM nightly + ROCm 7.2 with Qwen3.5-122B-A10B-FP8. See backend/scripts/bench_8k.py and docs/daily_log/2026-05-07.md.


Architecture (one screen)

Browser
  └─ Next.js 16 (sonae-app/, port 3000)
       β”œβ”€ /admin/phones         pitch headline β€” 3 phones Γ— 3 cascades, animated reveal
       β”œβ”€ /admin/citizen/[id]   drill-down β€” 1 phone + live vLLM chat + auto-GPS
       β”œβ”€ /admin/live           proof of scale β€” 3 reasoning ladders + 8K aggregate bar
       β”œβ”€ /admin/heatmap        Overview density / Individual 8000 dots
       β”œβ”€ /admin/timeline       sec-granularity cascade feed
       β”œβ”€ /admin/metrics        CP3 / CP4 / 8K checkpoint history
       β”œβ”€ /admin/priority       outreach queue (top 24 risk-ranked)
       β”œβ”€ /admin/pitch          1-screen recording dashboard
       └─ /citizen/[id]         resident smartphone view (Aki)
                  β”‚
                  └─ /api/live-instruction  ──>  FastAPI (backend/, port 8001)
                                                    └─ POST /agents/random/instruction
                                                            β”‚
                                                            └─ vLLM nightly (MI300X, port 8000)
                                                                    Qwen3.5-122B-A10B-FP8

Languages: TypeScript (frontend), Python 3.11+ (backend). State: 8,000 synthetic citizen profiles in sonae-app/data/citizens.json (Faker ja_JP); 5 scenarios in backend/data/scenarios/*.json and matching sub-event files in sonae-app/data/scenarios/.

Public visitor LP (separate surface) lives at sonae-app/src/app/(visitor)/experience/[id]/, deployed independently to Vercel with NEXT_PUBLIC_LP_MODE=true so a Next 16 proxy hides the admin/citizen routes from the public URL. Chat goes through OpenAI gpt-5.4-mini (rate-limited per IP, daily $-cap) and falls back to a deterministic canned reply when the cap is reached or the API fails.


Run it locally

1. Frontend

cd sonae-app
npm install
npm run dev
# http://localhost:3000/admin/live

The admin UI works fully on its own β€” judge() is a rule-based mock written in TypeScript. No backend or GPU required to see the cascade.

2. Backend (Mock mode β€” no GPU needed)

cd backend
.venv/bin/python -m uvicorn api.main:app --host 127.0.0.1 --port 8001

/admin/live "Pull a live inference" widget will round-trip through the backend and return a deterministic mock string (generated_by: "mock").

3. Backend (Real vLLM mode β€” requires MI300X)

# 1. SSH tunnel from MI300X (port forward vLLM)
ssh -L 8000:localhost:8000 root@<MI300X public IP>

# 2. Confirm vLLM is up (separate session)
ssh root@<MI300X public IP> 'docker exec rocm pgrep -af "vllm serve"'

# 3. Start backend with vLLM env
SONAE_VLLM_BASE=http://localhost:8000 \
SONAE_VLLM_MODEL=<vLLM --model name> \
  .venv/bin/python -m uvicorn api.main:app --host 127.0.0.1 --port 8001

The widget badge flips from "Mock fallback" (amber) to "vLLM (live)" (green).

Detailed setup: docs/decisions/2026-05-07_local_dev_check_guide.md.


What's mock vs what's real

Layer Status
8K-agent bench (CP3 / CP4 / 8K) Real β€” measured on actual MI300X
Live vLLM endpoint Real β€” Qwen3.5-122B-A10B-FP8 OpenAI-compatible server
/admin/citizen/[id] chat (Aki replies + position commentary) Real β€” every send routes to vLLM 122B; canned only on backend offline
/admin/live per-citizen judge Rule-based mock (plug-replaceable with vLLM via /api/live-instruction)
GPS / position state on /admin/citizen/[id] (at_home β†’ en_route β†’ arrived) Mock β€” fake auto-progression on a 6 s / 14 s timer (ref-held against Skip)
Movement model on /admin/heatmap and /admin/pitch Mock β€” distribution per scenario step (citizenMovement.ts)
Citizens (8,000) Synthetic β€” Faker ja_JP, no real persons; placed on OSM building footprints
Scenarios Synthetic β€” schema and numbers anchored to real disaster records (JMA / MLIT / TEPCO / NTT-East / Cabinet Office / FDMA)
Agent memory 2-turn window only (T-1, T0)
Final decisions are made by humans, not by AI. Banner present on every citizen-facing screen

Sonae is a synthetic disaster-scenario demo. It is not β€” and will not be β€” used during a real disaster.


Repo layout

sonae-app/                       Next.js 16 (App Router)
  src/app/(admin)/                admin operations dashboard
    admin/phones/                  pitch headline (static 3-up, animated)
    admin/citizen/[id]/            drill-down (live vLLM chat + auto-GPS)
    admin/live/                    8K aggregate cascade view
  src/app/(citizen)/              resident smartphone view
  src/app/api/                    citizen-chat, live-instruction, cascade-judge proxies
  src/components/admin/phones/    PhoneFrame, PhoneScreen, RealMiniMap, TriplePhoneView
  src/components/admin/citizen/   CitizenChatView, EventsPanel, ProfilePanel
  src/components/admin/live/      EventTimeline, CitizenColumn, AggregateBar, ...
  src/lib/                        agentJudgement, scenarioPlayer, aggregateJudgement,
                                  citizenDisplay (JP→EN), eventTimelines, demoConversations
  data/citizens.json              8,000 synthetic citizens (enriched: chronic 46% / work.location 73% / network.emergency_contact 100%)
  data/scenarios/*.json           5 sub-event files

backend/                         FastAPI + Pydantic v2
  api/main.py                     entrypoint
  api/routes/                     /agents/{id}/instruction, /random, /batch, /metrics
  api/clients/vllm_client.py      Mock + Real (OpenAI-compatible)
  agents/                         loop, state (2-turn memory), tools, movement, prompts
  data/scenarios/                 5 scenarios with historical_reference
  scripts/bench_8k.py             8,000-agent live benchmark

docs/
  design_v2.md                    canonical spec
  daily_log/2026-05-04..07.md     day-by-day record
  decisions/                      handoffs, dev guides, button specs

Hackathon submission

Built in Vancouver. For Japan.


License

MIT β€” see LICENSE.

The repo includes synthetic citizen profiles (Faker ja_JP) and disaster scenario JSON whose schema and numbers are anchored to publicly published records by Japan Meteorological Agency, Ministry of Land Infrastructure Transport and Tourism, Cabinet Office Disaster Management, Fire and Disaster Management Agency, Tokyo Electric Power Grid, and NTT-East. No personal data is used.


Acknowledgements

  • AMD for the Hackathon 2026 program and the Developer Cloud MI300X access
  • vLLM team for the ROCm-enabled nightly
  • Qwen team for releasing Qwen3.5-122B-A10B-FP8

πŸ€– Built with Claude Code.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors