useChat protocol or an OpenAI-shaped protocol, the chat facade in @opengeni/sdk/chat gives it an Opengeni backend. It also powers server-side bots.
Serve your chat routes
handleChat for:
Each tenant maps to a workspace and each conversation to a session. Keep one stable conversation id per thread (custom clients send it in
x-opengeni-conversation). The workspace and the user’s membership are created on first use (see Users & tenants). agent takes the same object as Configure the agent.
The Vercel and OpenAI formats send only the latest user message. Earlier messages are imported once, when the session is created; after that, Opengeni keeps the history.
Stream into an existing AI SDK route
To keep an existinguseChat route with its own request body, write the reply into your own UI message stream with uiMessageStreamParts:
toolParts: true adds tool activity indicators (status only, not results). framing: false lets the outer stream own message framing.
Server-side bots
chat.stream(message) streams text, tool activity, and pending decisions. chat.snapshot() restores history, and chat.respond(input) answers a pending approval or question.
Move to the full conversation later
og.client is the full SDK client, and each chat exposes its workspaceId and sessionId. Render the same session with SessionConversation when you are ready. The chat quickstart is a runnable backend.
On sign-out or an account switch, abort in-flight requests and clear cached messages and session ids.