{"id":15011272,"url":"https://github.com/mintplex-labs/openai-assistant-swarm","last_synced_at":"2025-10-31T14:08:54.883Z","repository":{"id":207524188,"uuid":"719453622","full_name":"Mintplex-Labs/openai-assistant-swarm","owner":"Mintplex-Labs","description":"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.","archived":false,"fork":false,"pushed_at":"2023-11-18T00:06:42.000Z","size":1967,"stargazers_count":570,"open_issues_count":0,"forks_count":79,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-10-25T21:33:09.945Z","etag":null,"topics":["ai","ai-agents","ai-agents-framework","ai-assistant","ai-tools","autogpt","automation","function-calling","gpt-35-turbo","gpt-4-api","gpts","node-js","npm","openai","openai-api","openai-assistant-api","openai-assistant-function-call","openai-assistants","openai-functions","openai-nodejs"],"latest_commit_sha":null,"homepage":"https://mintplexlabs.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mintplex-Labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-16T07:45:05.000Z","updated_at":"2025-10-24T11:28:21.000Z","dependencies_parsed_at":"2023-11-16T09:25:52.899Z","dependency_job_id":"30a19060-4d23-445c-bb7e-5dae2845b04e","html_url":"https://github.com/Mintplex-Labs/openai-assistant-swarm","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"de7387a2ea0d71b4782adab027063d0f96afb433"},"previous_names":["mintplex-labs/openai-assistant-swarm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Mintplex-Labs/openai-assistant-swarm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintplex-Labs%2Fopenai-assistant-swarm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintplex-Labs%2Fopenai-assistant-swarm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintplex-Labs%2Fopenai-assistant-swarm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintplex-Labs%2Fopenai-assistant-swarm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mintplex-Labs","download_url":"https://codeload.github.com/Mintplex-Labs/openai-assistant-swarm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintplex-Labs%2Fopenai-assistant-swarm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281999694,"owners_count":26596939,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-31T02:00:07.401Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-agents","ai-agents-framework","ai-assistant","ai-tools","autogpt","automation","function-calling","gpt-35-turbo","gpt-4-api","gpts","node-js","npm","openai","openai-api","openai-assistant-api","openai-assistant-function-call","openai-assistants","openai-functions","openai-nodejs"],"created_at":"2024-09-24T19:40:05.532Z","updated_at":"2025-10-31T14:08:54.862Z","avatar_url":"https://github.com/Mintplex-Labs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/Mintplex-Labs/openai-assistant-swarm/main/images/readme.png\" alt=\"OpenAI Assistant Swarm Manager banner\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cb\u003eOpenAI Assistant Swarm Manager: A library to turn your OpenAi assistants into an army\u003c/i\u003e\u003c/b\u003e.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://discord.gg/6UyHPeGZAC\" target=\"_blank\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/chat-mintplex_labs-blue.svg?style=flat\u0026logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAH1UExURQAAAP////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////r6+ubn5+7u7/3+/v39/enq6urq6/v7+97f39rb26eoqT1BQ0pOT4+Rkuzs7cnKykZKS0NHSHl8fdzd3ejo6UxPUUBDRdzc3RwgIh8jJSAkJm5xcvHx8aanqB4iJFBTVezt7V5hYlJVVuLj43p9fiImKCMnKZKUlaaoqSElJ21wcfT09O3u7uvr6zE0Nr6/wCUpK5qcnf7+/nh7fEdKTHx+f0tPUOTl5aipqiouMGtubz5CRDQ4OsTGxufn515hY7a3uH1/gXBydIOFhlVYWvX29qaoqCQoKs7Pz/Pz87/AwUtOUNfY2dHR0mhrbOvr7E5RUy8zNXR2d/f39+Xl5UZJSx0hIzQ3Odra2/z8/GlsbaGjpERHSezs7L/BwScrLTQ4Odna2zM3Obm7u3x/gKSmp9jZ2T1AQu/v71pdXkVISr2+vygsLiInKTg7PaOlpisvMcXGxzk8PldaXPLy8u7u7rm6u7S1tsDBwvj4+MPExbe4ueXm5s/Q0Kyf7ewAA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" alt=\"Discord\"\u003e\n  \u003c/a\u003e |\n  \u003ca href=\"https://github.com/Mintplex-Labs/openai-assistant-swarm/blob/master/LICENSE\" target=\"_blank\"\u003e\n      \u003cimg src=\"https://img.shields.io/static/v1?label=license\u0026message=MIT\u0026color=white\" alt=\"License\"\u003e\n  \u003c/a\u003e |\n   \u003ca href=\"https://mintplexlabs.com\" target=\"_blank\"\u003e\n    Mintplex Labs Inc\n  \u003c/a\u003e|\n   \u003ca href=\"https://www.npmjs.com/package/@mintplex-labs/openai-assistant-swarm\" target=\"_blank\"\u003e\n    NPM\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## What is the Swarm Manager\nOpenAI'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.\n\nAll of the mental overhead of managing which assistant does what is now handled and wrapped up with a bow.\n\n## How does it work?\nThe Swarm Manager acts as an extension of the OpenAI NodeJS SDK - making available a new `.swarm` method available on `beta.assistants`.\n\nFirst, install the openai SDK for NodeJS\n```shell\nyarn add openai\n# or \nnpm install openai\n```\n\nNext install the `openai-assistant-swarm` package\n```shell\nyarn add @mintplex-labs/openai-assistant-swarm\n# or \nnpm install @mintplex-labs/openai-assistant-swarm\n```\n\nNow use the SDK as you normally would and run the extension function and initialize the agent swarm manager.\n```javascript\n// Enable the client for OpenAi as you normally would\nconst OpenAIClient = (\n    new OpenAI({\n        apiKey: process.env.OPEN_AI_KEY\n    }));\n\n// The simply call this function on the client to extend the OpenAI SDK to now have\n// OpenAIClient.beta.assistants.swarm functions available.\nEnableSwarmAbilities(OpenAIClient, {\n  // all options are OPTIONAL\n  debug: false, // to see console log outputs of the process and playground links for debugging.\n  managerAssistantOptions: {\n         name: \"[AUTOMATED] ___Swarm Manager\", // Name of created/maintained agent by the library\n        model: \"gpt-4\", // Use gpt-4 for better reasoning and calling.\n        instructions: 'Instructions you are going to give the agent manager to delegate tasks to'; // Override the default instructions.\n    };\n});\n\n// Initialize the swarm manager to create the swarm manager and also register it with\n// your account. Swarm manager can be configured via options on `EnableSwarmAbilities`\nawait OpenAIClient.beta.assistants.swarm.init();\n// Now all swarm management function are available to you!\n```\n\n## A simple example\n\nAn full example delegating a single input between 3 available assistants...\n```javascript\nimport OpenAI from 'openai';\nimport { EnableSwarmAbilities } from '@mintplex-labs/openai-assistant-swarm';\nconst OpenAIClient = new OpenAI({apiKey: process.env.OPEN_AI_KEY});\nEnableSwarmAbilities(OpenAIClient);\nawait OpenAIClient.beta.assistants.swarm.init();\n\n// Optional - set up listeners here to wait for specific events to return to the user since streaming is not available yet.\n\n// Run the main process on a single text prompt to have work delegate between all of your assistants that are available.\nconst response = OpenAIClient.beta.assistants.swarm.delegateWithPrompt('What is the weather in New York city right now? Also what is the top stock for today?');\n// For example. Given a Pirate bot, Weather Bot, and Stock Bot in your assistant registry on OpenAI.\n// Run the below threads in parallel and return to you!\n// |--\u003e Will delegate to an existing Weather Bot\n// |--\u003e Will delegate to an existing Stock watcher Bot\n// -\u003e Pirate bot will not be invoked.\n// -----\n// 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.\"\n//\n// 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.\n\nconsole.log({\n  parentRun: response.parentRun, // All information about the parent thread\n  subRuns: response.subRuns, // array of runs created and their status for each spun-out child thread!\n})\n\n```\n\n## Available tools\n\n**Delegation via prompt**\n\nFirst, the main one you are probably interested in - delegation to sub-assistants. Its easy to set up and\nalso to listen to events and add into your current workflow.\n```javascript\n// Set up an event listener for when the parent response is completed so you don't have to wait\n// for parent + children responses to all complete.\n// Useful to return the parent response early while you work on the subtask tool_calls that \n// may or not be required depending on what happened.\nOpenAIClient.beta.assistants.swarm.emitter.on('parent_assistant_complete', (args) =\u003e {\n    console.group('Parent assistant response completed');\n    console.log(args.parentRun.playground) // =\u003e https://platform.openai.com/playground.... to debug thread \u0026 run in browser.\n    console.log(args.parentRun.textResponse) // =\u003e Yarrh! Want to be speaking to the captain do ya? Ill go fetch them ya land lubber.\n    // args.parentRun =\u003e The full Run object from OpenAI so you can get the thread_id and other properties like status.\n    console.log('\\n\\n')\n    console.groupEnd();\n});\n\n// Set up an event listener for when the delegated assistant responses are completed so you don't have to wait\n// for parent + children responses to all complete.\n// From here you can handle all sub-run tool_calls if they are required to be run.\nOpenAIClient.beta.assistants.swarm.emitter.on('child_assistants_complete', (args) =\u003e {\n    console.group('Child assistant response completed');\n    console.log(args.subRuns.map((run) =\u003e run.textResponse)) // =\u003e Yarrh! I am the captain of this vessel. Ye be after my treasure, Yar?\n    console.log(args.subRuns.map((run) =\u003e run.playground)) // =\u003e https://platform.openai.com/playground.... to debug thread \u0026 run in browser.\n    // args.subRuns[x].run =\u003e The full Run object from OpenAI so you can get the thread_id and other properties like status.\n    console.log('\\n\\n')\n    console.groupEnd();\n});\n\n// Set up and event listener to see every step event as it is completed:\nOpenAIClient.beta.assistants.swarm.emitter.on('poll_event', ({ data }) =\u003e {\n    console.group('Poll event!');\n    console.log({\n        status: data.status,\n        text: data.prompt || data.textResponse,\n        runId: data?.run?.id,\n        link: data.playground,\n        runStatus: data?.run?.status,\n    })\n    console.log('\\n\\n')\n    console.groupEnd();\n});\n\n// Run the main process on a single text prompt to have work delegate between all of the possible assistants that are available.\nconst response = OpenAIClient.beta.assistants.swarm.delegateWithPrompt('Let me speak to the head pirate of this vessel! What say ye??');\n// You can also just wait for the entire flow to finish instead of setting up listeners to keep the code more synchronous\nconsole.log({\n  parentRun: response.parentRun,\n  subRuns: response.subRuns,\n})\n\n// You can also focus the given task or prompt on a subset of assistants that you know you want to handle delegated work.\n// OpenAIClient.beta.assistants.swarm.delegateWithPrompt('Let me speak to the head pirate of this vessel! What say ye??', ['asst_lead_pirate']);\n```\n\n**Get all available assistants**\n\nRight 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\n```javascript\nconst allAssistants = await OpenAIClient.beta.assistants.swarm.allAssistants();\nconsole.log(`Found ${allAssistants.length} assistants for this OpenAI Account`);\n// will be an array of assistant objects you can filter or manage. The Swarm Manager will not appear here.\n```\n\n**Get many known assistants at once**\n\nYou are limited to fetching one assistant at a time via the API. Now you can get many at once\n```javascript\nconst assistantIds = ['asst_customer_success', 'asst_lead_pirate_manager', 'asst_that_was_deleted' ]\nconst specificAssistants = await OpenAIClient.beta.assistants.swarm.getAssistants(assistantIds);\nconsole.log(`Found ${specificAssistants.length} assistants from ${assistantIds.length} ids given.`);\n// Will be an array of assistant objects you can filter or manage. The Swarm Manager will not appear here.\n// Invalid assistants will not appear in the end result.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmintplex-labs%2Fopenai-assistant-swarm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmintplex-labs%2Fopenai-assistant-swarm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmintplex-labs%2Fopenai-assistant-swarm/lists"}