一键导入
swarm-scripts
Use swarm scripts for bulk SDK calls, repetitive fan-out, and context-efficient data processing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use swarm scripts for bulk SDK calls, repetitive fan-out, and context-efficient data processing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Fetch a file attached to your current task in ONE call. Use whenever a task carries an attachment (an image, PDF, or other file the requester uploaded) and you need its bytes on disk — the dispatch prompt lists attachments with a ready-to-run curl command, but if you're improvising (resumed session, follow-up task, or the recipe scrolled out of context) use this skill instead of reaching for the `agent-fs` CLI directly.
Guide for running local E2E tests with API server, Docker lead/worker containers, task creation, log verification, UI dashboard, and cleanup
Canonical AgentMail send-message API reference for swarm agents. Pins the base URL, required field names, text-only rendering workaround, BCC policy, and ready-to-copy curl / swarm-script examples so agents do not rediscover the API surface at runtime.
How to interact with Kapso WhatsApp from the swarm — read inbound webhook payloads (text AND media), fetch message history, send free-form messages within the 24h session window (and template messages outside it), mark-as-read, show the typing indicator, send reactions, download media, verify webhook signatures, and resolve contacts to swarm users. Canonical reference for ANY Kapso interaction beyond the thin `send-whatsapp-message` / `reply-whatsapp-message` MCP tools — for templates, media, reactions, typing, mark-as-read, signature verify, contact resolution, conversation history, drop to the REST recipes here. Use whenever a task references a WhatsApp message routed through Kapso, or when a workflow needs to reply on WhatsApp.
Per-app playbook for driving Gmail through Composio (toolkit slug `gmail`). Verified GMAIL_* tool slugs and argument shapes for reading, searching, sending, drafts, labels, and threads. Use alongside the `composio` hub skill whenever a task reads or sends Gmail for a connected user. Covers the metadata-first reads, the GMAIL_SEND_EMAIL HTML flag, and reply-to-thread.
Per-app playbook for driving Google Calendar through Composio (toolkit slug `googlecalendar`). Verified GOOGLECALENDAR_* tool slugs and argument shapes for listing, finding, creating, and updating events plus free/busy. Use alongside the `composio` hub skill. CRITICAL — covers the "events from a year ago" trap: GOOGLECALENDAR_EVENTS_LIST has no default timeMin, so you MUST pass timeMin/orderBy/singleEvents to get upcoming events.
| name | swarm-scripts |
| description | Use swarm scripts for bulk SDK calls, repetitive fan-out, and context-efficient data processing. |
Use swarm scripts when direct tool calls would create repetitive work, flood the context window, or require deterministic data processing across many records. Scripts run out-of-process with a typed Swarm SDK and return only the final result to your context.
The canonical decision rubric lives in the prompt-template registry as system.agent.script_rubric and is injected into agent session prompts. Do not maintain a second script-vs-tool table in this skill; keeping one source of truth prevents drift between the session prompt and this reference.
Operationally, follow the prompt rubric: direct tool call below the ~10-call threshold; inline script-run for genuine one-offs; named script only when the logic will be invoked ≥2 times by you, another agent, or a workflow.
The script tools are deferred. Before authoring or running a script, load the relevant tools with ToolSearch:
script-query-types
script-upsert
script-run
script-search
script-delete
Use script-query-types before non-trivial work so the script matches the live swarm-sdk.d.ts and stdlib signatures.
Use script-run with inline source for one-off work:
export default async function main(args: { status: string; limit: number }, ctx) {
const { swarm, logger } = ctx;
const result = await swarm.task_list({ status: args.status, limit: args.limit });
logger.info(`Fetched ${result.tasks.length} tasks`);
return {
total: result.tasks.length,
tasks: result.tasks.map((task) => ({
id: task.id,
status: task.status,
title: task.task.slice(0, 120),
})),
};
}
Keep logs useful but compact. The value returned from main is what comes back to your context.
Use script-upsert when the same logic is likely to be reused at least twice by another task, agent, or workflow. Give the script a searchable name, a concrete description, and an intent that explains when to choose it.
Good named scripts:
agentId is propagated to scripts via the X-Agent-ID header, so SDK calls run as the invoking agent.taskId is not ambient. If a script needs to call ctx.swarm.task_storeProgress, pass taskId explicitly in args.ctx_fetch_and_index; for repeated fetch/parse/aggregate work, prefer a script.Thread task identity explicitly:
export default async function main(args: { taskId: string; items: string[] }, ctx) {
const { swarm } = ctx;
await swarm.task_storeProgress({
taskId: args.taskId,
progress: `Processing ${args.items.length} items with a script`,
});
return { processed: args.items.length };
}
Do not assume the runtime can infer the current task.
Named scripts can be exposed as public HTTP endpoints — POST /api/x/script/<id> — for callers outside the swarm. Manage endpoints from the script's API tab in the dashboard, or programmatically with the script-apis tool (list/create/update/rotate/delete). list masks bearer tokens by default; pass includeSecrets: true to reveal them. create/rotate always return the fresh plaintext token once.