The open-source TypeScript SDK for AI agents.
Zero vendor lock-in. Switch effortlessly between OpenAI, Anthropic, and Google Gemini with type-safe tools, real-time streaming, and an automated reasoning loop.
One Interface, Zero Rewrites
Switch providers with 1 line of code. All tool definitions, messages, and agent loops stay identical.
import { tool, runAgent } from "raseo-sdk";
import { OpenAIProvider } from "raseo-sdk/openai";
import { z } from "zod";
// 1. Strongly-typed tool definition (Zod)
const weatherTool = tool({
name: "get_weather",
description: "Get current weather for a city",
input: z.object({
city: z.string().describe("City name"),
}),
async execute({ city }) {
return { city, temperature: 24, condition: "Sunny" };
},
});
// 2. Swappable Model Provider (OpenAI)
const provider = new OpenAIProvider({
apiKey: process.env.OPENAI_API_KEY!,
model: "gpt-4o-mini",
});
// 3. Multi-turn Agent Reasoning Loop
const result = await runAgent({
name: "WeatherBot",
instructions: "You are a helpful weather assistant.",
model: provider, // Unified interface across all models
tools: [weatherTool],
}, "What is the weather in Delhi?");
console.log(result.output);Unified Provider Abstraction
Native integrations with OpenAI Responses API, Anthropic Messages API, and Google GenAI. Identical non-streaming (generate) and streaming (stream) APIs.
Type-Safe Tools with Zod
Define tools using tool() with full TypeScript parameter inference. Automatic conversion from Zod schemas to model-ready JSON Schemas.
Autonomous Reasoning Loop
runAgent manages multi-turn agent execution: calls the model, detects tool invocations, executes tools via ToolExecutor, feeds results back, and returns the final answer.
The Autonomous Agent Loop in Action
Click each stage to inspect the internal runtime execution lifecycle in raseo-sdk.
User Input & Context
The agent receives the prompt and resolves dynamic instructions (either a static string or an async function receiving AgentRunContext).
const result = await runAgent({
name: "Assistant",
instructions: "Help users with data tasks.",
model: provider,
tools: [calculatorTool],
}, "Calculate 15 * 84");Clean Modular Subpath Exports
Only import what you need. Provider SDKs are decoupled so your bundle stays lightweight.
Core runAgent, AgentRuntime, types, errors, session helpers.
OpenAIProvider backed by OpenAI's Responses API.
AnthropicProvider backed by Anthropic's Messages API.
GeminiProvider backed by Google's GenAI SDK.
tool(), ToolRegistry, ToolExecutor, zodToJsonSchema.
MemorySessionStorageAdapter, createSession, session state.