AAI SDK
    Preparing search index...

    Function createSessionCore

    • Create a framework-agnostic voice session core that connects to an AAI server via WebSocket.

      Uses a subscribe/getSnapshot pattern for state management, compatible with React's useSyncExternalStore and other external store integrations.

      Most clients never call this: client() creates a core and installs it in React context for the hooks. Reach for it directly when building a non-React UI (or wiring the session into another framework's store).

      Parameters

      Returns SessionCore

      A SessionCore handle for controlling the session.

      import { createSessionCore, type SessionSnapshot } from "@alexkroman1/aai-ui";

      declare function render(snapshot: SessionSnapshot): void;

      const session = createSessionCore({ platformUrl: "https://host/my-agent/" });
      session.subscribe(() => render(session.getSnapshot()));
      session.start();