openai-agents-js
A lightweight, powerful framework for multi-agent workflows and voice agents
What is openai-agents-js?
A lightweight, powerful framework for multi-agent workflows and voice agents
Overview of openai-agents-js
What it is
The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows in JavaScript/TypeScript. It is provider-agnostic, supporting OpenAI APIs and more. The SDK includes core concepts such as Agents, Sandbox Agents, Realtime Agents, Agents as tools / Handoffs, Tools, Guardrails, Human in the loop, Sessions, and Tracing.
Key features
- Agents configured with instructions, tools, guardrails, and handoffs - Sandbox Agents paired with a filesystem workspace and sandbox environment for longer-running work - Realtime Agents for low-latency spoken interactions with tools, guardrails, handoffs, and conversation history - Tools: functions, MCP, hosted tools - Guardrails for input and output validation - Human in the loop mechanisms for involving humans across agent runs - Sessions for automatic conversation history management - Tracing for viewing, debugging, and optimizing workflows
Use cases
- Text-based workflows using a regular Agent - Sandbox workspace tasks such as inspecting a repository, running commands, or carrying workspace state across longer tasks - Low-latency spoken interactions in the browser using a Realtime Agent - Delegating tasks to other agents via handoffs
Getting started
Install the SDK and its peer dependency: bash npm install @openai/agents zod Set the OPENAI_API_KEY environment variable for text and sandbox agents. For browser-based realtime agents, create a short-lived ephemeral client token on your server. A minimal text agent example: js 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); See the examples/ directory for more.
License and pricing
The project is licensed under the MIT License and is open source (free).
Based on the project's public README and repository metadata.