基于 BeeAI 框架搭建支持 A2A 协议的聊天代理
该示例说明如何用 BeeAI 框架构建一个通过 A2A 协议通信的聊天代理,代理可调用网页搜索与天气工具,运行依赖 Python 3.10 以上环境与本地 Ollama 服务,并给出源码运行和 Docker 容器化两种启动方式。
# BeeAI 框架 A2A 聊天代理 此样本演示了如何使用 [BeeAI 框架](https://docs.beeai.dev/introduction/welcome) 与 Agent2Agent (A2A) 通信协议。 此代理服务器可访问网络搜索和天气工具 。 ## 先决条件 - Python 3.10 或更高音量 - [奥拉玛](https://ollama.com/) 安装和运行 ## 运行样本 1. 导航到样本目录 : ```bash cd samples/python/agents/beeai-chat ``` 2. 创建 venv 并安装要求 ```bash python -m venv venv source venv/bin/activate pip install . ``` 3. 把模型拉到奥拉马: ```bash ollama pull granite3.3:8b ``` 4. 运行 A2A 代理 : ```bash python __main__.py ``` 5. 运行 [BeeAI 聊天客户端](<https://github.com/a2aproject/a2a-samples/blob/HEAD/samples/python/hosts/beeai-chat/README.md>) ## 使用 Docker 运行 ```sh docker build -t beeai_chat_agent . docker run -p 9999:9999 -e OLLAMA_API_BASE="http://host.docker.internal:11434" beeai_chat_agent ```
查看原始来源