Skip to content

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 swarmlord
bash
pnpm add swarmlord
bash
bun add swarmlord

Architecture

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.

HandleCreated byPurpose
SwarmlordClientcreateClient()Root entry point
AgentHandleclient.agent()Configured agent template
SessionHandleagent.createSession(), client.session()Interactive conversation
TaskHandleagent.run(), client.task()Background job
ScheduleHandleagent.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";

SDK released under the MIT License.