Overview
TheTamboProvider component is the root provider for the Tambo React SDK. It composes multiple internal providers to deliver a complete context for building AI-powered applications with component registration, tool execution, thread management, and streaming support.
This provider should wrap your entire application or the portion that needs access to Tambo functionality.
Import
Usage
Props
Authentication
Tambo API key for authentication. Get your API key from the Tambo dashboard.
User key for thread ownership and scoping. Required: You must provide either
userKey OR userToken.All thread operations (create, list, fetch) only return threads owned by this userKey.- Use
userKeyfor server-side or trusted environments where you control the user identity - Use
userToken(OAuth bearer token) for client-side apps where the token contains the userKey
OAuth bearer token containing the userKey (alternative to
userKey). Use this for client-side applications.Configuration
Optional custom Tambo API URL. Defaults to the production API endpoint.
Optional environment configuration for advanced API settings.
Components & Tools
Array of components to register with the AI. These components will be available for the AI to use in responses.See Component Registration for details.
Array of tools to register for client-side execution. These tools will be executed when requested by the AI.See Tool Registration for details.
MCP (Model Context Protocol) servers to register. These provide additional tools and resources from MCP-compatible servers.Can be specified as:
- Full
McpServerInfoobjects with configuration - Simple strings for command-line MCP servers
Callback function called when an unregistered tool is requested by the AI. If not provided, an error will be thrown for unknown tools.
Resources
Array of static resources to register with the AI. These resources will be available for the AI to access.
Dynamic resource search function. Must be paired with
getResource. Called when searching for resources dynamically.Dynamic resource fetch function. Must be paired with
listResources. Called when fetching a specific resource by URI.Context Helpers
Dictionary of functions that provide additional context to the AI. Each key becomes the context name, and the function returns the value.
Thread Management
Whether to automatically generate thread names after a threshold of messages.
The message count threshold at which the thread name will be auto-generated.
Initial messages to seed new threads with. These are displayed in the UI immediately (before the first API call) and sent to the API when the first message is submitted.
Type Definitions
TamboProviderProps
Authentication States
The provider monitors authentication state and emits console warnings for common configuration issues:- Unauthenticated: Neither
userKeynoruserTokenprovided - API requests will be blocked - Invalid: Both
userKeyanduserTokenprovided - you must provide one or the other - Error: Token exchange failed - check your token validity
- Identified: Successfully authenticated and ready to make API calls
Thread Ownership
All thread operations require user identification. Threads are scoped to theuserKey - each user only sees their own threads.
Provide ONE of:
userKey- Direct user identifier (for server-side or trusted environments)userToken- OAuth bearer token containing the userKey (for client-side apps)
Related
- useTambo() - Main hook for accessing Tambo functionality
- useTamboThreadInput() - Hook for managing message input
- Component Registration
- Tool Registration