Skip to Content
Baseera Docs

React

BaseeraProvider, the hooks, and how the React package fits with the UI kit.

@baseera/react connects your React app to a Baseera agent. It holds the session, the messages, the tool loop and the approvals, and exposes them as hooks. It draws nothing itself: the ready-made interface lives in @baseera/ui.

It works in React 18 and 19, in the Next.js App Router and in Vite. Nothing touches window during render, so server rendering is safe. The session id lives in sessionStorage when it is available, so a reload resumes the conversation.

import { BaseeraProvider, useBaseeraChat, useBaseeraTool } from "@baseera/react";

What is in the package

ExportPurpose
BaseeraProviderCreates the client and the chat for everything under it.
useBaseeraChatMessages, status, send, stop, approve, reject, undo.
useBaseeraTool, useBaseeraToolDefinitionRegister a tool the assistant can call.
useBaseeraContextTell the assistant where the user is.
useBaseeraApprovalsBuild your own approval interface.
useBaseeraFeedbackThumbs up and down on replies.
useBaseeraKnowledgeUploadLet a tenant's admins upload documents.
useBaseeraImmersive, useBaseeraImmersiveState, useBaseeraSignal, useBaseeraFieldImmersive mode for the record a user works in.
useBaseeraTheme, useBaseeraAgentThemeRead the theme.

Every hook must run inside BaseeraProvider. Outside it they throw.

Two ways to build the interface

Next steps

On this page