[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-openai--swarm":3,"tool-openai--swarm":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":79,"owner_email":79,"owner_twitter":79,"owner_website":80,"owner_url":81,"languages":82,"stars":87,"forks":88,"last_commit_at":89,"license":90,"difficulty_score":91,"env_os":78,"env_gpu":92,"env_ram":92,"env_deps":93,"category_tags":97,"github_topics":79,"view_count":23,"oss_zip_url":79,"oss_zip_packed_at":79,"status":16,"created_at":98,"updated_at":99,"faqs":100,"releases":126},2980,"openai\u002Fswarm","swarm","Educational framework exploring ergonomic, lightweight multi-agent orchestration. Managed by OpenAI Solution team.","Swarm 是由 OpenAI 解决方案团队推出的一个实验性教育框架，旨在探索如何以轻量、符合人体工学的方式协调多个 AI 智能体（Multi-Agent）协同工作。它主要解决了在复杂任务中，将大量独立能力或指令硬编码进单个提示词（Prompt）难以维护且缺乏灵活性的问题。通过引入“智能体”与“交接（Handoffs）”这两个核心概念，Swarm 让不同的智能体能够根据任务需求，动态地将对话控制权移交给更合适的伙伴，从而实现高效的任务编排与执行。\n\n该工具特别适合开发者和技术研究人员使用，尤其是那些希望深入理解多智能体协作机制、构建可扩展原型或进行相关技术探索的人群。需要注意的是，Swarm 目前已被功能更强大且适用于生产环境的\"OpenAI Agents SDK\"所取代，官方建议新项目直接迁移至新 SDK。\n\nSwarm 的技术亮点在于其极简的设计哲学：它完全基于 Chat Completions API 构建，不在服务端存储状态，所有逻辑均在客户端运行。这种无状态设计不仅降低了学习门槛，还赋予了开发者极高的控制权和测试便利性，使其成为学习多智能体架构理想的入门教具。","![Swarm Logo](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fopenai_swarm_readme_70f3bdf645aa.png)\n\n# Swarm (experimental, educational)\n\n> [!IMPORTANT]\n> Swarm is now replaced by the [OpenAI Agents SDK](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fopenai-agents-python), which is a production-ready evolution of Swarm. The Agents SDK features key improvements and will be actively maintained by the OpenAI team.\n>\n> We recommend migrating to the Agents SDK for all production use cases.\n\n## Install\n\nRequires Python 3.10+\n\n```shell\npip install git+ssh:\u002F\u002Fgit@github.com\u002Fopenai\u002Fswarm.git\n```\n\nor\n\n```shell\npip install git+https:\u002F\u002Fgithub.com\u002Fopenai\u002Fswarm.git\n```\n\n## Usage\n\n```python\nfrom swarm import Swarm, Agent\n\nclient = Swarm()\n\ndef transfer_to_agent_b():\n    return agent_b\n\n\nagent_a = Agent(\n    name=\"Agent A\",\n    instructions=\"You are a helpful agent.\",\n    functions=[transfer_to_agent_b],\n)\n\nagent_b = Agent(\n    name=\"Agent B\",\n    instructions=\"Only speak in Haikus.\",\n)\n\nresponse = client.run(\n    agent=agent_a,\n    messages=[{\"role\": \"user\", \"content\": \"I want to talk to agent B.\"}],\n)\n\nprint(response.messages[-1][\"content\"])\n```\n\n```\nHope glimmers brightly,\nNew paths converge gracefully,\nWhat can I assist?\n```\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Examples](#examples)\n- [Documentation](#documentation)\n  - [Running Swarm](#running-swarm)\n  - [Agents](#agents)\n  - [Functions](#functions)\n  - [Streaming](#streaming)\n- [Evaluations](#evaluations)\n- [Utils](#utils)\n\n# Overview\n\nSwarm focuses on making agent **coordination** and **execution** lightweight, highly controllable, and easily testable.\n\nIt accomplishes this through two primitive abstractions: `Agent`s and **handoffs**. An `Agent` encompasses `instructions` and `tools`, and can at any point choose to hand off a conversation to another `Agent`.\n\nThese primitives are powerful enough to express rich dynamics between tools and networks of agents, allowing you to build scalable, real-world solutions while avoiding a steep learning curve.\n\n> [!NOTE]\n> Swarm Agents are not related to Assistants in the Assistants API. They are named similarly for convenience, but are otherwise completely unrelated. Swarm is entirely powered by the Chat Completions API and is hence stateless between calls.\n\n## Why Swarm\n\nSwarm explores patterns that are lightweight, scalable, and highly customizable by design. Approaches similar to Swarm are best suited for situations dealing with a large number of independent capabilities and instructions that are difficult to encode into a single prompt.\n\nThe Assistants API is a great option for developers looking for fully-hosted threads and built in memory management and retrieval. However, Swarm is an educational resource for developers curious to learn about multi-agent orchestration. Swarm runs (almost) entirely on the client and, much like the Chat Completions API, does not store state between calls.\n\n# Examples\n\nCheck out `\u002Fexamples` for inspiration! Learn more about each one in its README.\n\n- [`basic`](examples\u002Fbasic): Simple examples of fundamentals like setup, function calling, handoffs, and context variables\n- [`triage_agent`](examples\u002Ftriage_agent): Simple example of setting up a basic triage step to hand off to the right agent\n- [`weather_agent`](examples\u002Fweather_agent): Simple example of function calling\n- [`airline`](examples\u002Fairline): A multi-agent setup for handling different customer service requests in an airline context.\n- [`support_bot`](examples\u002Fsupport_bot): A customer service bot which includes a user interface agent and a help center agent with several tools\n- [`personal_shopper`](examples\u002Fpersonal_shopper): A personal shopping agent that can help with making sales and refunding orders\n\n# Documentation\n\n![Swarm Diagram](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fopenai_swarm_readme_88dad66e7e03.png)\n\n## Running Swarm\n\nStart by instantiating a Swarm client (which internally just instantiates an `OpenAI` client).\n\n```python\nfrom swarm import Swarm\n\nclient = Swarm()\n```\n\n### `client.run()`\n\nSwarm's `run()` function is analogous to the `chat.completions.create()` function in the Chat Completions API – it takes `messages` and returns `messages` and saves no state between calls. Importantly, however, it also handles Agent function execution, hand-offs, context variable references, and can take multiple turns before returning to the user.\n\nAt its core, Swarm's `client.run()` implements the following loop:\n\n1. Get a completion from the current Agent\n2. Execute tool calls and append results\n3. Switch Agent if necessary\n4. Update context variables, if necessary\n5. If no new function calls, return\n\n#### Arguments\n\n| Argument              | Type    | Description                                                                                                                                            | Default        |\n| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------- |\n| **agent**             | `Agent` | The (initial) agent to be called.                                                                                                                      | (required)     |\n| **messages**          | `List`  | A list of message objects, identical to [Chat Completions `messages`](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fchat\u002Fcreate#chat-create-messages) | (required)     |\n| **context_variables** | `dict`  | A dictionary of additional context variables, available to functions and Agent instructions                                                            | `{}`           |\n| **max_turns**         | `int`   | The maximum number of conversational turns allowed                                                                                                     | `float(\"inf\")` |\n| **model_override**    | `str`   | An optional string to override the model being used by an Agent                                                                                        | `None`         |\n| **execute_tools**     | `bool`  | If `False`, interrupt execution and immediately returns `tool_calls` message when an Agent tries to call a function                                    | `True`         |\n| **stream**            | `bool`  | If `True`, enables streaming responses                                                                                                                 | `False`        |\n| **debug**             | `bool`  | If `True`, enables debug logging                                                                                                                       | `False`        |\n\nOnce `client.run()` is finished (after potentially multiple calls to agents and tools) it will return a `Response` containing all the relevant updated state. Specifically, the new `messages`, the last `Agent` to be called, and the most up-to-date `context_variables`. You can pass these values (plus new user messages) in to your next execution of `client.run()` to continue the interaction where it left off – much like `chat.completions.create()`. (The `run_demo_loop` function implements an example of a full execution loop in `\u002Fswarm\u002Frepl\u002Frepl.py`.)\n\n#### `Response` Fields\n\n| Field                 | Type    | Description                                                                                                                                                                                                                                                                  |\n| --------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **messages**          | `List`  | A list of message objects generated during the conversation. Very similar to [Chat Completions `messages`](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fchat\u002Fcreate#chat-create-messages), but with a `sender` field indicating which `Agent` the message originated from. |\n| **agent**             | `Agent` | The last agent to handle a message.                                                                                                                                                                                                                                          |\n| **context_variables** | `dict`  | The same as the input variables, plus any changes.                                                                                                                                                                                                                           |\n\n## Agents\n\nAn `Agent` simply encapsulates a set of `instructions` with a set of `functions` (plus some additional settings below), and has the capability to hand off execution to another `Agent`.\n\nWhile it's tempting to personify an `Agent` as \"someone who does X\", it can also be used to represent a very specific workflow or step defined by a set of `instructions` and `functions` (e.g. a set of steps, a complex retrieval, single step of data transformation, etc). This allows `Agent`s to be composed into a network of \"agents\", \"workflows\", and \"tasks\", all represented by the same primitive.\n\n## `Agent` Fields\n\n| Field            | Type                     | Description                                                                   | Default                      |\n| ---------------- | ------------------------ | ----------------------------------------------------------------------------- | ---------------------------- |\n| **name**         | `str`                    | The name of the agent.                                                        | `\"Agent\"`                    |\n| **model**        | `str`                    | The model to be used by the agent.                                            | `\"gpt-4o\"`                   |\n| **instructions** | `str` or `func() -> str` | Instructions for the agent, can be a string or a callable returning a string. | `\"You are a helpful agent.\"` |\n| **functions**    | `List`                   | A list of functions that the agent can call.                                  | `[]`                         |\n| **tool_choice**  | `str`                    | The tool choice for the agent, if any.                                        | `None`                       |\n\n### Instructions\n\n`Agent` `instructions` are directly converted into the `system` prompt of a conversation (as the first message). Only the `instructions` of the active `Agent` will be present at any given time (e.g. if there is an `Agent` handoff, the `system` prompt will change, but the chat history will not.)\n\n```python\nagent = Agent(\n   instructions=\"You are a helpful agent.\"\n)\n```\n\nThe `instructions` can either be a regular `str`, or a function that returns a `str`. The function can optionally receive a `context_variables` parameter, which will be populated by the `context_variables` passed into `client.run()`.\n\n```python\ndef instructions(context_variables):\n   user_name = context_variables[\"user_name\"]\n   return f\"Help the user, {user_name}, do whatever they want.\"\n\nagent = Agent(\n   instructions=instructions\n)\nresponse = client.run(\n   agent=agent,\n   messages=[{\"role\":\"user\", \"content\": \"Hi!\"}],\n   context_variables={\"user_name\":\"John\"}\n)\nprint(response.messages[-1][\"content\"])\n```\n\n```\nHi John, how can I assist you today?\n```\n\n## Functions\n\n- Swarm `Agent`s can call python functions directly.\n- Function should usually return a `str` (values will be attempted to be cast as a `str`).\n- If a function returns an `Agent`, execution will be transferred to that `Agent`.\n- If a function defines a `context_variables` parameter, it will be populated by the `context_variables` passed into `client.run()`.\n\n```python\ndef greet(context_variables, language):\n   user_name = context_variables[\"user_name\"]\n   greeting = \"Hola\" if language.lower() == \"spanish\" else \"Hello\"\n   print(f\"{greeting}, {user_name}!\")\n   return \"Done\"\n\nagent = Agent(\n   functions=[greet]\n)\n\nclient.run(\n   agent=agent,\n   messages=[{\"role\": \"user\", \"content\": \"Usa greet() por favor.\"}],\n   context_variables={\"user_name\": \"John\"}\n)\n```\n\n```\nHola, John!\n```\n\n- If an `Agent` function call has an error (missing function, wrong argument, error) an error response will be appended to the chat so the `Agent` can recover gracefully.\n- If multiple functions are called by the `Agent`, they will be executed in that order.\n\n### Handoffs and Updating Context Variables\n\nAn `Agent` can hand off to another `Agent` by returning it in a `function`.\n\n```python\nsales_agent = Agent(name=\"Sales Agent\")\n\ndef transfer_to_sales():\n   return sales_agent\n\nagent = Agent(functions=[transfer_to_sales])\n\nresponse = client.run(agent, [{\"role\":\"user\", \"content\":\"Transfer me to sales.\"}])\nprint(response.agent.name)\n```\n\n```\nSales Agent\n```\n\nIt can also update the `context_variables` by returning a more complete `Result` object. This can also contain a `value` and an `agent`, in case you want a single function to return a value, update the agent, and update the context variables (or any subset of the three).\n\n```python\nsales_agent = Agent(name=\"Sales Agent\")\n\ndef talk_to_sales():\n   print(\"Hello, World!\")\n   return Result(\n       value=\"Done\",\n       agent=sales_agent,\n       context_variables={\"department\": \"sales\"}\n   )\n\nagent = Agent(functions=[talk_to_sales])\n\nresponse = client.run(\n   agent=agent,\n   messages=[{\"role\": \"user\", \"content\": \"Transfer me to sales\"}],\n   context_variables={\"user_name\": \"John\"}\n)\nprint(response.agent.name)\nprint(response.context_variables)\n```\n\n```\nSales Agent\n{'department': 'sales', 'user_name': 'John'}\n```\n\n> [!NOTE]\n> If an `Agent` calls multiple functions to hand-off to an `Agent`, only the last handoff function will be used.\n\n### Function Schemas\n\nSwarm automatically converts functions into a JSON Schema that is passed into Chat Completions `tools`.\n\n- Docstrings are turned into the function `description`.\n- Parameters without default values are set to `required`.\n- Type hints are mapped to the parameter's `type` (and default to `string`).\n- Per-parameter descriptions are not explicitly supported, but should work similarly if just added in the docstring. (In the future docstring argument parsing may be added.)\n\n```python\ndef greet(name, age: int, location: str = \"New York\"):\n   \"\"\"Greets the user. Make sure to get their name and age before calling.\n\n   Args:\n      name: Name of the user.\n      age: Age of the user.\n      location: Best place on earth.\n   \"\"\"\n   print(f\"Hello {name}, glad you are {age} in {location}!\")\n```\n\n```javascript\n{\n   \"type\": \"function\",\n   \"function\": {\n      \"name\": \"greet\",\n      \"description\": \"Greets the user. Make sure to get their name and age before calling.\\n\\nArgs:\\n   name: Name of the user.\\n   age: Age of the user.\\n   location: Best place on earth.\",\n      \"parameters\": {\n         \"type\": \"object\",\n         \"properties\": {\n            \"name\": {\"type\": \"string\"},\n            \"age\": {\"type\": \"integer\"},\n            \"location\": {\"type\": \"string\"}\n         },\n         \"required\": [\"name\", \"age\"]\n      }\n   }\n}\n```\n\n## Streaming\n\n```python\nstream = client.run(agent, messages, stream=True)\nfor chunk in stream:\n   print(chunk)\n```\n\nUses the same events as [Chat Completions API streaming](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fstreaming). See `process_and_print_streaming_response` in `\u002Fswarm\u002Frepl\u002Frepl.py` as an example.\n\nTwo new event types have been added:\n\n- `{\"delim\":\"start\"}` and `{\"delim\":\"end\"}`, to signal each time an `Agent` handles a single message (response or function call). This helps identify switches between `Agent`s.\n- `{\"response\": Response}` will return a `Response` object at the end of a stream with the aggregated (complete) response, for convenience.\n\n# Evaluations\n\nEvaluations are crucial to any project, and we encourage developers to bring their own eval suites to test the performance of their swarms. For reference, we have some examples for how to eval swarm in the `airline`, `weather_agent` and `triage_agent` quickstart examples. See the READMEs for more details.\n\n# Utils\n\nUse the `run_demo_loop` to test out your swarm! This will run a REPL on your command line. Supports streaming.\n\n```python\nfrom swarm.repl import run_demo_loop\n...\nrun_demo_loop(agent, stream=True)\n```\n\n# Core Contributors\n\n- Ilan Bigio - [ibigio](https:\u002F\u002Fgithub.com\u002Fibigio)\n- James Hills - [jhills20](https:\u002F\u002Fgithub.com\u002Fjhills20)\n- Shyamal Anadkat - [shyamal-anadkat](https:\u002F\u002Fgithub.com\u002Fshyamal-anadkat)\n- Charu Jaiswal - [charuj](https:\u002F\u002Fgithub.com\u002Fcharuj)\n- Colin Jarvis - [colin-openai](https:\u002F\u002Fgithub.com\u002Fcolin-openai)\n- Katia Gil Guzman - [katia-openai](https:\u002F\u002Fgithub.com\u002Fkatia-openai)\n","![Swarm Logo](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fopenai_swarm_readme_70f3bdf645aa.png)\n\n# Swarm（实验性、教育用途）\n\n> [!重要]\n> Swarm 现已由 [OpenAI Agents SDK](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fopenai-agents-python) 取代，它是 Swarm 的生产就绪版本。Agents SDK 具有关键改进，并将由 OpenAI 团队积极维护。\n>\n> 我们建议所有生产环境的使用都迁移到 Agents SDK。\n\n## 安装\n\n需要 Python 3.10 或更高版本\n\n```shell\npip install git+ssh:\u002F\u002Fgit@github.com\u002Fopenai\u002Fswarm.git\n```\n\n或者\n\n```shell\npip install git+https:\u002F\u002Fgithub.com\u002Fopenai\u002Fswarm.git\n```\n\n## 使用方法\n\n```python\nfrom swarm import Swarm, Agent\n\nclient = Swarm()\n\ndef transfer_to_agent_b():\n    return agent_b\n\n\nagent_a = Agent(\n    name=\"Agent A\",\n    instructions=\"你是一个乐于助人的智能体。\",\n    functions=[transfer_to_agent_b],\n)\n\nagent_b = Agent(\n    name=\"Agent B\",\n    instructions=\"只用俳句表达。\",\n)\n\nresponse = client.run(\n    agent=agent_a,\n    messages=[{\"role\": \"user\", \"content\": \"我想和 Agent B 联系。\"}],\n)\n\nprint(response.messages[-1][\"content\"])\n```\n\n```\n希望熠熠生辉，\n新路优雅交汇，\n有何可以帮您？\n```\n\n## 目录\n\n- [概述](#overview)\n- [示例](#examples)\n- [文档](#documentation)\n  - [运行 Swarm](#running-swarm)\n  - [智能体](#agents)\n  - [函数](#functions)\n  - [流式处理](#streaming)\n- [评估](#evaluations)\n- [工具](#utils)\n\n# 概述\n\nSwarm 致力于使智能体之间的**协调**和**执行**轻量级、高度可控且易于测试。\n\n它通过两种基本抽象实现这一目标：`Agent` 和**交接**。一个 `Agent` 包含 `instructions` 和 `tools`，并且可以在任何时候选择将对话交接给另一个 `Agent`。\n\n这些基本抽象足够强大，能够表达工具与智能体网络之间的丰富动态，使您能够在避免陡峭学习曲线的同时构建可扩展的现实世界解决方案。\n\n> [!注意]\n> Swarm 中的智能体与 Assistants API 中的 Assistants 无关。它们之所以名称相似只是为了方便，但实际上完全不相关。Swarm 完全由 Chat Completions API 提供支持，因此在每次调用之间是无状态的。\n\n## 为什么选择 Swarm\n\nSwarm 探索的是设计上轻量级、可扩展且高度可定制的模式。类似 Swarm 的方法最适合处理大量独立能力以及难以编码到单个提示中的复杂指令的情况。\n\n对于希望使用完全托管的线程以及内置记忆管理和检索功能的开发者来说，Assistants API 是一个很好的选择。然而，Swarm 则是为那些对多智能体编排感兴趣的开发者提供的教育资源。Swarm 几乎完全在客户端运行，而且与 Chat Completions API 类似，在每次调用之间不会存储状态。\n\n# 示例\n\n请查看 `\u002Fexamples` 获取灵感！每个示例的详细信息请参阅其 README 文件。\n\n- [`basic`](examples\u002Fbasic)：基础示例，包括设置、函数调用、交接和上下文变量等基本内容。\n- [`triage_agent`](examples\u002Ftriage_agent)：简单的分诊示例，用于将用户引导至合适的智能体。\n- [`weather_agent`](examples\u002Fweather_agent)：简单的函数调用示例。\n- [`airline`](examples\u002Fairline)：一个多智能体系统，用于在航空公司环境中处理不同的客户服务请求。\n- [`support_bot`](examples\u002Fsupport_bot)：一个包含用户界面智能体和帮助中心智能体的客服机器人，配备多种工具。\n- [`personal_shopper`](examples\u002Fpersonal_shopper)：一个个人购物助手，可以帮助完成销售并处理订单退款。\n\n# 文档\n\n![Swarm 流程图](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fopenai_swarm_readme_88dad66e7e03.png)\n\n## 运行 Swarm\n\n首先实例化一个 Swarm 客户端（内部只是实例化了一个 `OpenAI` 客户端）。\n\n```python\nfrom swarm import Swarm\n\nclient = Swarm()\n```\n\n### `client.run()`\n\nSwarm 的 `run()` 函数类似于 Chat Completions API 中的 `chat.completions.create()` 函数——它接收 `messages` 参数并返回 `messages`，且在每次调用之间不会保存任何状态。然而，更重要的是，它还负责处理 Agent 的函数执行、任务交接、上下文变量引用，并且可以在返回给用户之前进行多轮交互。\n\n从本质上讲，Swarm 的 `client.run()` 实现了以下循环：\n\n1. 从当前 Agent 获取响应\n2. 执行工具调用并将结果附加到消息中\n3. 如有必要，切换 Agent\n4. 如有必要，更新上下文变量\n5. 如果没有新的函数调用，则返回结果\n\n#### 参数\n\n| 参数              | 类型    | 描述                                                                                                                                            | 默认值        |\n| ----------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------- |\n| **agent**         | `Agent` | 要调用的（初始）Agent。                                                                                                                      | (必填)     |\n| **messages**      | `List`  | 消息对象列表，与 [Chat Completions 的 `messages`](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fchat\u002Fcreate#chat-create-messages) 完全相同 | (必填)     |\n| **context_variables** | `dict`  | 一组额外的上下文变量字典，可供函数和 Agent 指令使用                                                            | `{}`           |\n| **max_turns**     | `int`   | 允许的最大对话轮次数                                                                                                     | `float(\"inf\")` |\n| **model_override**    | `str`   | 可选字符串，用于覆盖 Agent 使用的模型                                                                                        | `None`         |\n| **execute_tools**     | `bool`  | 如果为 `False`，当 Agent 尝试调用函数时，将中断执行并立即返回包含 `tool_calls` 的消息                                    | `True`         |\n| **stream**            | `bool`  | 如果为 `True`，则启用流式响应                                                                                                                 | `False`        |\n| **debug**             | `bool`  | 如果为 `True`，则启用调试日志                                                                                                                       | `False`        |\n\n一旦 `client.run()` 完成（可能经过多次 Agent 和工具的调用），它将返回一个 `Response` 对象，其中包含所有相关的更新状态。具体来说，包括新的 `messages`、最后被调用的 `Agent` 以及最新的 `context_variables`。您可以将这些值（加上新的用户消息）传递到下一次 `client.run()` 调用中，以从中断的地方继续交互——这与 `chat.completions.create()` 的行为非常相似。（`run_demo_loop` 函数在 `\u002Fswarm\u002Frepl\u002Frepl.py` 中实现了一个完整的执行循环示例。）\n\n#### `Response` 字段\n\n| 字段                 | 类型    | 描述                                                                                                                                                                                                                                                                  |\n| -------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **messages**          | `List`  | 在对话过程中生成的消息对象列表。与 [Chat Completions 的 `messages`](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fchat\u002Fcreate#chat-create-messages) 非常相似，但增加了一个 `sender` 字段，用于指示消息来自哪个 `Agent`。 |\n| **agent**             | `Agent` | 最后处理消息的 Agent。                                                                                                                                                                                                                                          |\n| **context_variables** | `dict`  | 与输入变量相同，但包含了任何已发生的变更。                                                                                                                                                                                                                           |\n\n## Agents\n\n一个 `Agent` 简单地封装了一组 `instructions` 和一组 `functions`（以及一些额外的设置），并且具备将执行权移交给他者的能力。\n\n尽管我们倾向于将 `Agent` 比作“做某事的人”，但它也可以用来表示由一组 `instructions` 和 `functions` 定义的非常具体的流程或步骤（例如一系列步骤、复杂的检索操作、单一的数据转换步骤等）。这使得 `Agent` 可以组合成一个由“代理”、“工作流”和“任务”组成的网络，而所有这些都可以用相同的原语来表示。\n\n## `Agent` 字段\n\n| 字段            | 类型                     | 描述                                                                   | 默认                      |\n| ---------------- | ------------------------ | ----------------------------------------------------------------------------- | ---------------------------- |\n| **name**         | `str`                    | Agent 的名称。                                                        | `\"Agent\"`                    |\n| **model**        | `str`                    | Agent 使用的模型。                                            | `\"gpt-4o\"`                   |\n| **instructions** | `str` 或 `func() -> str` | Agent 的指令，可以是字符串，也可以是一个返回字符串的可调用函数。 | `\"You are a helpful agent.\"` |\n| **functions**    | `List`                   | Agent 可以调用的函数列表。                                  | `[]`                         |\n| **tool_choice**  | `str`                    | Agent 的工具选择（如果有）。                                        | `None`                       |\n\n### 指令\n\n`Agent` 的 `instructions` 会直接转换为对话的 `system` 提示（作为第一条消息）。在任何给定时刻，只有当前活动的 `Agent` 的 `instructions` 才会存在（例如，如果发生 `Agent` 接手，`system` 提示会发生变化，但聊天历史不会改变）。\n\n```python\nagent = Agent(\n   instructions=\"你是一个乐于助人的智能体。\"\n)\n```\n\n`instructions` 可以是普通的 `str`，也可以是一个返回 `str` 的函数。该函数可以选择性地接收一个 `context_variables` 参数，这个参数将由传递给 `client.run()` 的 `context_variables` 填充。\n\n```python\ndef instructions(context_variables):\n   user_name = context_variables[\"user_name\"]\n   return f\"帮助用户 {user_name} 完成他们想要做的事情。\"\n\nagent = Agent(\n   instructions=instructions\n)\nresponse = client.run(\n   agent=agent,\n   messages=[{\"role\":\"user\", \"content\": \"你好！\"}],\n   context_variables={\"user_name\":\"John\"}\n)\nprint(response.messages[-1][\"content\"])\n```\n\n```\n你好 John，今天有什么可以帮您的吗？\n```\n\n## 函数\n\n- Swarm 的 `Agent` 可以直接调用 Python 函数。\n- 函数通常应返回 `str`（其他类型的值会被尝试转换为 `str`）。\n- 如果函数返回一个 `Agent`，执行将转移到该 `Agent`。\n- 如果函数定义了 `context_variables` 参数，它将由传递给 `client.run()` 的 `context_variables` 填充。\n\n```python\ndef greet(context_variables, language):\n   user_name = context_variables[\"user_name\"]\n   greeting = \"Hola\" if language.lower() == \"spanish\" else \"Hello\"\n   print(f\"{greeting}, {user_name}!\")\n   return \"完成\"\n\nagent = Agent(\n   functions=[greet]\n)\n\nclient.run(\n   agent=agent,\n   messages=[{\"role\": \"user\", \"content\": \"请使用 greet()。\"}],\n   context_variables={\"user_name\": \"John\"}\n)\n```\n\n```\nHola, John!\n```\n\n- 如果 `Agent` 调用函数时出现错误（函数不存在、参数错误或运行时错误），错误信息会被添加到聊天记录中，以便 `Agent` 能够优雅地恢复。\n- 如果 `Agent` 调用了多个函数，这些函数将按照顺序依次执行。\n\n### 接手与更新上下文变量\n\n`Agent` 可以通过在函数中返回另一个 `Agent` 来进行接手。\n\n```python\nsales_agent = Agent(name=\"销售代理\")\n\ndef transfer_to_sales():\n   return sales_agent\n\nagent = Agent(functions=[transfer_to_sales])\n\nresponse = client.run(agent, [{\"role\":\"user\", \"content\":\"把我转接到销售部门。\"}])\nprint(response.agent.name)\n```\n\n```\n销售代理\n```\n\n它也可以通过返回一个更完整的 `Result` 对象来更新 `context_variables`。这个对象还可以包含 `value` 和 `agent`，这样你就可以让一个函数同时返回值、更新 `Agent` 并更新上下文变量（或者其中任意一部分）。\n\n```python\nsales_agent = Agent(name=\"销售代理\")\n\ndef talk_to_sales():\n   print(\"你好，世界！\")\n   return Result(\n       value=\"完成\",\n       agent=sales_agent，\n       context_variables={\"department\": \"sales\"}\n   )\n\nagent = Agent(functions=[talk_to_sales])\n\nresponse = client.run(\n   agent=agent,\n   messages=[{\"role\": \"user\", \"content\": \"把我转接到销售部门\"}],\n   context_variables={\"user_name\": \"John\"}\n)\nprint(response.agent.name)\nprint(response.context_variables)\n```\n\n```\n销售代理\n{'department': 'sales', 'user_name': 'John'}\n```\n\n> [!注意]\n> 如果一个 `Agent` 调用多个函数来进行接手，最终只会采用最后一个接手函数。\n\n### 函数 Schema\n\nSwarm 会自动将函数转换为 JSON Schema，并将其传递给 Chat Completions 的 `tools`。\n\n- 文档字符串会变成函数的 `description`。\n- 没有默认值的参数会被设置为 `required`。\n- 类型提示会被映射到参数的 `type`（默认为 `string`）。\n- 虽然不显式支持每个参数的描述，但如果直接在文档字符串中添加，效果应该类似。（未来可能会增加对文档字符串参数解析的支持）\n\n```python\ndef greet(name, age: int, location: str = \"New York\"):\n   \"\"\"向用户问好。调用前请确保获取用户的姓名和年龄。\n\n   Args:\n      name: 用户的姓名。\n      age: 用户的年龄。\n      location: 地球上最好的地方。\n   \"\"\"\n   print(f\"你好 {name}, 很高兴你在 {age} 岁时身处 {location}！\")\n```\n\n```javascript\n{\n   \"type\": \"function\",\n   \"function\": {\n      \"name\": \"greet\",\n      \"description\": \"向用户问好。调用前请确保获取用户的姓名和年龄。\\n\\nArgs:\\n   name: 用户的姓名。\\n   age: 用户的年龄。\\n   location: 地球上最好的地方。\",\n      \"parameters\": {\n         \"type\": \"object\",\n         \"properties\": {\n            \"name\": {\"type\": \"string\"},\n            \"age\": {\"type\": \"integer\"},\n            \"location\": {\"type\": \"string\"}\n         },\n         \"required\": [\"name\", \"age\"]\n      }\n   }\n}\n```\n\n## 流式处理\n\n```python\nstream = client.run(agent, messages, stream=True)\nfor chunk in stream:\n   print(chunk)\n```\n\n使用与 [Chat Completions API 流式处理](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fapi-reference\u002Fstreaming) 相同的事件。可参考 `\u002Fswarm\u002Frepl\u002Frepl.py` 中的 `process_and_print_streaming_response` 作为示例。\n\n新增了两种事件类型：\n\n- `{\"delim\":\"start\"}` 和 `{\"delim\":\"end\"}`，用于标记每次 `Agent` 处理单条消息（响应或函数调用）的开始和结束。这有助于识别 `Agent` 之间的切换。\n- `{\"response\": Response}` 会在流结束时返回一个 `Response` 对象，其中包含聚合后的完整响应，以方便使用。\n\n# 评估\n\n评估对于任何项目都至关重要，我们鼓励开发者使用自己的评估套件来测试其 Swarm 的性能。作为参考，我们在 `airline`、`weather_agent` 和 `triage_agent` 快速入门示例中提供了一些评估方法。更多详情请参阅各项目的 README 文件。\n\n# 工具\n\n使用 `run_demo_loop` 来测试你的 Swarm！这将在命令行上运行一个 REPL。支持流式处理。\n\n```python\nfrom swarm.repl import run_demo_loop\n...\nrun_demo_loop(agent, stream=True)\n```\n\n# 核心贡献者\n\n- Ilan Bigio - [ibigio](https:\u002F\u002Fgithub.com\u002Fibigio)\n- James Hills - [jhills20](https:\u002F\u002Fgithub.com\u002Fjhills20)\n- Shyamal Anadkat - [shyamal-anadkat](https:\u002F\u002Fgithub.com\u002Fshyamal-anadkat)\n- Charu Jaiswal - [charuj](https:\u002F\u002Fgithub.com\u002Fcharuj)\n- Colin Jarvis - [colin-openai](https:\u002F\u002Fgithub.com\u002Fcolin-openai)\n- Katia Gil Guzman - [katia-openai](https:\u002F\u002Fgithub.com\u002Fkatia-openai)","# Swarm 快速上手指南\n\n> **重要提示**：Swarm 目前处于实验和教育阶段，已被生产级的 [OpenAI Agents SDK](https:\u002F\u002Fgithub.com\u002Fopenai\u002Fopenai-agents-python) 取代。建议生产环境迁移至 Agents SDK，本指南仅用于学习多智能体编排原理。\n\n## 环境准备\n\n- **操作系统**：Linux \u002F macOS \u002F Windows\n- **Python 版本**：3.10 或更高版本\n- **依赖项**：\n  - `openai` Python 库（安装 Swarm 时会自动安装）\n  - 有效的 OpenAI API Key（需配置环境变量 `OPENAI_API_KEY`）\n\n## 安装步骤\n\n使用 pip 直接从 GitHub 仓库安装：\n\n```shell\npip install git+https:\u002F\u002Fgithub.com\u002Fopenai\u002Fswarm.git\n```\n\n如果网络访问 GitHub 较慢，可尝试使用国内镜像加速（需确保 git 支持 https 克隆）：\n\n```shell\npip install git+https:\u002F\u002Fghp.ci\u002Fhttps:\u002F\u002Fgithub.com\u002Fopenai\u002Fswarm.git\n```\n\n## 基本使用\n\nSwarm 的核心概念是 **Agent（智能体）** 和 **Handoffs（移交）**。以下是最简单的双智能体交互示例：\n\n1. 创建两个 Agent：Agent A 负责接待，Agent B 专门写俳句。\n2. 定义一个函数将对话从 A 移交给 B。\n3. 运行客户端并获取结果。\n\n```python\nfrom swarm import Swarm, Agent\n\n# 初始化 Swarm 客户端\nclient = Swarm()\n\n# 定义移交函数：返回目标 Agent 对象\ndef transfer_to_agent_b():\n    return agent_b\n\n# 定义 Agent A\nagent_a = Agent(\n    name=\"Agent A\",\n    instructions=\"You are a helpful agent.\",\n    functions=[transfer_to_agent_b],\n)\n\n# 定义 Agent B\nagent_b = Agent(\n    name=\"Agent B\",\n    instructions=\"Only speak in Haikus.\",\n)\n\n# 执行对话\nresponse = client.run(\n    agent=agent_a,\n    messages=[{\"role\": \"user\", \"content\": \"I want to talk to agent B.\"}],\n)\n\n# 输出最后一条消息内容\nprint(response.messages[-1][\"content\"])\n```\n\n**预期输出：**\n```\nHope glimmers brightly,\nNew paths converge gracefully,\nWhat can I assist?\n```\n\n### 代码解析\n- `Swarm()`：初始化客户端，底层封装了 OpenAI Chat Completions API。\n- `Agent`：包含指令（instructions）和工具函数（functions）。\n- `client.run()`：执行核心循环，自动处理工具调用、智能体移交和上下文更新，直到没有新的函数调用为止。\n- **无状态设计**：每次调用不保存历史状态，需手动传递 `messages` 和 `context_variables` 以延续对话。","某电商初创团队正在构建一个能同时处理售前咨询、订单修改及售后退款的智能客服系统，需灵活应对用户多变的需求。\n\n### 没有 swarm 时\n- **逻辑耦合严重**：所有业务规则（如退款政策、物流查询）必须塞进同一个提示词中，导致指令过长且容易相互干扰，模型经常混淆任务边界。\n- **维护成本高昂**：每当新增一种业务场景（如“节日特惠”），就需要重新调整整个系统的提示词逻辑，极易引发旧功能的回归错误。\n- **流程控制僵硬**：难以实现自然的上下文流转，用户从“查订单”切换到“要退款”时，系统往往需要重启对话或丢失关键信息，体验割裂。\n- **测试调试困难**：由于缺乏明确的代理分工，定位具体是哪个业务环节出错如同大海捞针，无法单独验证某个特定能力的准确性。\n\n### 使用 swarm 后\n- **职责清晰解耦**：利用 Agent 原语将客服拆分为“导购专家”、“订单管家”和“售后专员”，每个代理只专注特定指令，大幅降低幻觉率。\n- **动态无缝交接**：通过 handoff 机制，当用户提出退款时，“导购专家”可自动将对话权移交给“售后专员”并携带完整上下文，流程丝滑自然。\n- **迭代灵活高效**：新增业务只需定义一个新的 Agent 并注册交接函数，无需触碰现有代码逻辑，实现了真正的模块化扩展。\n- **单元测试便捷**：开发者可针对单个 Agent 的指令和工具进行独立测试，快速定位并修复特定领域的逻辑漏洞，显著提升稳定性。\n\nswarm 通过轻量级的多代理协作与动态交接机制，将复杂的单体客服逻辑转化为可维护、可扩展的模块化网络，极大提升了开发效率与用户体验。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fopenai_swarm_70f3bdf6.png","openai","OpenAI","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fopenai_1960bbf4.png","",null,"https:\u002F\u002Fopenai.com\u002F","https:\u002F\u002Fgithub.com\u002Fopenai",[83],{"name":84,"color":85,"percentage":86},"Python","#3572A5",100,21278,2273,"2026-04-03T16:36:06","MIT",1,"未说明",{"notes":94,"python":95,"dependencies":96},"该工具是一个实验性、教育性的多智能体协调框架，现已由 OpenAI Agents SDK 取代，建议生产环境迁移至新 SDK。工具完全基于 Chat Completions API，客户端运行且无状态存储。","3.10+",[75],[26,13,15],"2026-03-27T02:49:30.150509","2026-04-06T05:37:17.704398",[101,106,111,116,121],{"id":102,"question_zh":103,"answer_zh":104,"source_url":105},13751,"遇到 'parallel_tool_calls' is only allowed when 'tools' are specified 错误怎么办？","这是因为在没有定义工具（tools）时，代码错误地传递了 parallel_tool_calls 参数。解决方法是修改 core.py 中的 get_chat_completion 函数：在调用 API 前检查是否存在 tools。如果有 tools，则包含 parallel_tool_calls 参数；如果没有 tools，则调用 create 方法时不传递该参数，并显式将 tools 设为 None。具体代码逻辑为：if tools: {传递所有参数包括 parallel_tool_calls} else: {传递 tools=None 且不包含 parallel_tool_calls}。","https:\u002F\u002Fgithub.com\u002Fopenai\u002Fswarm\u002Fissues\u002F30",{"id":107,"question_zh":108,"answer_zh":109,"source_url":110},13752,"安装 Swarm 时为什么会降级 openai 包版本？","Swarm 的依赖配置中硬编码了特定的 openai 版本（如 1.33.0）。当你运行 pip install 安装 Swarm 时，pip 会强制卸载当前较高版本的 openai（如 1.51.2）并安装 Swarm 要求的旧版本以满足依赖关系。这可能导致与其他需要新版 openai 库的项目冲突。建议检查 swarm 的 setup.py 或 requirements 文件以确认具体版本限制。","https:\u002F\u002Fgithub.com\u002Fopenai\u002Fswarm\u002Fissues\u002F40",{"id":112,"question_zh":113,"answer_zh":114,"source_url":115},13753,"如何修复 get_chat_completion 函数以兼容无工具调用的场景？","需要在 core.py 中更新 get_chat_completion 函数。在处理 tools 列表后，添加一个条件判断：如果 tools 列表不为空，正常调用 client.chat.completions.create 并传入 parallel_tool_calls；如果 tools 为空，则调用 create 时设置 tools=None，并且不要传入 parallel_tool_calls 参数。这样可以避免向 API 发送无效参数导致的 BadRequestError。","https:\u002F\u002Fgithub.com\u002Fopenai\u002Fswarm\u002Fissues\u002F33",{"id":117,"question_zh":118,"answer_zh":119,"source_url":120},13754,"文档 README 中的图片无法显示（Broken images）如何解决？","该问题是由于图片链接指向了无权访问的内部仓库地址（swarm-core assets）。维护者已确认并修复了此问题，更新了图片链接以确保公开可访问。如果现在仍然看到图片破裂，请尝试清除浏览器缓存或拉取最新的仓库代码，因为修复补丁已经合并。","https:\u002F\u002Fgithub.com\u002Fopenai\u002Fswarm\u002Fissues\u002F25",{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},13755,"Swarm 是否支持代理移交（Agent Handoffs）的治理和安全策略？","原生 Swarm 框架目前主要关注最小化的多代理编排模式，尚未内置复杂的治理原语（如信任评分、资源限制或审计链）。对于需要生产级安全保证的场景，社区提出了如 AgentMesh 等外部扩展方案来实现信任门控移交和策略执行。目前官方建议关注相关的外部提案或等待未来可能的集成，核心库暂时保持精简。","https:\u002F\u002Fgithub.com\u002Fopenai\u002Fswarm\u002Fissues\u002F67",[]]