Skip to main content
The platform provides Web SDK to embed agent chat and voice interactions in web applications. The Web SDK (@koreai/artemis-web-sdk) provides a TypeScript/JavaScript library for embedding agent chat and voice interactions in web applications. The SDK supports vanilla JavaScript, React hooks, and a web component for drop-in integration. The browser-facing SDK does not send the public pk_* key directly to /ws/sdk. It first exchanges the key for a short-lived SDK session token on POST /api/v1/sdk/init, then authenticates SDK HTTP routes with X-SDK-Token and the SDK WebSocket with Sec-WebSocket-Protocol: sdk-auth,<token>.

Install Web SDK

The package includes the core AgentSDK constructor, chat and voice clients, React provider/hooks/components, custom elements, rich content renderers, attachment upload, feedback, auth challenge UI, and template utilities.

Quick Start

Vanilla JavaScript

React

Web Component


AgentSDK

The main SDK class. Creates and manages connections, chat clients, and voice clients.

Constructor

SDKConfig

Methods

Static Methods

Events


ChatClient

Handles text messaging with streaming support. Obtained via sdk.chat().

Methods

send() Options

Example: send with attachments
Example: send with per-message metadata
Per-message metadata is validated server-side and is available only for that turn. Use session.messageMetadata as the canonical prompt/template path. message_metadata remains available as the tool-context alias for context_access.read.

Events

Message Type

RichContent Type

Multi-format content variants delivered alongside the plain text response:

ActionSet Type

Interactive action elements the agent sends for user input:

AttachmentRef Type


VoiceClient

Handles voice interactions via WebSocket audio pipeline with optional WebRTC. Obtained via sdk.voice(). The voice client supports two modes:
  • Pipeline mode: Client-side VAD (Voice Activity Detection) captures PCM16 audio, sends it via WebSocket for server-side STT/LLM/TTS processing, and plays back MP3 audio responses.
  • Realtime mode: Native audio I/O via realtime LLM providers with PCM16 streaming.

Methods

Static Methods

Voice States

VoiceInfo Type

VoiceClientOptions

Events

Voice interaction example

React Hooks

The React integration provides a context provider and hooks for state management.

AgentProvider

Wrap your application with AgentProvider to initialize the SDK:

useAgent()

Access the full SDK context:

useChat()

Access chat-specific state:
Example

useVoice()

Access voice-specific state:
Example

File Uploads

Upload files for agent processing:

Supported File Types

  • Images: jpeg, png, gif, webp, svg
  • Documents: pdf, docx, xlsx, pptx, txt, csv
  • Audio: mp3, wav, ogg, m4a
  • Video: mp4, webm

Upload Limits

  • Maximum file size: 25 MB per file
  • Maximum files per message: 10

Styling and Theming

Widget Theming

Customize the web component appearance:
Configure via attributes:

Widget Positions

  • bottom-right (default)
  • bottom-left
  • top-right
  • top-left

Widget Modes

  • chat — Text-only chat interface
  • voice — Voice-only interface
  • unified — Combined chat and voice interface

TypedEventEmitter

All SDK classes extend TypedEventEmitter for type-safe event handling:

WebSocket Message Types

The SDK communicates with the platform over WebSocket. These types are used internally but documented for advanced use cases.

Server Message Types


API Key Management

Public API keys (pk_ prefix) are scoped to a project and provide limited permissions for SDK usage. They are safe to expose in client-side code.

Creating an API Key

  1. Go to Project > Settings > API Keys.
  2. Click Create API key.
  3. Set the allowed origins (for CORS protection).
  4. Copy the key — it is displayed only once.

Origin Restrictions

Configure allowed origins to prevent unauthorized use of your API key:
The runtime validates the Origin header on every SDK request and rejects requests from unlisted origins.

Authentication and Verified Identity

Public API keys cover anonymous and low-assurance chat. For verified user identity, sensitive-data flows, and customer-issued tokens, configure SDK authentication end to end across Studio, the browser SDK, the customer backend, and the runtime. Learn more: SDK end-to-end auth setup guide.