Skip to content

TypeScript SDK

Install the sailfork package for Node, Bun, Deno or Workers, make a first call, and find the page for each part of the TypeScript SDK.

The sailfork package is the TypeScript client for the same operations the REST API, the CLI and the MCP server serve. It has no runtime dependencies and uses the global fetch. SDKs for TypeScript and Python is the short overview and the SDK reference lists every method; the pages here go deeper.

Install and requirements

bun add sailfork       # or npm install sailfork, pnpm add sailfork
Runs onNode 20 or later, Bun, Deno, Cloudflare Workers
Module formatsESM and CommonJS, with types for both
Runtime dependenciesnone
API versionevery request sends Sailfork-Version: 2026-12-01

The package has two entry points.

Import pathWhat it holds
sailforkThe Sailfork client (default and named export), the handle classes, the error classes, ERROR_CODES, detectAgent, detectSession, API_VERSION, VERSION, and the types namespace
sailfork/toolsanthropicTools, openaiTools, run and the AnthropicTool and OpenAITool types
import Sailfork, { NotFoundError, type RequestOptions, type types } from 'sailfork';
import { anthropicTools, openaiTools, run } from 'sailfork/tools';

From CommonJS, the class is both the default and the Sailfork property of the module:

const { Sailfork, NotFoundError } = require('sailfork');
const sf = new Sailfork();

Your first call

import Sailfork from 'sailfork';

const sf = new Sailfork(); // SAILFORK_TOKEN, SAILFORK_HOST, or the token `sailfork auth login` stored

const { pending } = await sf.held.mine(); // writes waiting for a person
console.log(pending.length);

const repo = sf.repo('acme/api');
const page = await repo.pulls.list({ state: 'open', limit: 10 });
for (const pull of page.items) console.log(pull.number, pull.title);

In this section

PageWhat it covers
Client and sign-inEvery ClientOptions field, how the token and host are found, a custom fetch, agent naming and headers
Operations and typesHow operations become methods, input and output types, paging, streams and long operations
HandlesRepo, Org, PullRequest and Caisson, and the methods that return the next one
Agent workflowAn issue to a merged pull request, including the held merge
Held writes and waitsThe Result type and sf.wait
Errors and retriesEvery error class and code, request options, retries and idempotency
Tools for modelsanthropicTools, openaiTools and run, with a tool-use loop for each
Testing and runtimesAn injected fetch, and notes for Node, Bun, Deno, Workers and browsers

The Python package has the same section, starting at Python SDK.

Loading Sailfork