Open Agent SDK

Lightweight, general-purpose TypeScript agent runtime.

Open-source alternative to Claude Agent SDK. Use it when you want a lightweight runtime with sessions, tools, hooks, subagents, and multi-provider support in a codebase you can inspect and extend.

Claude-style mental model, open implementation, broader provider choice.

Initnpx open-agent-sdk@alpha init my-agent
  • MIT licensed
  • TypeScript + Bun
  • Codex, OpenAI, Gemini, Anthropic
  • Sessions, permissions, hooks, subagents

Workflow

Build the runtime, not a pile of glue code.

Product teams usually outgrow isolated demos in the same places: session state, tool control, provider churn, and operational safety. This SDK is organized around those failure points from the start.

01

Start from a real runtime surface

Move beyond one-shot demos with prompts, streaming sessions, tool execution, and file-backed persistence in the same TypeScript runtime.

Run the quickstart

02

Add guardrails before the risky part

Permission modes, tool gating, and lifecycle hooks let product teams inspect, approve, and instrument agent behavior before it turns into operations debt.

Review safety controls

03

Stay flexible when product needs change

Keep the same mental model while changing providers, extending with MCP servers, or benchmarking real workflows instead of rebuilding your loop.

Browse the API surface

Capabilities

One runtime surface for prompts, tools, policy, and evaluation.

Keep the repo approachable for local experiments, then extend the same primitives into production workflows, migration projects, and benchmark runs.

Sessions that survive real workflows

Create, resume, and fork long-lived agent runs with storage-backed history so product work is not trapped in a single request cycle.

Session API

Safety controls built into the runtime

Use `default`, `plan`, `acceptEdits`, and `bypassPermissions`, then layer custom tool checks and lifecycle hooks when your surface area grows.

Permissions and hooks

Tools that map to actual agent work

Ship with bash, file operations, web search and fetch, MCP integration, and subagent task delegation instead of stitching one-off helpers together.

Tool model

Provider strategy without lock-in

Reuse local Codex OAuth when it fits, or target OpenAI, Gemini, and Anthropic with explicit provider configuration and migration paths.

Provider and auth

Adoption paths

Start new, migrate carefully, or benchmark the hard parts.

The repository now has three jobs: explain the product quickly, move builders into working code, and give evaluators enough surface area to trust the runtime.

Start a new agent product

Use the SDK and CLI-first workflow when you want one open runtime to own prompts, sessions, tools, and safety policy.

  • Run a one-shot prompt first, then expand to sessions
  • Add bash, file, web, MCP, and task delegation capabilities
  • Keep auth and provider strategy explicit from the start
Open quickstart

Migrate a Claude-style workflow

Keep the familiar session and tool-first mental model, then widen the runtime around providers, hooks, and evaluation without a rewrite.

  • Map create, resume, and fork onto your current flow
  • Move permission and hook logic into typed control points
  • Validate the migration against the API reference and guides
See migration path

Build with it

Use the quickstart in one minute, then deepen the runtime as the product hardens.

Start with docs and API reference, or jump straight into the package if you already know the workflow you want to ship.