Skip to Content
🚀 Orga AI is in open beta.

Core SDK architecture

The core package is a thin, framework-agnostic layer that centralizes configuration and shared logic. Client adapters plug into it but keep platform-specific code (WebRTC, UI primitives) on their side of the boundary.

Layered view

Responsibilities by layer

Core concernDescription
ConfigStores SDK-wide options such as default model/voice, session config fetchers, log level.
API bridgeconnectToRealtime sends SDP offers + ICE candidate payloads to Orga and returns the SDP answer.
Shared typesSingle source for ConnectionState, OrgaAIModel, SessionConfig, etc. Adapters re-export them.
UtilitiesLogging, validation helpers, optional functions like fetchSessionConfig.
Error classesStandardized errors so adapters can respond uniformly.

Adapter responsibilities (not core)

  • Creating and managing RTCPeerConnection.
  • Grabbing media devices, toggling mic/camera, handling permissions.
  • Rendering UI controls or exposing framework-specific hooks.
  • Translating native events into React/React Native state updates.

This separation lets core stay tiny and testable while adapters can evolve independently.

Data path recap

  1. Adapter collects SDP offer + ICE candidates using its platform APIs.
  2. Adapter calls connectToRealtime(offer, params) from core.
  3. Core reads global config (set via OrgaAI.init()), attaches auth headers, and POSTs to /v1/realtime/calls.
  4. Orga returns { answer, conversation_id }; core hands it back to the adapter.
  5. Adapter applies the answer to the peer connection and continues streaming.

Core never touches DOM APIs, native modules, or even Node-specific constructs—only plain TypeScript plus fetch.

Developer implications

  • Changing a type or error in core automatically updates React and React Native packages because the monorepo links them via TypeScript project references.
  • When debugging cross-platform issues, compare behavior at the adapter layer first; if the bug exists in both, it probably lives in core.
Last updated on