OA0
OA0 是一个探索 AI 的社区
现在注册
已注册用户请  登录
OA0  ›  代码  ›  BeeAI Framework — IBM 推出的企业级 Agent 开发框架

BeeAI Framework — IBM 推出的企业级 Agent 开发框架

 
  article ·  2026-04-01 11:00:25 · 4 次点击  · 0 条评论  

BeeAI 框架

**使用 PythonTypeScript 构建可用于生产环境的多智能体系统。** [![文档](https://img.shields.io/badge/文档-阅读文档-2f7bb6?style=plastic&logo=readthedocs&logoColor=white)](https://framework.beeai.dev/introduction/welcome) [![Python 库](https://img.shields.io/badge/Python-306998?style=plastic&logo=python&logoColor=white)](https://github.com/i-am-bee/beeai-framework/tree/main/python) [![TypeScript 库](https://img.shields.io/badge/TypeScript-2f7bb6?style=plastic&logo=typescript&logoColor=white)](https://github.com/i-am-bee/beeai-framework/tree/main/typescript) [![Apache 2.0](https://img.shields.io/badge/Apache%202.0-许可证-EA7826?style=plastic&logo=apache&logoColor=white)](https://github.com/i-am-bee/beeai-framework?tab=Apache-2.0-1-ov-file#readme) [![加入 Discord](https://img.shields.io/badge/加入%20Discord-7289DA?style=plastic&logo=discord&logoColor=white)](https://discord.com/invite/NradeA6ZNF) [![LF AI & Data](https://img.shields.io/badge/LF%20AI%20%26%20Data-0072C6?style=plastic&logo=linuxfoundation&logoColor=white)](https://lfaidata.foundation/projects/) [![在 Bluesky 关注](https://img.shields.io/badge/在%20Bluesky%20关注-0285FF?style=plastic&logo=bluesky&logoColor=white)](https://bsky.app/profile/beeaiagents.bsky.social)

最新动态

日期 语言 更新说明
2025/08/25 Python 🚀 ACP 现已作为 A2A 的一部分加入 Linux 基金会! 👉 了解更多
2025/06/03 Python 发布实验性 需求智能体
2025/05/15 Python 新增协议集成:ACPMCP
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 框架?

BeeAI 框架是一个用于构建智能、自主智能体及多智能体系统的综合工具包。它提供了创建能够推理、执行操作并协作解决复杂问题的智能体所需的一切。

[!TIP]
使用 beeai-framework-py-starter [Python] 或 beeai-framework-ts-starter [TypeScript] 模板快速开始。

核心特性

特性 描述
🤖 需求智能体 通过设置智能体必须遵守的规则,在不同 LLM 间创建可预测、受控的行为。
🤖 智能体 创建能够推理、行动和适应的智能智能体。
🔌 后端 通过统一的接口连接到任何 LLM 提供商。
🔧 工具 使用内置工具(网络搜索、天气、代码执行等)或自定义工具扩展智能体功能。
🔍 RAG 利用向量存储和文档处理构建检索增强生成系统。
📝 模板 使用增强的 Mustache 语法构建动态提示。
🧠 记忆 使用内置的记忆策略管理对话历史。
📊 可观测性 通过事件日志和强大的错误处理监控智能体行为。
🚀 服务 在服务器中托管智能体,支持多种协议,如 A2AMCP
💾 缓存 通过智能缓存优化性能并降低成本。
💿 序列化 保存和加载智能体状态,实现跨会话的持久化。
🔄 工作流 通过复杂的执行流程编排多智能体系统。

快速开始

安装

安装 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

探索更多 PythonTypeScript 示例。


贡献指南

BeeAI 框架是开源的,我们 ❤️ 贡献。

要帮助构建 BeeAI,请查看:

错误报告

我们使用 GitHub Issues 管理错误。在提交新问题前,请先检查是否已有相关记录。🙏

行为准则

本项目及所有参与者均受 行为准则 约束。参与即表示您同意遵守此准则。请阅读 全文 以了解哪些行为是可接受或不可接受的。

法律声明

这些仓库中的所有内容(包括代码)均由 IBM 根据相关的开源软件许可证提供,IBM 没有义务提供增强、更新或支持。IBM 开发人员将此代码作为开源项目(而非 IBM 产品)制作,IBM 不保证其质量或安全级别,并且将来不会维护此代码。

维护者

有关维护者的信息,请参见 MAINTAINERS.md

贡献者

特别感谢我们的贡献者帮助我们改进 BeeAI 框架。


贡献者列表


由 BeeAI 项目的贡献者开发,此计划是 Linux 基金会 AI & Data 项目 的一部分。其开发遵循开放、协作和社区驱动的实践。

4 次点击  ∙  0 人收藏  
登录后收藏  
0 条回复
关于 ·  帮助 ·  PING ·  隐私 ·  条款   
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
耗时 54 ms
Developed with Cursor