Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

SDK Overview

@amodalai/react connects a web application to a deployed Amodal runtime over HTTP and server-sent events.

NeedUse
Add chat to a React appChatWidget, available from @amodalai/react/widget.
Build a UI with agent actions, sessions, and eventsAmodalProvider and hooks.
Render inline chat inside a providerAmodalChat.
Call runtime APIs from imperative codeRuntimeClient, SdkClient, or ChatClient.

Install

npm install @amodalai/react

The package requires React and React DOM 18 or 19. Import its stylesheet when using the chat components.

Hosted React app

For an app served on the agent's origin with the default team login:

import { AmodalProvider, AmodalChat } from '@amodalai/react';
import '@amodalai/react/style.css';
 
export function App() {
  return (
    <AmodalProvider runtimeUrl={window.location.origin}>
      <AmodalChat />
    </AmodalProvider>
  );
}

The hosted cookie authenticates same-origin calls. Use direct runtime access when users are trusted to access the agent's sessions across scopes.

For a multi-tenant product, point the SDK at an application proxy that retains runtime credentials and authorizes each scope, session, and operation. Return your application token through getToken, passing the callback separately to the provider and chat component. See Authentication and Embedding.