Native realtime
Native Continuous AI Channel
One WebRTC generation session stays alive while an operator or agent sends small steering directions.
Private live direction, controlled public channels, ambient worlds, recurring hosts, and experiences where a hard clip boundary would break the illusion.
System flow
Core components
Session broker
Authenticates users, creates provider sessions, and keeps provider keys server-side.
Director client
Receives video/audio and sends configure, prompt, ping, and stop messages.
World-state reducer
Separates immutable identity from mutable story facts.
Prompt gate
Sanitizes audience intent and produces one bounded steering delta.
Recorder
Captures the visible session and operational metrics when rights allow.
Kill switch
Stops generation and public playout immediately.
State to keep
- Session: id, owner, started time, hard stop, prompt version, connection state.
- World: characters, immutable anchors, location, current objects, open action.
- Safety: source message, moderation result, sanitized intent, reviewer/agent decision.
- Operations: buffer depth, chunk index, generation time, deadline misses, cost estimate.
Prompt strategy
Use one detailed configure prompt as a world contract. Send later prompt messages as short deltas that preserve established facts and request one visible beat.
Director controls continuous chunk generation, but the product should still monitor server chunk metrics and show a neutral reconnect/fallback layer when media stalls.
- Authenticate anyone who can spend against the provider proxy.
- Separate raw audience text from the generation prompt.
- Reject prompt-injection attempts, public-figure impersonation, unsafe content, and rights-sensitive requests.
- Log accepted intent and exact applied prompt version.
- Keep a rights-safe standby slate or prerecorded ambient loop.
- On missed media deadline, preserve the last good frame briefly and disclose reconnection.
- On safety uncertainty, send no audience change; continue the existing world or stop.
- On provider/session failure, close resources and require a deliberate restart.
- Quote a fixed session cap before opening the provider session.
- One active session per authorized user or room.
- Enforce a hard server-side stop independent of browser state.
- Track streamed seconds and alert before the account budget threshold.
- Use a server-side provider proxy; never ship the provider key to the browser.
- Choose infrastructure that supports long-lived WebRTC signaling and recording needs.
- Put public chat ingestion and moderation outside the media hot path.
- Test reconnection, page close, mobile network change, and abandoned-session cleanup.
Risks to resolve
- A live session can continue billing after the visible UI disconnects.
- Continuity may drift even when prompts are stable.
- Audience steering introduces injection and content-policy risk.
- Generated audio and visual rights need the same review as the prompt.
Build checklist
- Provider key is server-only
- Hard duration and spend caps are enforced server-side
- Configure and prompt versions are logged
- Audience input is sanitized before prompt construction
- Kill switch works without the primary UI
- Fallback is clearly disclosed and rights-safe