Rabbit SDK Logo
Rabbit SDK
GitHub
Documentation

Getting Started

Introduction

Welcome to the Rabbit Agent SDK documentation.

Introduction

Rabbit SDK gives you everything you need to orchestrate Large Language Models with strict type safety, automatic JSON schema conversion, custom tools, conversational memory, provider fallback chains, and safety guardrails — all in a clean, extensible architecture. It is a provider-agnostic framework for building production-grade AI agents in TypeScript.

Key Features

FeatureDescription
Provider AgnosticSwap between OpenAI, Groq, Gemini (or build your own) with a single line change
Built-in MemoryAutomatic conversational history management with BufferMemory or custom backends
Zod-Powered ToolsDefine tools with zod schemas — automatic JSON Schema conversion and runtime validation
Safety Guardrails8 built-in guardrails for PII detection, profanity, prompt injection, tone enforcement, and more
Provider FallbacksSelf-healing agent loops with automatic fallback to backup providers on failure
StreamingFirst-class support for streaming responses via async generators
Built-in ToolkitPre-built FetchTool and WebSearchTool ready to use out of the box
Budget ControlmaxSteps limiter prevents infinite agentic loops

Architecture

The SDK is structured as a pnpm monorepo with the following packages:

Packagenpm NamePurpose
packages/core@rabbit-agent-sdk/coreAgent engine, memory, guardrails, tools, types, errors
packages/provider-openai@rabbit-agent-sdk/provider-openaiOpenAI provider (gpt-4o default)
packages/provider-groq@rabbit-agent-sdk/provider-groqGroq provider (llama3-8b-8192 default)
packages/provider-gemini@rabbit-agent-sdk/provider-geminiGemini provider (gemini-2.5-flash default)
packages/provider-anthropic@rabbit-agent-sdk/provider-anthropicAnthropic provider (claude-3-5-sonnet-20241022 default)
packages/rabbit-agent-sdk@rabbit-agent-sdk/rabbit-agent-sdkUmbrella package — re-exports all of the above

Minimal Example

This is a minimal example using the OpenAI provider. You can easily swap this with Gemini, Groq, or Anthropic.

typescript
import { Agent, OpenAIProvider } from "@rabbit-agent-sdk/rabbit-agent-sdk";
import { z } from "zod";
 
const agent = new Agent({
  provider: new OpenAIProvider({ apiKey: process.env.OPENAI_API_KEY }),
  systemPrompt: "You are a helpful assistant.",
  tools: [{
    name: "getWeather",
    description: "Get the current weather for a location",
    schema: z.object({ location: z.string() }),
    execute: async ({ location }) => `The weather in ${location} is sunny.`,
  }],
});
 
const response = await agent.run("What's the weather in Tokyo?");
console.log(response);
// → "The weather in Tokyo is sunny."

Ready to get started? Head over to the Installation page!