SDK Overview
The swarmlord package is a zero-dependency TypeScript SDK for the swarmlord API. It works in Node.js, Bun, and any runtime with fetch.
Install
bash
npm install swarmlordbash
pnpm add swarmlordbash
bun add swarmlordArchitecture
createClient()
└── SwarmlordClient
├── .agent() → AgentHandle
│ ├── .createSession() → SessionHandle
│ ├── .run() → TaskHandle
│ └── .schedule() → ScheduleHandle
├── .session() → SessionHandle (resume by ID)
├── .task() → TaskHandle (resume by ID)
├── .schedule() → ScheduleHandle (resume by ID)
├── .listSessions()
├── .listSchedules()
├── .getConfig()
├── .updateConfig()
└── .listModels()Handles
The SDK is built around handles — lightweight objects that wrap an ID and provide methods for interacting with the underlying resource. Handles don't fetch data on creation; they're cheap to create and pass around.
| Handle | Created by | Purpose |
|---|---|---|
SwarmlordClient | createClient() | Root entry point |
AgentHandle | client.agent() | Configured agent template |
SessionHandle | agent.createSession(), client.session() | Interactive conversation |
TaskHandle | agent.run(), client.task() | Background job |
ScheduleHandle | agent.schedule(), client.schedule() | Recurring cron job |
Exports
All types are exported for use in your own code:
typescript
import {
createClient,
type SwarmlordClient,
type AgentHandle,
type SessionHandle,
type TaskHandle,
type ScheduleHandle,
type AgentEvent,
type SendResult,
type TaskResult,
type StreamCallbacks,
type SessionInfo,
type SessionMetrics,
type ScheduleInfo,
type Tokens,
type Part,
type ToolPart,
type FilePart,
type ShellResult,
} from "swarmlord";