openai-assistant-swarm

Introducing the Assistant Swarm. An extension to the OpenAI Node SDK to automatically delegate work to any assistant you create in OpenAi through one united interface and manager. Now you can delegate work to a swarm of assistant all specialized with specific tasks you define.

617
Stars
88
Forks
TypeScript
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/Mintplex-Labs/openai-assistant-swarm

快速入门

使用 openai-assistant-swarm 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

OpenAI Assistant Swarm Manager banner

OpenAI Assistant Swarm Manager: A library to turn your OpenAi assistants into an army.

Discord | License | Mintplex Labs Inc | NPM

What is the Swarm Manager

OpenAI's assistant API unlocks an incredible convience for developers who are building autonomous AI assistants or commonly called "Agents". This Node JS Library unlocks your entire registry of custom agents and their functions via a single API call. One agent "manager" can now easily delegate work to one or many other assistants in parallel in a smart and quick way so you can handle actions from delegated tasks easily.

All of the mental overhead of managing which assistant does what is now handled and wrapped up with a bow.

How does it work?

The Swarm Manager acts as an extension of the OpenAI NodeJS SDK - making available a new .swarm method available on beta.assistants.

First, install the openai SDK for NodeJS

yarn add openai
# or 
npm install openai

Next install the openai-assistant-swarm package

yarn add @mintplex-labs/openai-assistant-swarm
# or 
npm install @mintplex-labs/openai-assistant-swarm

Now use the SDK as you normally would and run the extension function and initialize the agent swarm manager.

// Enable the client for OpenAi as you normally would
const OpenAIClient = (
    new OpenAI({
        apiKey: process.env.OPEN_AI_KEY
    }));

// The simply call this function on the client to extend the OpenAI SDK to now have
// OpenAIClient.beta.assistants.swarm functions available.
EnableSwarmAbilities(OpenAIClient, {
  // all options are OPTIONAL
  debug: false, // to see console log outputs of the process and playground links for debugging.
  managerAssistantOptions: {
         name: "[AUTOMATED] ___Swarm Manager", // Name of created/maintained agent by the library
        model: "gpt-4", // Use gpt-4 for better reasoning and calling.
        instructions: 'Instructions you are going to give the agent manager to delegate tasks to'; // Override the default instructions.
    };
});

// Initialize the swarm manager to create the swarm manager and also register it with
// your account. Swarm manager can be configured via options on `EnableSwarmAbilities`
await OpenAIClient.beta.assistants.swarm.init();
// Now all swarm management function are available to you!

A simple example

An full example delegating a single input between 3 available assistants...

import OpenAI from 'openai';
import { EnableSwarmAbilities } from '@mintplex-labs/openai-assistant-swarm';
const OpenAIClient = new OpenAI({apiKey: process.env.OPEN_AI_KEY});
EnableSwarmAbilities(OpenAIClient);
await OpenAIClient.beta.assistants.swarm.init();

// Optional - set up listeners here to wait for specific events to return to the user since streaming is not available yet.

// Run the main process on a single text prompt to have work delegate between all of your assistants that are available.
const response = OpenAIClient.beta.assistants.swarm.delegateWithPrompt('What is the weather in New York city right now? Also what is the top stock for today?');
// For example. Given a Pirate bot, Weather Bot, and Stock Bot in your assistant registry on OpenAI.
// Run the below threads in parallel and return to you!
// |--> Will delegate to an existing Weather Bot
// |--> Will delegate to an existing Stock watcher Bot
// -> Pirate bot will not be invoked.
// -----
// The parent will respond with something like "I've arranged for two of our assistants to handle your requests. For assistance with stocks I have delegated that task  to the Stock Bot, and for the weather update in San Francisco, our Weatherbot will provide the current conditions. They will take care of your needs shortly."
//
// You will then get a response once each child responds with either a completion or a `required_action` run you can handle in your codebase easily.

console.log({
  parentRun: response.parentRun, // All information about the parent thread
  subRuns: response.subRuns, // array of runs created and their status for each spun-out child thread!
})

Available tools

Delegation via prompt

First, the main one you are probably interested in - delegation to sub-assistants. Its easy to set up and also to listen to events and add into your current workflow.

// Set up an event listener for when the parent response is completed so you don't have to wait
// for parent + children responses to all complete.
// Useful to return the parent response early while you work on the subtask tool_calls that 
// may or not be required depending on what happened.
OpenAIClient.beta.assistants.swarm.emitter.on('parent_assistant_complete', (args) => {
    console.group('Parent assistant response completed');
    console.log(args.parentRun.playground) // => https://platform.openai.com/playground.... to debug thread & run in browser.
    console.log(args.parentRun.textResponse) // => Yarrh! Want to be speaking to the captain do ya? Ill go fetch them ya land lubber.
    // args.parentRun => The full Run object from OpenAI so you can get the thread_id and other properties like status.
    console.log('\n\n')
    console.groupEnd();
});

// Set up an event listener for when the delegated assistant responses are completed so you don't have to wait
// for parent + children responses to all complete.
// From here you can handle all sub-run tool_calls if they are required to be run.
OpenAIClient.beta.assistants.swarm.emitter.on('child_assistants_complete', (args) => {
    console.group('Child assistant response completed');
    console.log(args.subRuns.map((run) => run.textResponse)) // => Yarrh! I am the captain of this vessel. Ye be after my treasure, Yar?
    console.log(args.subRuns.map((run) => run.playground)) // => https://platform.openai.com/playground.... to debug thread & run in browser.
    // args.subRuns[x].run => The full Run object from OpenAI so you can get the thread_id and other properties like status.
    console.log('\n\n')
    console.groupEnd();
});

// Set up and event listener to see every step event as it is completed:
OpenAIClient.beta.assistants.swarm.emitter.on('poll_event', ({ data }) => {
    console.group('Poll event!');
    console.log({
        status: data.status,
        text: data.prompt || data.textResponse,
        runId: data?.run?.id,
        link: data.playground,
        runStatus: data?.run?.status,
    })
    console.log('\n\n')
    console.groupEnd();
});

// Run the main process on a single text prompt to have work delegate between all of the possible assistants that are available.
const response = OpenAIClient.beta.assistants.swarm.delegateWithPrompt('Let me speak to the head pirate of this vessel! What say ye??');
// You can also just wait for the entire flow to finish instead of setting up listeners to keep the code more synchronous
console.log({
  parentRun: response.parentRun,
  subRuns: response.subRuns,
})

// You can also focus the given task or prompt on a subset of assistants that you know you want to handle delegated work.
// OpenAIClient.beta.assistants.swarm.delegateWithPrompt('Let me speak to the head pirate of this vessel! What say ye??', ['asst_lead_pirate']);

Get all available assistants

Right now, you need to paginate assitants to see who is around to answer a question or handle a task. Now, you can just make one call and we handle pagination for you

const allAssistants = await OpenAIClient.beta.assistants.swarm.allAssistants();
console.log(`Found ${allAssistants.length} assistants for this OpenAI Account`);
// will be an array of assistant objects you can filter or manage. The Swarm Manager will not appear here.

Get many known assistants at once

You are limited to fetching one assistant at a time via the API. Now you can get many at once

const assistantIds = ['asst_customer_success', 'asst_lead_pirate_manager', 'asst_that_was_deleted' ]
const specificAssistants = await OpenAIClient.beta.assistants.swarm.getAssistants(assistantIds);
console.log(`Found ${specificAssistants.length} assistants from ${assistantIds.length} ids given.`);
// Will be an array of assistant objects you can filter or manage. The Swarm Manager will not appear here.
// Invalid assistants will not appear in the end result.

常见问题

What is openai-assistant-swarm?

openai-assistant-swarm is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by Mintplex-Labs. Introducing the Assistant Swarm. An extension to the OpenAI Node SDK to automatically delegate work to any assistant you create in OpenAi through one united interface and manager. Now you can delegate work to a swarm of assistant all specialized with specific tasks you define. It has 617 GitHub stars.

Is openai-assistant-swarm safe to use?

openai-assistant-swarm failed SkillsLLM's automated security scan, which flagged one or more high-severity issues. Review the Security Report section carefully before using it.

How do I install openai-assistant-swarm?

Clone the repository with "git clone https://github.com/Mintplex-Labs/openai-assistant-swarm" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is openai-assistant-swarm written in?

openai-assistant-swarm is primarily written in TypeScript. It is open-source under Mintplex-Labs on GitHub, so you can review or fork the full source.

Are there alternatives to openai-assistant-swarm?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh openai-assistant-swarm against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情