Provider stack
ScenaroProvider
Owns the session, creates a sharedScenaroClient and scoped ScenaroEventBus, and injects the current Transport implementation’s RoomContext (LiveKit today) silently — no manual RoomContext.Provider wiring needed.
| Prop | Type | Description |
|---|---|---|
client | ScenaroClient | Pre-built client instance (preferred for shared config) |
apiUrl | string | API base URL (alternative to client) |
apiPathPrefix | string | Path prefix, default /v1 |
storagePrefix | string | Prefix for localStorage keys (multi-tenant embeds) |
storage | StorageAdapter | null | Custom storage (default: localStorage) |
useScenaro()— full context (client+events)useScenaroClient()— HTTP client onlyuseScenaroEvents()— event bus only
useScenaroSession
The single entry point for a session. It handles the full lifecycle — identify, start session, Transport connect/disconnect — plus the data channel, config handshake, and tool RPC internally.Options
| Option | Description |
|---|---|
scenario | Publication UUID (required, cannot be overridden in start) |
language | Optional BCP-47 tag; omit to use the scenario’s configured language |
tools | Frontend tool handlers (see below) |
onMessage | Called for each ConversationMessage |
onError | Called with a ScenaroError (has .code) |
onSessionEnd | Called when the session ends |
start(overrides?) accepts option overrides for the session being started — everything except scenario.
Frontend tools
Tools are plain async functions — norequestId plumbing:
Session config
After the config handshake:config— curated{ features, collections, avatarEnabled, audioDictationEnabled }rawConfig— full wire payload (restore_state, tool wiring, snake_case fields)
Advanced: engine handle access
The hook also returnsroom — the current Transport implementation’s engine handle (LiveKit
Room | null) — for advanced use cases. Most apps never need it — see
Advanced: Transport extensions.
The hook is powered by the headless
ScenaroSession class from @scenaro/sdk, usable outside React. See the ScenaroSession reference.Next.js
Add the SDK totranspilePackages: