Core SDK overview
@orga-ai/core is the framework-agnostic foundation that all other Orga SDKs rely on. It stores configuration, houses shared types, and exposes helpers (like connectToRealtime) that send WebRTC offers to Orga Cloud. Client adapters—React, React Native, future platforms—sit on top of it.
What core provides
- Configuration management –
OrgaAI.init()andOrgaAI.getConfig()establish global defaults (model, voice, endpoints). - Transport helper –
connectToRealtime()takes the SDP offer + credentials created by an adapter and forwards it to/v1/realtime/calls. - Types & constants – Source of truth for enums such as
ConnectionState,OrgaAIModel, and shared error classes. - Utilities – Logging, telemetry hooks, and helper functions (media constraint builders, session config fetchers).
- Ports – Interfaces that adapters implement to plug their platform-specific WebRTC logic into core without introducing bundle bloat.
What it deliberately does not do
- No WebRTC peer connection creation.
- No media device management.
- No framework-specific hooks or components.
Those responsibilities belong to adapters like @orga-ai/react and @orga-ai/react-native.
Why a dedicated core exists
- Consistency – When types or behaviors change, adapters inherit them automatically.
- Reduced duplication – Authentication helpers, logging, and configuration validation live in one place.
- New platform runway – Building a new adapter (Vue, Unity, etc.) means implementing the ports defined by core rather than reinventing orchestration logic.
How adapters use it
- Adapter calls
OrgaAI.init()with user-provided config. - Adapter creates its own peer connection, collects ICE, and assembles the SDP offer.
- Adapter invokes
connectToRealtime()from core, passing the offer plus{ ephemeralToken, iceServers }. - Core forwards the request to Orga Cloud and returns the SDP answer +
conversation_id. - Adapter applies the answer to its peer connection and updates UI state.
When you might use core directly
- Authoring a custom adapter or automation service outside React/React Native.
- Building headless scripts that control Orga sessions without rendering UI.
- Prototyping experimental transports while still leveraging Orga’s authentication flow.
For everyday app development, prefer the higher-level adapters—they wrap core in ergonomics, handle media, and track edge cases for you.
Where to go next
- Dive into the core architecture explanation for diagrams and layering notes.
- Need the hands-on flows? Start with the React or React Native tutorials.
- Looking up type definitions? Consult the reference for core exports (client SDKs re-export core types).
Last updated on