Skip to main content
The official React SDK for building interactive agent interfaces with hooks and components.

Installation

Quick Start

1. Create a Server-Side API Route

The React SDK calls a server-side endpoint to keep your Agentbase API key secure. Here’s an example using Next.js App Router:

2. Use the useAgent Hook in Your Component

API Reference

useAgent(options)

The main hook for building agent interfaces.

Options

Returns

Message Types

The hook handles various message types from the agent:

Examples

Basic Chat Interface

With System Prompt and Rules

Multi-Agent Handoffs

With Error Handling

Session Persistence

Resources

What’s Next?

TypeScript SDK

Server-side TypeScript integration

Python SDK

Use Agentbase with Python

API Reference

Complete API documentation