Build agents
you can trust in production.
Type-safe tools. Provider-agnostic design. Real guardrails.
No framework bloat — just TypeScript and Zod.
< 50kb
gzipped
MIT
License
v0.1.6
Stable
4+
Providers
| 1 | import { Agent, OpenAIProvider, Tool } from "@rabbit-agent-sdk/rabbit-agent-sdk"; |
| 2 | import { z } from "zod"; |
| 3 | |
| 4 | const 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 | |
| 11 | const agent = new Agent({ |
| 12 | provider: new OpenAIProvider(), |
| 13 | tools: [weatherTool], |
| 14 | }); |
| 15 | |
| 16 | await agent.run("What's the weather in Tokyo?"); |
Supported Language Models Out of the Box
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.
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() ] });
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
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."
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."
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."
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."
Full Stack Dev
Rabbit SDK User
"Agent Handoffs finally make building swarms actually possible without stack overflow errors. Incredible work."
AI Architect
Rabbit SDK User
"The memory management is so clean. Building stateful chatbots has never been this easy and predictable."
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."
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."
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."
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."
Full Stack Dev
Rabbit SDK User
"Agent Handoffs finally make building swarms actually possible without stack overflow errors. Incredible work."
AI Architect
Rabbit SDK User
"The memory management is so clean. Building stateful chatbots has never been this easy and predictable."
Software Engineer
Rabbit SDK User
Frequently Asked Questions
Is the SDK tied to a specific framework?
Does it support streaming?
How do guardrails work?
Can I bring my own LLM?
Is this production ready?
How does Agent Handoff prevent infinite loops?
Can I trace the agent's behavior?
Ready to build better agents?
Start building with the most developer-friendly Agent SDK in under 3 minutes.
