Skip to main content
The web Assistant SDK is a set of npm packages under the @metabindai scope. The fastest path is @metabindai/agent-ui: a prebuilt React chat surface that streams from Metabind’s Agent proxy, calls your project’s tools, and renders Interactive Tool output in sandboxed iframes. Configure it with your project credentials and render <AgentChat /> — or drop to the lower-level typed streaming client and Vercel AI SDK transport when you want to build your own UI.

SDK on GitHub

metabind-web — the web Assistant SDK monorepo (Apache 2.0).

Example app

A minimal clone-and-run React chat app built on the published packages.

Packages

Requirements

  • React 18.3+ (react and react-dom are peer dependencies)
  • A Metabind project with published tools
  • A project-scoped Metabind API key
@metabindai/agent-ui and @metabindai/agent-shell ship as TypeScript source, so your bundler compiles them alongside your app. The example app uses Vite.

Start from the example app

The quickest way to a working chat is to copy the example app and point it at your project:
1

Copy the example app

2

Get your credentials

You need an org ID, a project ID, and a project-scoped API key. The fastest path is the metabind CLI:
3

Configure and run

Copy .env.example to .env.local, fill in VITE_METABIND_ORG_ID, VITE_METABIND_PROJECT_ID, and VITE_METABIND_API_KEY, then:
There’s no server-side code in the app — the Agent proxy is the backend.

Add the chat to an existing app

Install

Serve the sandbox proxy

Copy sandbox_proxy.html from the package’s public/ folder into wherever your app serves static files. Interactive Tool UIs render inside it. If you serve it somewhere other than /sandbox_proxy.html, point configureChat({ sandboxUrl }) at it.

Configure and render

Call configureChat once, before <AgentChat /> mounts, and import the prebuilt stylesheet at your app’s entry point:
Prefer an imperative mount? mountAgentChat(el, config) calls configureChat for you and returns an unmount cleanup.

configureChat options

How Interactive Tools render on the web

When the agent calls an Interactive Tool, @metabindai/agent-ui fetches the tool’s UI resource from your project’s MCP server and renders it inside a sandboxed iframe through MCP-UI (@mcp-ui/client), hosted by the sandbox_proxy.html you serve. This is the same isolation model MCP hosts like Claude and ChatGPT use on the web: tool UIs can’t touch your page’s DOM, storage, or credentials. This differs from the iOS SDK and Android SDK, where the same tool definitions render as SwiftUI and Jetpack Compose. On the web, rendering is web technology in an isolated sandbox.

Embed as a modal, sidebar, or pill

To present the chat over an existing page rather than on its own route, add @metabindai/agent-shell. It renders a single panel that morphs between a centered modal, a docked sidebar, and a minimized pill, and embeds <AgentChat /> in a same-origin iframe so the chat’s CSS stays isolated from your page.
Serve <AgentChat /> at a same-origin route (for example /chat), then point the shell at it:
useAgentShell owns open/close state, the launch-element ref (the panel grows out of it), and the iframe bridge, so you don’t wire postMessage by hand. The shell seeds conversation context into the chat on load and surfaces a tool’s dock requests as React callbacks.

Build your own UI

If <AgentChat /> doesn’t fit, the two lower-level packages give you the same streaming pipeline without the prebuilt chat.

With the Vercel AI SDK

MetabindAgentTransport from @metabindai/agent-ai-sdk drops into useChat from @ai-sdk/react. It reshapes outbound messages to the proxy’s request format and translates the inbound stream into the chunks the AI SDK expects — tools are marked as already executed by the proxy.
ai and @ai-sdk/react are peer dependencies you provide. For an assistant-ui runtime, import the transport from @metabindai/agent-ai-sdk/assistant-ui instead (which also needs @assistant-ui/react-ai-sdk).

Framework-agnostic streaming

@metabindai/agent-core is a typed client for the Agent proxy with no React or AI SDK dependencies. client.chat(...) returns an async iterable of discriminated events — text deltas, tool calls, tool results, and turn boundaries:
The client also exposes chatText(...) (collects a full text response) and fetchChat(...) (the raw Response, for custom parsers).

Key custody

The web SDK talks only to the Agent proxy — there’s no bring-your-own-key provider on the web. The proxy holds the LLM key and runs the tool loop server-side, so no LLM-provider credential ever reaches the browser. See LLM provider configuration.
Your Metabind API key is inlined into the browser bundle — the same exposure profile as a Bearer header on every request. That’s acceptable for a project-scoped Metabind key, never for raw LLM-provider secrets. For tighter control, pass agent.apiKey as an async getter and have your backend mint short-lived tokens.

Styling

The chat is styled with Tailwind v4, but your app doesn’t need Tailwind: import the self-contained prebuilt stylesheet the package compiles at build time.
It includes a CSS reset, so load it only on the route that serves the chat — or embed the chat through @metabindai/agent-shell, which isolates it inside an iframe. If your app is on Tailwind v4 and you want to theme the chat with your own tokens, compile it from source instead — see the @metabindai/agent-ui README.

Assistant SDK overview

Conceptual: when to embed vs. connect to an external host.

LLM provider configuration

How the Agent proxy holds keys and runs the tool loop.

iOS SDK

The same agent rendered as SwiftUI.

Android SDK

The same agent rendered as Jetpack Compose.