Reference
Loading...
React SDK Reference
Complete API reference for @tambo-ai/react - hooks, types, utilities, and providers for building AI-powered React applications.
The @tambo-ai/react package is Tambo's official React SDK for building AI-powered generative UI applications. This reference documents all public APIs including hooks, types, utilities, and provider components.
Installation
npm install @tambo-ai/reactQuick Links
- Hooks - React hooks for thread management, component state, streaming, and more
- Types - TypeScript interfaces and types for type-safe development
- Utilities - Helper functions like
defineTool()andwithInteractable() - Providers - Provider components for configuring Tambo in your app
- MCP - Model Context Protocol hooks and types
Overview
The SDK is organized around a provider hierarchy that manages AI state and configuration:
import { TamboProvider } from "@tambo-ai/react";
function App() {
return (
<TamboProvider
apiKey={process.env.TAMBO_API_KEY}
components={
[
/* your components */
]
}
tools={
[
/* your tools */
]
}
>
<YourApp />
</TamboProvider>
);
}Inside the provider, use hooks to access Tambo functionality:
import {
useTambo,
useTamboThread,
useTamboStreamStatus,
} from "@tambo-ai/react";
function Chat() {
const { sendThreadMessage, thread } = useTamboThread();
const { streamStatus } = useTamboStreamStatus();
// Build your UI
}MCP Support
For Model Context Protocol integrations, import from the /mcp subpath:
import { TamboMcpProvider, useTamboMcpServers } from "@tambo-ai/react/mcp";MCP requires additional peer dependencies. See the MCP reference for setup instructions.