Rabbit SDK Logo
Rabbit SDK
GitHub
Rabbit SDK v0.1.6 — Open source on GitHub

Build agents
you can trust in production.

Type-safe tools. Provider-agnostic design. Real guardrails.No framework bloat — just TypeScript and Zod.

Read the docs
$npm i @rabbit-agent-sdk/rabbit-agent-sdk

< 50kb

gzipped

MIT

License

v0.1.6

Stable

4+

Providers

1import { Agent, OpenAIProvider, Tool } from "@rabbit-agent-sdk/rabbit-agent-sdk";
2import { z } from "zod";
3 
4const weatherTool: Tool = {
5 name: "getWeather",
6 description: "Get the current weather for a location",
7 schema: z.object({ location: z.string() }),
8 execute: async ({ location }) => `The weather in ${location} is sunny.`,
9};
10 
11const agent = new Agent({
12 provider: new OpenAIProvider(),
13 tools: [weatherTool],
14});
15 
16await agent.run("What's the weather in Tokyo?");
OpenAI GPT-4o
agent.ts

Supported Language Models Out of the Box

OpenAIGroqGoogle GeminiAnthropic

The Agent Loop, Demystified

Rabbit SDK handles the complex lifecycle of tool execution and validation automatically.

1. Input

User prompt and context are passed to the agent.

2. Validation

Input guardrails check for PII, secrets, or prompt injection.

3. Execution

LLM determines if tools are needed. SDK auto-executes Zod tools.

4. Output

Output guardrails verify the final response before sending it back.

Type-Safe

Zod as a First-Class Citizen

Stop writing verbose JSON Schemas by hand. Define your tools using Zod, and the SDK automatically converts them for the LLM, handles runtime validation, and provides strict TypeScript types for your execute functions.

  • Automatic JSON Schema generation
  • Runtime argument validation
  • Self-healing tool retries on bad JSON
const schema = z.object({
  email: z.string().email(),
  count: z.number().min(1),
});

// The SDK passes this to OpenAI:
// { type: "object", properties: ... }
const agent = new Agent({
  provider: new AnthropicProvider(),
  fallbackProviders: [
    new OpenAIProvider(),
    new GroqProvider()
  ]
});
Provider Agnostic

Write Once, Run Anywhere

Never get locked into a single AI provider again. Rabbit SDK abstracts the differences between OpenAI, Anthropic, Groq, and Gemini tool-calling formats into a single, unified interface.

  • Unified tool execution interface
  • Automatic format translation
  • Seamless fallback cascades on rate limits
Agent Handoffs

Graceful Delegation without Infinite Loops

Build robust multi-agent swarms safely. Instead of letting agents call each other recursively, Rabbit SDK uses error bubbling to yield execution back to your application orchestrator.

  • No more infinite agent execution loops
  • Retain full control in your application layer
  • Secure, sandboxed contexts for each agent
// The agent stops and returns a HandoffResult
const result = await agent.run("Contact support.");

if (result.type === "handoff") {
  console.log(`Handing off to ${result.targetAgent}`);
  await supportAgent.run(result.context);
}

Everything you need

Built from the ground up for production reliability without the bloat.

Provider Agnostic

Swap between OpenAI, Groq, Gemini, Anthropic with a single line change.

Built-in Memory

Automatic conversational history management with BufferMemory or custom backends.

Zod-Powered Tools

Define tools with zod schemas — automatic JSON Schema conversion and runtime validation.

Safety Guardrails

8 built-in guardrails for PII, profanity, prompt injection, tone enforcement, and more.

Provider Fallbacks

Self-healing agent loops with automatic fallback to backup providers on failure.

Streaming

First-class support for streaming responses via async generators.

Built-in Toolkit

Pre-built FetchTool and WebSearchTool ready to use out of the box.

Budget Control

maxSteps limiter prevents infinite agentic loops from running away.

Tracing & Reliability

Detailed lifecycle event tracing for tokens, tools, memory, handoffs, and errors.

Agent Handoffs

Graceful multi-agent delegation via the secure HandoffResult pattern.

Loved by Developers

Rabbit SDK focuses on Developer Experience above all else.

"Finally an agent framework that doesn't feel like a black box. The tracing capability alone saved us weeks of debugging."

S

Senior AI Engineer

Rabbit SDK User

"The Zod integration is flawless. We just define our schemas and the SDK handles everything from JSON generation to validation retries."

L

Lead Developer

Rabbit SDK User

"Provider fallbacks are a game changer. When OpenAI goes down, our agents smoothly switch to Anthropic without missing a beat."

S

Startup Founder

Rabbit SDK User

"I've tried LangChain and others, but Rabbit SDK is the only one that feels like writing real TypeScript instead of fighting abstractions."

F

Full Stack Dev

Rabbit SDK User

"Agent Handoffs finally make building swarms actually possible without stack overflow errors. Incredible work."

A

AI Architect

Rabbit SDK User

"The memory management is so clean. Building stateful chatbots has never been this easy and predictable."

S

Software Engineer

Rabbit SDK User

"Finally an agent framework that doesn't feel like a black box. The tracing capability alone saved us weeks of debugging."

S

Senior AI Engineer

Rabbit SDK User

"The Zod integration is flawless. We just define our schemas and the SDK handles everything from JSON generation to validation retries."

L

Lead Developer

Rabbit SDK User

"Provider fallbacks are a game changer. When OpenAI goes down, our agents smoothly switch to Anthropic without missing a beat."

S

Startup Founder

Rabbit SDK User

"I've tried LangChain and others, but Rabbit SDK is the only one that feels like writing real TypeScript instead of fighting abstractions."

F

Full Stack Dev

Rabbit SDK User

"Agent Handoffs finally make building swarms actually possible without stack overflow errors. Incredible work."

A

AI Architect

Rabbit SDK User

"The memory management is so clean. Building stateful chatbots has never been this easy and predictable."

S

Software Engineer

Rabbit SDK User

Frequently Asked Questions

Is the SDK tied to a specific framework?
No, Rabbit SDK is a pure TypeScript library. You can use it in Next.js, Express, Fastify, NestJS, or even a simple Node script.
Does it support streaming?
Yes! Streaming is natively supported via async generators, making it trivial to build real-time UI typing effects.
How do guardrails work?
Guardrails intercept the LLM input and output. If a guardrail (like PII detection) fails, it can either throw an error or automatically retry the LLM with a correction prompt.
Can I bring my own LLM?
Absolutely. You can build a Custom Provider by implementing a simple interface, allowing you to connect to local models like Ollama or vLLM.
Is this production ready?
Yes. With features like provider fallbacks, maxStep budget controls, and automatic Zod retries, it's built specifically for the reliability needed in production environments.
How does Agent Handoff prevent infinite loops?
Handoffs use an error-bubbling pattern. When an agent hands off, it instantly pauses execution and yields a HandoffResult back to your main orchestrator, avoiding recursive deep-stack loops.
Can I trace the agent's behavior?
Yes, the built-in Tracer captures all lifecycle events including token usage, memory reads/writes, tool execution times, and LLM latency.

Ready to build better agents?

Start building with the most developer-friendly Agent SDK in under 3 minutes.

Get Started
$npm i @rabbit-agent-sdk/rabbit-agent-sdk