OpenAI Agents SDK (Node)

Frameworks & SDKs 💻 TypeScript ⚖️ MIT 🟢 Actively maintained
3.8k stars

The OpenAI Agents SDK is a lightweight framework for building multi-agent workflows in JavaScript/TypeScript. It supports text, sandbox, and realtime agents with tools, guardrails, and handoffs. It is provider-agnostic and works with OpenAI APIs and more.

✨ Key features

  • Agents configured with instructions, tools, guardrails, and handoffs
  • Sandbox agents with filesystem workspace and environment
  • Realtime agents for low-latency spoken interactions
  • Agents as tools and handoffs for delegation
  • Built-in tracing for debugging and optimizing workflows
  • Sessions for automatic conversation history management

🎯 Use cases

  • Build multi-agent workflows for complex tasks
  • Create voice-based assistants with realtime agents
  • Run agents in sandboxed environments for file operations
  • Delegate subtasks to specialized agents via handoffs
  • Add guardrails for input/output validation

📦 Installation

🧰 Requirements: Node.js 22 or later, Deno, or Bun; OpenAI API key for text/sandbox agents; for realtime browser agents, a client API key.

npm install @openai/agents zod

🚀 Usage

import { Agent, run } from '@openai/agents';

const agent = new Agent({
  name: 'Assistant',
  instructions: 'You are a helpful assistant.',
});
const result = await run(
  agent,
  'Write a haiku about recursion in programming.',
);
console.log(result.finalOutput);

⚠️ Good to know

Sandbox Agents are in beta; UnixLocalSandboxClient only supports macOS and Linux, Windows requires DockerSandboxClient or hosted client.

❓ FAQ

What are the supported environments?

Node.js 22 or later, Deno, and Bun are supported. Cloudflare Workers with nodejs_compat is experimental.

How do I install the SDK?

Run npm install @openai/agents zod in your project directory.

How do I use a sandbox agent on Windows?

Use DockerSandboxClient or a hosted sandbox client instead of UnixLocalSandboxClient, which only supports macOS and Linux.

How do I authenticate for realtime agents in the browser?

Use your server to create a short-lived ephemeral client token and pass it to session.connect() as the apiKey.

📊 Repository

Stars★ 3,757
Forks🍴 950
Open issues🐛 64
Last commit🕒 Sep 2, 2026
Created📅 May 2025
Language💻 TypeScript
License⚖️ MIT

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.