SDK reference
The Sailor SDK is the TypeScript library underneath the CLI: a high-level SailorClient, the Agent interface your strategy implements, EIP-712 signing helpers, kernel-capability detection, the contract ABIs, and the deployment + chain registries. It peer-depends on viem ^2.
- SailorClient — the full client and its namespaces (
account,mandate,dispatch,strategy,session,fees,principal). - The Agent interface —
AgentandAgentContext: what you implement and what eachtick()receives. - Exports & helpers — the exported functions, types, and ABIs (signing, capability detection, errors, Safe-address math, fees).
Install & import
Section titled “Install & import”The SDK ships inside the @sail.money/sailor package and is exposed via a subpath export. In an agent project scaffolded by sailor init, it’s already a dependency:
import { SailorClient, buildDispatchSignature, detectKernelCapabilities, LocalKeyring,} from "@sail.money/sailor/sdk";import type { Agent, AgentContext, Dispatch } from "@sail.money/sailor/sdk";To add it to another project:
npm install @sail.money/sailor viemThe SDK is only distributed inside @sail.money/sailor — always import it from the @sail.money/sailor/sdk subpath. There is no separate @sail.money/sdk package; @sail.money/sailor is the one package you install.
How to use it
Section titled “How to use it”There are two layers, and you’ll usually use both:
SailorClient— a batteries-included client with namespaces for accounts, mandates, dispatch, a swap strategy, sessions, fees, and principal tracking. Read-only methods need only an RPC; state-changing methods take a signer (the managerLocalKeyring). Start here. See SailorClient.- The
Agentinterface — when you run undersailor run, you implementAgent.tick(ctx)and the runner provides anAgentContext(with a readySailorClient, a viempublicClient, the manager keyring, balance/allowance helpers, and a logger). See The Agent interface.
Below those sit the primitives — buildDispatchSignature (self-detecting EIP-712 dispatch signer), detectKernelCapabilities (reads the on-chain dispatch model so you never hardcode it), LocalKeyring (the encrypted manager key), the kernel/factory/governance ABIs, and the deployment + chain registries. See Exports & helpers.