tambo

tambo

Build AI assistants and agents in React with a few lines of code.

Stars: 245

Visit
 screenshot

tambo ai is a React library that simplifies the process of building AI assistants and agents in React by handling thread management, state persistence, streaming responses, AI orchestration, and providing a compatible React UI library. It eliminates React boilerplate for AI features, allowing developers to focus on creating exceptional user experiences with clean React hooks that seamlessly integrate with their codebase.

README:

tambo ai

Build AI assistants and agents in React with a few lines of code.

tambo ai Logo

npm version license GitHub last commit Discord GitHub stars

The Future is Generative

The future of UX is generative and hyper-personalized. But today its really hard to build AI powered generative UI experiences. We are building tools that make this possible without complexity.

tambo ai eliminates React boilerplate for AI features. We handle the hard parts so you can focus on creating exceptional user experiences.

Build AI assistants and agents in React without the headache.

What is tambo ai?

tambo ai is a React library that deals with the boring parts. Get started with an AI assistant in minutes.

  • Thread management
  • State persistence
  • Streaming responses
  • AI Orchestration
  • A Compatabile React UI Library

You get clean React hooks that integrate seamlessly with your codebase.

How It Works

Add tambo ai to your React app with a simple provider pattern:

import { TamboProvider } from "@tambo-ai/react";

function App() {
  return (
    <TamboProvider apiKey="your-api-key">
      <YourApp />
    </TamboProvider>
  );
}

Core Features

  • Specialized hooks for specific needs:

    • useTambo - Primary entrypoint for the Tambo React SDK
    • useTamboThreadInput - Input state and submission
    • useTamboSuggestions - AI-powered message suggestions
    • useTamboThreadList - Conversation management
    • useTamboComponentState - AI-generated component state
    • useTamboThread - Access to current thread context
  • Component registration for AI-generated UI

  • Tool integration for your data sources

  • Streaming responses for real-time interactions

Getting Started

Quick Start

Use our template:

npx create-tambo-app@latest .

npm run dev

or try adding it to your existing project:

npx tambo full-send

Check out our UI library tambo-ui for components that leverage tambo.

Basic Usage

  1. Displaying a message thread.
import { useTambo, useTamboThreadInput } from "@tambo-ai/react";

function ChatInterface() {
  const { thread, sendThreadMessage } = useTambo();
  const { value, setValue, submit } = useTamboThreadInput();

  return (
    <div>
      {/* Display messages */}
      <div>
        {thread.messages.map((message, index) => (
          <div key={index} className={`message ${message.role}`}>
            <div>{message.content}</div>
            {message.component && message.component.renderedComponent}
          </div>
        ))}
      </div>

      {/* Input form */}
      <form
        onSubmit={(e) => {
          e.preventDefault();
          submit();
        }}
        className="input-form"
      >
        <input
          type="text"
          value={value}
          onChange={(e) => setValue(e.target.value)}
          placeholder="Type your message..."
        />
        <button type="submit">Send</button>
      </form>
    </div>
  );
}
  1. Adding AI-Generated Components

Create components that can be dynamically generated by the AI:

// components/WeatherCard.jsx
import { useTamboComponentState } from "@tambo-ai/react";

export function WeatherCard() {
  const [weatherState, setWeatherState, { isPending }] = useTamboComponentState(
    "weather",
    {
      temperature: 0,
      condition: "",
      location: "",
    },
  );

  if (isPending) {
    return <div>Loading weather data...</div>;
  }

  return (
    <div>
      <h3>{weatherState.location}</h3>
      <div>{weatherState.temperature}°C</div>
      <div>{weatherState.condition}</div>
    </div>
  );
}

Then register your components in your app's entry point:

// App.jsx
import { TamboProvider } from "@tambo-ai/react";
import { WeatherCard } from "./components/WeatherCard";
import { z } from "zod";

// Define your components
const components = [
  {
    name: "WeatherCard",
    description: "A component that displays weather information",
    component: WeatherCard,
    propsSchema: z.object({
      temperature: z.number(),
      condition: z.string(),
      location: z.string(),
    }),
  },
];

// Pass them to the provider
function App() {
  return (
    <TamboProvider apiKey="your-api-key" components={components}>
      <YourApp />
    </TamboProvider>
  );
}

Read our full documentation

Development

Prerequisites

  • Node.js 18.x+
  • npm 10.x+

Quick Commands

# Install
git clone https://github.com/tambo-ai/tambo.git && cd tambo && npm install

# Develop
npm run dev

# Build
npm run build

# Test
npm run test

Resources

License

MIT License - see the LICENSE file for details.

Join the Community

We're building tools for the future of user interfaces. Your contributions matter.

Star this repo to support our work.

Join our Discord to connect with other developers.


Built by developers, for developers.
Because we believe the future of UI is generative and hyper-personalized.

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for tambo

Similar Open Source Tools

For similar tasks

For similar jobs