This guide covers the standard React integration pattern used across Scenaro experience apps and platform-spa.

Provider stack

ScenaroProvider

Owns the session, creates a shared ScenaroClient and scoped ScenaroEventBus, and injects the current Transport implementation’s RoomContext (LiveKit today) silently — no manual RoomContext.Provider wiring needed.
PropTypeDescription
clientScenaroClientPre-built client instance (preferred for shared config)
apiUrlstringAPI base URL (alternative to client)
apiPathPrefixstringPath prefix, default /v1
storagePrefixstringPrefix for localStorage keys (multi-tenant embeds)
storageStorageAdapter | nullCustom storage (default: localStorage)
Hooks:
  • useScenaro() — full context (client + events)
  • useScenaroClient() — HTTP client only
  • useScenaroEvents() — 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

OptionDescription
scenarioPublication UUID (required, cannot be overridden in start)
languageOptional BCP-47 tag; omit to use the scenario’s configured language
toolsFrontend tool handlers (see below)
onMessageCalled for each ConversationMessage
onErrorCalled with a ScenaroError (has .code)
onSessionEndCalled when the session ends
start(overrides?) accepts option overrides for the session being started — everything except scenario.

Frontend tools

Tools are plain async functions — no requestId plumbing:

Session config

After the config handshake:
  • config — curated { features, collections, avatarEnabled, audioDictationEnabled }
  • rawConfig — full wire payload (restore_state, tool wiring, snake_case fields)
See Tools and features for when to use each.

Advanced: engine handle access

The hook also returns room — 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 to transpilePackages:

Next steps