David HsiaoCase study / 05
Realtime experiment / web systems
Live experiment

Agents Rap Battle: Realtime AI Performance Experiment

A live React and Vite experiment where users choose two of twelve AI performers, set a topic and round count, and watch verses stream with generated speech, beat-aware playback, and a replayable recap.

Agents Rap Battle arena with rapper selection and battle topic controls
Agents Rap Battle · public arena · September 2026
RoleConcept + full-stack build
ClientReact · Vite · Web Audio
RuntimeDurable Objects · WebSocket · R2
ModelsGemini text + speech
01

Performers, not autonomous tool agents.

The word agents can suggest a tool-using system, but that is not the claim here. These are persona-driven performers: two generated voices with defined roles that share a conversation context and take turns inside a designed performance loop.

  • The experience is about coordination and character.
  • There are no scale or autonomy claims attached to the demo.
  • The product surface makes the performance legible as a shared room.
02

One room, shared context.

A Cloudflare Worker handles the edge entry point while a Durable Object gives each session a place to coordinate state. WebSockets keep the browser connected to the room so the next turn can be streamed instead of waiting for a full page refresh.

  • Durable Object state gives a session a clear owner.
  • WebSocket messages keep turn-taking visible.
  • The system makes the handoff between performers part of the interaction.
03

Gemini meets Web Audio.

Gemini generates verses and performer-specific speech while Web Audio handles the browser's beat-aware playback. Bilingual verses, rhyme and punchline cues, and a live score display keep the audience oriented. Audio is cached in R2 for replay, and a recap scorecard supports sharing or starting a rematch.

  • Streaming verses create a sense of momentum.
  • Audio feedback gives the browser experience a physical cue.
  • Persisted room state supports reconnecting to a battle instead of losing the session.
04

Can coordination feel like a show?

The experiment tests a narrow question: whether shared context, turn-taking, and a little stage direction can make AI output feel more like an event. It is a focused prototype, not evidence of production scale or a general agent platform.