京东零售技术

手把手带你用 OxyGent 实现智能体的构建、部署与进化

本文导读

OxyGent支持开发者像搭积木一样灵活组合智能体系统,并且具备极致可扩展性和全链路决策追溯能力,进而推动“群体智能”的实现。目前,OxyGent已高分登上全球AI领域风向标级的榜单——GAIA (General AI Assistant) Benchmark!

本文将通过多个具体示例,详细介绍如何基于 OxyGent 框架,仅用 20 行代码即可快速启动智能体。手把手带您完成智能体开发的全流程,包括环境安装、模型注册、MCP 工具集成、智能体注册、可视化界面调试、多智能体协作,以及分布式智能体部署等环节,助您高效实现智能体应用。

01
20行代码快速启动

以下代码已上传至Github仓库demo分支:

https://github.com/jd-opensource/OxyGent/tree/demo/oxygent_demo

安装环境

1.python环境(3.10及以上版本)

conda create -n oxy_env python==3.10conda activate oxy_env

2.oxygent环境

pip install oxygent

3.Node.js环境(如果使用MCP工具)
https://nodejs.org/zh-cn 下载安装即可

Hello World

Image

新建 .env 文件设置环境变量:

DEFAULT_LLM_API_KEY = "<大模型的key>"DEFAULT_LLM_BASE_URL = "<大模型的url>"DEFAULT_LLM_MODEL_NAME = "<大模型的name>"

启动
Image

RAG

Image
Image

MoA

Image
02
让智能体自主调用工具

Local MCP 工具

Image
Image

SSE MCP 工具

Image
Image

FunctionHub 工具

Image

用任意工具注册方式(FunctionHub、LocalMCP、SSEMCP),启动后都是以下效果

Image

外部 MCP 工具

Image
Image

自动召回topK个工具

Image
Image

进入节点可视化页面

Image

03
积木式搭建多智能体

多智能体

Image
Image

多层级智能体

Image
Image

结合Workflow

Image

Reflexion机制

Image
Image

Why?

Image

04
智能体快速部署

数据持久化

框架具备完善的数据存储机制,可用于后续的SFT训练或RL训练。

Image

限制任意节点的并发数量

Image
Image

多环境配置部署

Image

分布式

Image
Image
05
更多高阶用法
  • 多模态

  • 按权重过滤执行过程的Memory

  • 检索更多工具

  • 自定义大模型输出解析器

  • 自定义SSE接口

  • 结果后处理或格式化

  • 智能体同时调用多个工具

  • 从中间节点重启任务

  • Plan-and-Solve范式

  • ……

Image
🌱 开源共建、欢迎加入!
诚邀加入OxyGent开源社区!每位开发者的贡献都将推动项目持续进化:
📌 参与方式:
GitHub仓库:https://github.com/jd-opensource/OxyGent
(想过“暂停现实,亲手调试 AI 的思维”吗?那就来 GitHub 给我们点个 🌟 吧!)
加入OxyGent官方微信交流群:
图片
图片