agent-swarm
Install, self-host, deploy, operate, or use agent-swarm. Covers Docker Compose, Kubernetes,…
Bulk, repeat, fan-out, or data-heavy work: write and run swarm scripts (inline `script-run`, named `script-upsert`, durable `launch-script-run`). Covers the script-vs-tool rubric, the authoring contract (`args` first, `ctx` second), the seed catalog, connections and secrets,
$ npx -y skills add desplega-ai/agent-swarm --skill swarm-scripts --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/swarm-scriptsContext preview
The summary Claude sees to decide when to auto-load this skill.
Bulk, repeat, fan-out, or data-heavy work: write and run swarm scripts (inline `script-run`, named `script-upsert`, durable `launch-script-run`). Covers the script-vs-tool rubric, the authoring contract (`args` first, `ctx` second), the seed catalog, connections and secrets,
name: swarm-scripts description: "Bulk, repeat, fan-out, or data-heavy work: write and run swarm scripts (inline `script-run`, named `script-upsert`, durable `launch-script-run`). Covers the script-vs-tool rubric, the authoring contract (`args` first, `ctx` second), the seed catalog, connections and secrets, `db_query`, and exposing a script as an API."
A swarm script is TypeScript that runs out of process with a typed Swarm SDK. Only its return value enters your context. Use one when direct tool calls would repeat, flood your context, or need deterministic processing over many records.
| Situation | Approach | |---|---| | 1 to 9 SDK calls, result fits in context | Direct tool calls. | | 10 or more similar calls, bulk or fan-out | Script. Inline `script-run` for a one-off, a named script for reuse. | | Fetch, parse, and transform heavy data | Script, or `ctx_*` (context-mode) when your harness has it. | | One large web fetch | `ctx_fetch_and_index` (context-mode). | | Multi-agent fan-out, parallel work, deterministic pipeline | Workflow. See `workflow-iterate`. | | Work that repeats on a clock | Schedule. See `scheduling`. |
Named script only when the logic will run two or more times, by you, another agent, a schedule, or a workflow. A one-off goes inline, so the catalog does not fill with scratch saves.
Reference point: a workflow triage that took about 26 tool calls returns as one result of about 4k tokens in about 13 seconds.
The script tools are deferred. Load them with your harness tool search before the first call: `script-search`, `script-run`, `script-upsert`, `script-query-types`, `script-delete`, and for durable runs `launch-script-run`, `get-script-run`, `list-script-runs`.
Run `script-query-types` before non-trivial work. It returns the live `swarm-sdk.d.ts` and stdlib declarations, including generated per-app types.
The swarm ships named scripts at global scope. Each one replaces a multi-step tool chain. `script-search` with a plain-language description finds them. Call one with `script-run` and `name` plus `args`.
| Script | Args | Use | |---|---|---| | `task-context-gathering` | `{ taskId, queries: [...] }` | the task plus a deduplicated multi-query memory recall | | `smart-recall` | `{ queries: [...] }` | multi-query memory recall without the task | | `memory-dedup-check` | `{ text, threshold? }` | near-duplicates before you store a memory | | `delegate` | `{ agentName, task, routingReason, routingNote, parentTaskId? }` | a subtask for an agent by name, returns `{ taskId }` | | `wait-for-task` | `{ taskId }` | waits up to about 25 s for a terminal state, returns `{ done, status, output }`; call again while `done` is false | | `get-child-outputs` | `{ parentTaskId }` | every child with status and output | | `complete-task` | `{ taskId, output }` | finish a task from inside a script | | `report-progress` | `{ taskId, note }` | a progress note from inside a script | | `swarm-overview` | `{}` | agents and task counts | | `schedule-health`, `task-failure-audit`, `boot-triage` | see `heartbeat-runbook` | the lead's heartbeat data gathering |
The entry point takes `args` first and `ctx` second. A one-parameter `function (ctx)` receives `args` at runtime, so every `ctx.*` access throws. This is the most common cause of a failed run.
import type { ScriptContext } from "swarm-sdk";
import * as z from "zod";
export const argsSchema = z.object({ taskId: z.string(), limit: z.number().optional() });
export default async function (args: z.infer<typeof argsSchema>, ctx: ScriptContext) {
const res = await ctx.swarm.task_get({ taskId: args.taskId });
const task = ((res as { data?: unknown }).data ?? res) as { title?: string };
return { title: task?.title };
}Repo: desplega-ai/agent-swarm
Install, self-host, deploy, operate, or use agent-swarm. Covers Docker Compose, Kubernetes,…
Rebuild the feel of a reference motion-design clip (camera, depth of field, easing, captions,…
Reverse-engineer a short motion-design / product-update video (animation technique, timing…
Make a design-led motion-graphics video (showreel, eval comparison, feature or bug-hunt…
How to generate repo-committed video content (README hero videos, case-study clips, landing…
Read the task-digest extension's output. Use when someone asks how many tasks completed or…