Overview
The Sunny Agents SDK is a TypeScript/JavaScript library that enables you to embed AI-powered chat experiences into any web application. Use createSunnyChat to drop in a fully-featured chat widget with automatic authentication and server-driven configuration.
What you can build
The SDK is designed specifically for healthcare applications:
Help patients find in-network providers by specialty, location, and availability. Book appointments in seconds with AI-powered guidance.
Provide reliable health information and support 24/7. Answer questions about symptoms, medications, and care options.
Guide employees and members through their healthcare benefits. Help them understand coverage and find cost-effective care options.
Streamline care coordination by connecting patients with the right providers at the right time, reducing ER visits and improving outcomes.
Core capabilities
Two authentication methods: custom token exchange and passwordless email/SMS. Automatic token management and refresh.
Pre-populate user profiles, addresses, insurance, and dependents during authentication. Supports static data and async providers.
Rich content delivered inline in messages via WebSocket. Parse embedded JSON for doctor profiles and structured data.
Conversations, messages, events, MCP approvals, file attachments, and state management.
REST and WebSocket API schemas and message types.
Partner setup
publicKey and partnerIdentifier are obtained from Sunny Central, the partner portal. Sign in at platform.sunnyhealthai.com (production) or platform.sunnyhealthai-staging.com (staging), then go to Developer Tools to create API keys, view your partner name, and configure authentication (allowed domains and token exchange). See Partner Setup for details.
How it works
createSunnyChat fetches your partner’s auth configuration from the server via the /sdk/config endpoint, activates the chosen authentication mode, and renders a chat widget in your container. The WebSocket connection is established when the user sends their first message.
Architecture diagram
Getting started
Provide your partner identifier, public key, and auth type — all authentication configuration is handled automatically by the server:
Authentication modes
The SDK supports two authentication methods. You specify the authType and the SDK handles everything else using server-provided configuration:
Custom Token Exchange
For applications with their own authentication (Auth0, Firebase, custom providers):
Passwordless Authentication
Email or SMS-based authentication without passwords. The SDK renders a verification UI in the chat automatically:
Key features
- Real-time streaming - Messages stream in real-time as they’re generated
- Type-safe - Full TypeScript support with comprehensive type definitions
- Event-driven - Subscribe to events for snapshot updates, streaming deltas, and more
- Artifact support - Parse and render rich content delivered inline in messages
- MCP approvals - Handle tool execution approvals interactively
- File attachments - Send files as base64-encoded attachments
- Automatic reconnection - WebSocket connections automatically reconnect on failure
- Token management - Automatic token refresh and caching
Framework compatibility
The SDK is framework-agnostic and works with:
- React - Mount
createSunnyChatin auseEffecthook - Vue - Mount in
onMountedlifecycle - Angular - Use with Angular services and components
- Vanilla JavaScript - Use directly in any web page
Installation
Getting help
Get up and running in minutes
REST and WebSocket API schemas
Authentication modes and setup
Learn core concepts and patterns
Need help? Check out our Quickstart guide to get started, or browse the API Reference for token exchange and message schemas.