| 日期 | 语言 | 更新说明 |
|---|---|---|
| 2025/08/25 | Python | 🚀 ACP 现已作为 A2A 的一部分加入 Linux 基金会! 👉 了解更多 |
| 2025/06/03 | Python | 发布实验性 需求智能体。 |
| 2025/05/15 | Python | 新增协议集成:ACP 和 MCP。 |
| 2025/02/19 | Python | 发布 Python 库 Alpha 版本。查看 入门指南。 |
| 2025/02/07 | TypeScript | 引入 后端 模块,以简化 AI 服务(聊天、嵌入)的使用。 |
| 2025/01/28 | TypeScript | 新增对 DeepSeek R1 的支持,查看 竞争分析工作流示例。 |
| 2025/01/09 | TypeScript | 引入 工作流,一种构建多智能体系统的方式。新增对 模型上下文协议 的支持。 |
| 2024/12/09 | TypeScript | 新增对 LLaMa 3.3 的支持。查看 使用 watsonx 的多智能体工作流示例 或探索 其他可用提供商。 |
| 2024/11/21 | TypeScript | 新增一个实验性 Streamlit 智能体。 |
完整的更新日志,请查看我们的 发布页面。
BeeAI 框架是一个用于构建智能、自主智能体及多智能体系统的综合工具包。它提供了创建能够推理、执行操作并协作解决复杂问题的智能体所需的一切。
[!TIP]
使用 beeai-framework-py-starter [Python] 或 beeai-framework-ts-starter [TypeScript] 模板快速开始。
| 特性 | 描述 |
|---|---|
| 🤖 需求智能体 | 通过设置智能体必须遵守的规则,在不同 LLM 间创建可预测、受控的行为。 |
| 🤖 智能体 | 创建能够推理、行动和适应的智能智能体。 |
| 🔌 后端 | 通过统一的接口连接到任何 LLM 提供商。 |
| 🔧 工具 | 使用内置工具(网络搜索、天气、代码执行等)或自定义工具扩展智能体功能。 |
| 🔍 RAG | 利用向量存储和文档处理构建检索增强生成系统。 |
| 📝 模板 | 使用增强的 Mustache 语法构建动态提示。 |
| 🧠 记忆 | 使用内置的记忆策略管理对话历史。 |
| 📊 可观测性 | 通过事件、日志和强大的错误处理监控智能体行为。 |
| 🚀 服务 | 在服务器中托管智能体,支持多种协议,如 A2A 和 MCP。 |
| 💾 缓存 | 通过智能缓存优化性能并降低成本。 |
| 💿 序列化 | 保存和加载智能体状态,实现跨会话的持久化。 |
| 🔄 工作流 | 通过复杂的执行流程编排多智能体系统。 |
安装 Python 库:
pip install beeai-framework
安装 TypeScript 库:
npm install beeai-framework
import asyncio
from beeai_framework.agents.requirement import RequirementAgent
from beeai_framework.agents.requirement.requirements.conditional import ConditionalRequirement
from beeai_framework.backend import ChatModel
from beeai_framework.errors import FrameworkError
from beeai_framework.middleware.trajectory import GlobalTrajectoryMiddleware
from beeai_framework.tools import Tool
from beeai_framework.tools.handoff import HandoffTool
from beeai_framework.tools.search.wikipedia import WikipediaTool
from beeai_framework.tools.think import ThinkTool
from beeai_framework.tools.weather import OpenMeteoTool
async def main() -> None:
knowledge_agent = RequirementAgent(
llm=ChatModel.from_name("ollama:granite3.3:8b"),
tools=[ThinkTool(), WikipediaTool()],
requirements=[ConditionalRequirement(ThinkTool, force_at_step=1)],
role="Knowledge Specialist",
instructions="Provide answers to general questions about the world.",
)
weather_agent = RequirementAgent(
llm=ChatModel.from_name("ollama:granite3.3:8b"),
tools=[OpenMeteoTool()],
role="Weather Specialist",
instructions="Provide weather forecast for a given destination.",
)
main_agent = RequirementAgent(
name="MainAgent",
llm=ChatModel.from_name("ollama:granite3.3:8b"),
tools=[
ThinkTool(),
HandoffTool(
knowledge_agent,
name="KnowledgeLookup",
description="Consult the Knowledge Agent for general questions.",
),
HandoffTool(
weather_agent,
name="WeatherLookup",
description="Consult the Weather Agent for forecasts.",
),
],
requirements=[ConditionalRequirement(ThinkTool, force_at_step=1)],
# Log all tool calls to the console for easier debugging
middlewares=[GlobalTrajectoryMiddleware(included=[Tool])],
)
question = "If I travel to Rome next weekend, what should I expect in terms of weather, and also tell me one famous historical landmark there?"
print(f"User: {question}")
try:
response = await main_agent.run(question, expected_output="Helpful and clear response.")
print("Agent:", response.last_message.text)
except FrameworkError as err:
print("Error:", err.explain())
if __name__ == "__main__":
asyncio.run(main())
来源:python/examples/agents/experimental/requirement/handoff.py
[!Note]
运行此示例前,请确保已安装 ollama 并下载了 granite3.3:8b 模型。
运行项目:
python [project_name].py
探索更多 Python 和 TypeScript 示例。
BeeAI 框架是开源的,我们 ❤️ 贡献。
要帮助构建 BeeAI,请查看:
我们使用 GitHub Issues 管理错误。在提交新问题前,请先检查是否已有相关记录。🙏
本项目及所有参与者均受 行为准则 约束。参与即表示您同意遵守此准则。请阅读 全文 以了解哪些行为是可接受或不可接受的。
这些仓库中的所有内容(包括代码)均由 IBM 根据相关的开源软件许可证提供,IBM 没有义务提供增强、更新或支持。IBM 开发人员将此代码作为开源项目(而非 IBM 产品)制作,IBM 不保证其质量或安全级别,并且将来不会维护此代码。
有关维护者的信息,请参见 MAINTAINERS.md。
特别感谢我们的贡献者帮助我们改进 BeeAI 框架。
由 BeeAI 项目的贡献者开发,此计划是 Linux 基金会 AI & Data 项目 的一部分。其开发遵循开放、协作和社区驱动的实践。