@tambo-ai/client
v1.3.0
Published
Framework-agnostic client for Tambo AI
Keywords
Readme
Tambo Cloud is shutting down. New signups are closed. Tambo Cloud keeps running until October 31, 2026, after which the hosted API stops responding; user data is deleted November 30, 2026. Read the announcement. Tambo is open source and self-hostable: see SELF-HOSTING.md to keep running it yourself. The team is now building Charming, a collaborative cloud for apps built with any AI agent.
@tambo-ai/client
Framework-agnostic client for Tambo AI. Provides streaming, tool execution, and thread management without React dependencies.
Installation
npm install @tambo-ai/clientQuick Start
import { TamboClient } from "@tambo-ai/client";
const client = new TamboClient({ apiKey: "your-api-key" });
// Send a message and await the final thread state
const stream = client.run("Hello!");
const thread = await stream.thread;
console.log(thread.messages);Usage
Streaming with async iteration
const stream = client.run("What is 2 + 2?");
for await (const { event, snapshot } of stream) {
console.log(event.type, snapshot.messages.length);
}Thread management
// Start a new thread
const threadId = client.startNewThread();
// Switch to an existing thread
await client.switchThread("thread_abc123");
// List all threads
const threads = await client.listThreads();Tool registration
client.registerTool({
name: "get_weather",
description: "Get the current weather for a location",
tool: async ({ location }) => {
return { temp: 72, condition: "sunny" };
},
inputSchema: {
type: "object",
properties: {
location: { type: "string" },
},
required: ["location"],
},
});React integration
For React applications, use @tambo-ai/react which wraps this package with hooks and providers:
npm install @tambo-ai/reactSee @tambo-ai/react for React-specific documentation.
API
TamboClient
The main client class. Implements getState() and subscribe() for use with useSyncExternalStore or similar framework bindings.
TamboStream
Returned by client.run(). Two consumption modes:
- Async iteration:
for await (const { event, snapshot } of stream) { ... } - Promise:
const thread = await stream.thread
Key types
TamboThread- Thread state with messages, status, and metadataStreamEvent- Event/snapshot pair yielded during streamingTamboClientOptions- Configuration for client creationClientState- Full client state (thread map, current thread, streaming state)
License
MIT
