From 8684e248128bed42abb050d394806a70b78dde2b Mon Sep 17 00:00:00 2001 From: yuluo-yx Date: Wed, 30 Sep 2026 17:31:28 +0800 Subject: [PATCH] docs: rebrand website for ARGI --- README-zh.md | 6 +- README.md | 6 +- docs/community/policies.md | 22 +- docs/frameworks/agent-framework/a2a.md | 30 +-- .../agent-framework/agents-intro.md | 18 +- .../agent-framework/builtin-tools.md | 16 +- docs/frameworks/agent-framework/hitl.md | 66 ++--- .../agent-framework/hooks-interceptors.md | 170 ++++++------- docs/frameworks/agent-framework/memory.md | 118 ++++----- docs/frameworks/agent-framework/messages.md | 16 +- .../frameworks/agent-framework/multi-agent.md | 46 ++-- .../frameworks/agent-framework/quick-start.md | 8 +- docs/frameworks/agent-framework/rag.md | 96 ++++---- .../agent-framework/react-agent-theory.md | 2 +- .../agent-framework/runtime-config.md | 4 +- docs/frameworks/agent-framework/skills.md | 34 +-- .../agent-framework/structured-io.md | 4 +- .../agent-framework/tools-as-agent.md | 30 +-- docs/frameworks/agent-framework/tools.md | 62 ++--- docs/frameworks/agent-framework/workflow.md | 146 +++++------ docs/frameworks/extensions/chat-memory.md | 228 +++++++++--------- docs/frameworks/extensions/mcp-gateway.md | 106 ++++---- docs/frameworks/extensions/mcp-router.md | 74 +++--- docs/frameworks/extensions/mcp.md | 94 ++++---- docs/frameworks/extensions/nacos-prompt.md | 29 ++- docs/frameworks/extensions/observation.md | 62 +++-- docs/frameworks/extensions/overview.md | 96 ++++---- docs/frameworks/extensions/rag.md | 46 ++-- docs/frameworks/extensions/vector-stores.md | 147 ++++++----- docs/frameworks/graph-core/concepts/edges.md | 10 +- docs/frameworks/graph-core/concepts/graph.md | 6 +- docs/frameworks/graph-core/concepts/nodes.md | 12 +- .../graph-core/concepts/serializer.md | 8 +- docs/frameworks/graph-core/concepts/state.md | 22 +- .../frameworks/graph-core/concepts/threads.md | 2 +- .../graph-core/context-management.md | 132 +++++----- .../graph-core/examples/cancellation.md | 14 +- docs/frameworks/graph-core/examples/hitl.md | 110 ++++----- .../graph-core/examples/parallel-nodes.md | 48 ++-- .../graph-core/examples/persistence.md | 46 ++-- .../graph-core/examples/plantuml.md | 26 +- .../examples/spring-ai-integration.md | 12 +- .../examples/subgraph-as-compiled-graph.md | 42 ++-- .../graph-core/examples/subgraph-as-node.md | 38 +-- .../graph-core/examples/subgraphs.md | 124 +++++----- docs/frameworks/graph-core/observation.md | 12 +- docs/frameworks/graph-core/persistence.md | 68 +++--- docs/frameworks/graph-core/quick-start.md | 26 +- docs/frameworks/graph-core/runtime-config.md | 16 +- docs/frameworks/graph-core/scheduling.md | 10 +- docs/frameworks/graph-core/store.md | 22 +- docs/frameworks/graph-core/streaming.md | 38 +-- .../graph-core/workflow-orchestration.md | 78 +++--- docs/frameworks/studio/quick-start.md | 4 +- docs/overview.md | 12 +- docs/quick-start.md | 8 +- docs/versions.md | 75 +++--- docusaurus.config.ts | 14 +- i18n/en/code.json | 14 +- .../current/community/policies.md | 20 +- .../frameworks/graph-core/quick-start.md | 8 +- .../current/intro.md | 4 +- i18n/en/docusaurus-theme-classic/footer.json | 8 +- i18n/zh-Hans/code.json | 14 +- .../docusaurus-theme-classic/footer.json | 2 +- package-lock.json | 4 +- package.json | 6 +- project.config.ts | 22 +- src/components/AnnouncementBar/index.tsx | 2 +- src/components/EcosystemShowcase/index.tsx | 18 +- src/css/custom.css | 2 +- src/pages/index.module.css | 26 ++ src/pages/index.tsx | 16 +- src/theme/TOCItems/index.tsx | 2 +- static/img/logo-fullname.svg | 4 +- static/img/logo.svg | 4 +- ...ntic-ai-base-rps.png => argi-base-rps.png} | Bin ...i-extreme-rps.png => argi-extreme-rps.png} | Bin 78 files changed, 1498 insertions(+), 1495 deletions(-) rename static/img/user/ai/practices/dify/{agentic-ai-base-rps.png => argi-base-rps.png} (100%) rename static/img/user/ai/practices/dify/{agentic-ai-extreme-rps.png => argi-extreme-rps.png} (100%) diff --git a/README-zh.md b/README-zh.md index 8d03dd00..cb79bc28 100644 --- a/README-zh.md +++ b/README-zh.md @@ -1,6 +1,6 @@ -# Agentic AI Documentation Website +# ARGI Documentation Website -Agentic AI 项目的官方文档网站,基于 Docusaurus 构建。 +ARGI(Agent Runtime and Graph Intelligence,读作 “AR-jee”)项目的官方文档网站,基于 Docusaurus 构建。 ## 快速开始 @@ -17,7 +17,7 @@ Agentic AI 项目的官方文档网站,基于 Docusaurus 构建。 ## GitHub Pages 部署 -发布分支更新后,GitHub Actions 会在 lint 和构建通过后自动发布 `build` 目录。首次部署前,需要在仓库的 `Settings > Pages` 中将发布源设置为 `GitHub Actions`。站点地址为 。 +发布分支更新后,GitHub Actions 会在 lint 和构建通过后自动发布 `build` 目录。首次部署前,需要在仓库的 `Settings > Pages` 中将发布源设置为 `GitHub Actions`。站点地址为 。 ## 提交之前 diff --git a/README.md b/README.md index 8a5865da..ce55ccbc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Agentic AI Documentation Website +# ARGI Documentation Website -The official documentation website for the Agentic AI project, built with Docusaurus. +The official documentation website for ARGI (Agent Runtime and Graph Intelligence, pronounced "AR-jee"), built with Docusaurus. ## Quick Start @@ -17,7 +17,7 @@ English: `make preview-en` ## GitHub Pages Deployment -After the publishing branch is updated, GitHub Actions publishes the `build` directory once lint and build checks pass. Before the first deployment, set the publishing source to `GitHub Actions` under `Settings > Pages`. The site is available at . +After the publishing branch is updated, GitHub Actions publishes the `build` directory once lint and build checks pass. Before the first deployment, set the publishing source to `GitHub Actions` under `Settings > Pages`. The site is available at . ## Before Committing diff --git a/docs/community/policies.md b/docs/community/policies.md index 7abe8a61..7cd2028f 100644 --- a/docs/community/policies.md +++ b/docs/community/policies.md @@ -1,19 +1,19 @@ --- title: 社区协议 -description: Agentic AI community contribution, security, and conduct policies. -keywords: [Agentic AI, community, contribution, security, code of conduct] +description: ARGI community contribution, security, and conduct policies. +keywords: [ARGI, community, contribution, security, code of conduct] --- # 社区协议 -Agentic AI fork 自 Spring AI Alibaba。refactor 分支已经将核心 Maven 坐标迁移到 `io.github.agentic-ai`,核心模块名迁移到 `agentic-ai-*`,Java 包名迁移到 `io.github.agentic.spring.ai.*`。贡献代码时请以当前分支中的 POM、源码包名和模块目录为准。 +ARGI fork 自 Spring AI Alibaba。refactor 分支已经将核心 Maven 坐标迁移到 `io.github.agentic-ai`,核心模块名迁移到 `argi-*`,Java 包名迁移到 `io.github.agentic.ai.*`。贡献代码时请以当前分支中的 POM、源码包名和模块目录为准。 ## 贡献协议 -欢迎通过 Issue、Discussion 和 Pull Request 参与 Agentic AI。提交贡献前,请先阅读仓库中的贡献指南: +欢迎通过 Issue、Discussion 和 Pull Request 参与 ARGI。提交贡献前,请先阅读仓库中的贡献指南: -- [CONTRIBUTING.md](https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/CONTRIBUTING.md) -- [CONTRIBUTING-zh.md](https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/CONTRIBUTING-zh.md) +- [CONTRIBUTING.md](https://github.com/agentic-ai-java/argi/blob/main/CONTRIBUTING.md) +- [CONTRIBUTING-zh.md](https://github.com/agentic-ai-java/argi/blob/main/CONTRIBUTING-zh.md) 贡献代码前请在本地完成必要检查,包括构建、测试、格式化、Checkstyle、License 与拼写检查。PR 标题和提交信息使用 `type(scope): description` 格式,例如 `docs(site): update community policies`。 @@ -25,14 +25,14 @@ Agentic AI fork 自 Spring AI Alibaba。refactor 分支已经将核心 Maven 坐 完整安全策略请参考: -- [SECURITY.md](https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/SECURITY.md) -- [SECURITY-zh.md](https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/SECURITY-zh.md) +- [SECURITY.md](https://github.com/agentic-ai-java/argi/blob/main/SECURITY.md) +- [SECURITY-zh.md](https://github.com/agentic-ai-java/argi/blob/main/SECURITY-zh.md) ## 行为准则 -Agentic AI 社区希望保持开放、友善、尊重和聚焦问题本身的协作环境。请使用包容性语言,尊重不同经验与观点,接受建设性反馈,并保护社区成员和用户的安全与隐私。 +ARGI 社区希望保持开放、友善、尊重和聚焦问题本身的协作环境。请使用包容性语言,尊重不同经验与观点,接受建设性反馈,并保护社区成员和用户的安全与隐私。 完整行为准则请参考: -- [CODE_OF_CONDUCT.md](https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/CODE_OF_CONDUCT.md) -- [CODE_OF_CONDUCT-zh.md](https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/CODE_OF_CONDUCT-zh.md) +- [CODE_OF_CONDUCT.md](https://github.com/agentic-ai-java/argi/blob/main/CODE_OF_CONDUCT.md) +- [CODE_OF_CONDUCT-zh.md](https://github.com/agentic-ai-java/argi/blob/main/CODE_OF_CONDUCT-zh.md) diff --git a/docs/frameworks/agent-framework/a2a.md b/docs/frameworks/agent-framework/a2a.md index b62e8be5..96294d53 100644 --- a/docs/frameworks/agent-framework/a2a.md +++ b/docs/frameworks/agent-framework/a2a.md @@ -1,34 +1,34 @@ --- title: A2A Agent sidebar_label: A2A Agent -description: 了解如何使用 A2A 协议把远程 Agent 接入 Agentic AI,包括 AgentCard 获取、远程调用和作为图节点编排。 +description: 了解如何使用 A2A 协议把远程 Agent 接入 ARGI,包括 AgentCard 获取、远程调用和作为图节点编排。 keywords: [A2A, A2A Agent, Agent-to-Agent, 分布式Agent, 远程Agent, AgentCard, 远程调用] --- # A2A Agent -Agent2Agent(A2A)协议用于描述和调用远程智能体。Agentic AI 在 `agentic-ai-agent-framework` 中提供了 A2A 客户端侧封装,可以把远程 Agent 包装成 `A2aRemoteAgent`,再像本地 Agent 一样调用或放入 Graph 编排。 +Agent2Agent(A2A)协议用于描述和调用远程智能体。ARGI 在 `argi-agent-framework` 中提供了 A2A 客户端侧封装,可以把远程 Agent 包装成 `A2aRemoteAgent`,再像本地 Agent 一样调用或放入 Graph 编排。 当前 refactor 分支可确认的核心类型包括: -- `A2aRemoteAgent`:把远程 A2A Agent 包装为 Agentic AI Agent。 +- `A2aRemoteAgent`:把远程 A2A Agent 包装为 ARGI Agent。 - `AgentCardProvider`:抽象 AgentCard 的获取方式。 - `RemoteAgentCardProvider`:从远程 URL 获取 AgentCard。 - `AgentCardWrapper`:封装 A2A SDK 的 `AgentCard`,暴露名称、描述、能力、技能等元数据。 -> 说明:当前 refactor 分支没有发现 `agentic-ai-starter-a2a-nacos` 或同等 A2A Nacos starter。Nacos MCP starter 存在,但它面向 MCP 注册、发现、网关和路由,不等同于 A2A AgentCard 的自动注册与发现。 +> 说明:当前 refactor 分支没有发现 `argi-starter-a2a-nacos` 或同等 A2A Nacos starter。Nacos MCP starter 存在,但它面向 MCP 注册、发现、网关和路由,不等同于 A2A AgentCard 的自动注册与发现。 ## 添加依赖 -`A2aRemoteAgent` 位于 Agent Framework 模块中。通过 Agentic AI BOM 管理版本后,引入 `agentic-ai-agent-framework` 即可使用。 +`A2aRemoteAgent` 位于 Agent Framework 模块中。通过 ARGI BOM 管理版本后,引入 `argi-agent-framework` 即可使用。 ```xml io.github.agentic-ai - agentic-ai-bom - ${agentic-ai.version} + argi-bom + ${argi.version} pom import @@ -38,7 +38,7 @@ Agent2Agent(A2A)协议用于描述和调用远程智能体。Agentic AI 在 io.github.agentic-ai - agentic-ai-agent-framework + argi-agent-framework ``` @@ -51,10 +51,10 @@ Agent2Agent(A2A)协议用于描述和调用远程智能体。Agentic AI 在 language="java" title="通过远程 AgentCard 调用 A2A Agent" > -{`import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.agent.a2a.A2aRemoteAgent; -import io.github.agentic.spring.ai.graph.agent.a2a.AgentCardProvider; -import io.github.agentic.spring.ai.graph.agent.a2a.RemoteAgentCardProvider; +{`import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.agent.a2a.A2aRemoteAgent; +import io.github.agentic.ai.graph.agent.a2a.AgentCardProvider; +import io.github.agentic.ai.graph.agent.a2a.RemoteAgentCardProvider; import java.util.Optional; @@ -104,9 +104,9 @@ public class RemoteA2aAgentExample { language="java" title="把 A2A Remote Agent 加入 StateGraph" > -{`import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.agent.a2a.A2aRemoteAgent; -import io.github.agentic.spring.ai.graph.agent.a2a.RemoteAgentCardProvider; +{`import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.agent.a2a.A2aRemoteAgent; +import io.github.agentic.ai.graph.agent.a2a.RemoteAgentCardProvider; A2aRemoteAgent remoteAgent = A2aRemoteAgent.builder() .name("research_agent") diff --git a/docs/frameworks/agent-framework/agents-intro.md b/docs/frameworks/agent-framework/agents-intro.md index 63221673..472a4773 100644 --- a/docs/frameworks/agent-framework/agents-intro.md +++ b/docs/frameworks/agent-framework/agents-intro.md @@ -1,7 +1,7 @@ --- title: Agents 介绍 sidebar_label: Agents 介绍 -description: 了解 Agentic AI 中的 ReactAgent、ReAct 循环、工具调用、Hook 与 Interceptor。 +description: 了解 ARGI 中的 ReactAgent、ReAct 循环、工具调用、Hook 与 Interceptor。 keywords: [Agents, ReactAgent, ReAct, ToolCallback, Hook, Interceptor, Agent Framework] --- @@ -9,7 +9,7 @@ keywords: [Agents, ReactAgent, ReAct, ToolCallback, Hook, Interceptor, Agent Fra Agent 将语言模型、工具和运行时控制逻辑组合在一起,用于处理需要多步推理、外部工具调用和状态管理的任务。 -Agentic AI Agent Framework 的核心实现是 `ReactAgent`。它构建在 Graph Core 之上:底层由 `StateGraph` 表示执行拓扑,模型节点负责推理和生成工具调用,工具节点执行工具并把观察结果写回状态,然后由图边决定继续循环还是结束。 +ARGI Agent Framework 的核心实现是 `ReactAgent`。它构建在 Graph Core 之上:底层由 `StateGraph` 表示执行拓扑,模型节点负责推理和生成工具调用,工具节点执行工具并把观察结果写回状态,然后由图边决定继续循环还是结束。 ## ReAct 循环 @@ -26,7 +26,7 @@ ReAct 表示 Reasoning + Acting。`ReactAgent` 的典型执行过程包括: `ReactAgent` 不绑定特定模型厂商。应用只需要提供 Spring AI 的 `ChatModel`,并按需配置工具。 ```java -import io.github.agentic.spring.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.chat.messages.AssistantMessage; import org.springframework.ai.chat.model.ChatModel; import org.springframework.ai.tool.annotation.Tool; @@ -102,9 +102,9 @@ ReactAgent agent = ReactAgent.builder() `ReactAgent` 基于 Graph Core 执行。调用 `saver(...)` 可以为 Agent 配置检查点存储,用于跨会话保存状态或支持恢复。 ```java -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; ReactAgent agent = ReactAgent.builder() .name("stateful_agent") @@ -127,9 +127,9 @@ Hook 用于在 Agent 或模型调用阶段注入运行时逻辑。Interceptor refactor 分支提供了内置的 `ModelCallLimitHook` 与 `ToolErrorInterceptor`: ```java -import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.hook.modelcalllimit.ModelCallLimitHook; -import io.github.agentic.spring.ai.graph.agent.interceptor.toolerror.ToolErrorInterceptor; +import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.hook.modelcalllimit.ModelCallLimitHook; +import io.github.agentic.ai.graph.agent.interceptor.toolerror.ToolErrorInterceptor; ReactAgent agent = ReactAgent.builder() .name("guarded_agent") diff --git a/docs/frameworks/agent-framework/builtin-tools.md b/docs/frameworks/agent-framework/builtin-tools.md index dd301134..e19516ce 100644 --- a/docs/frameworks/agent-framework/builtin-tools.md +++ b/docs/frameworks/agent-framework/builtin-tools.md @@ -32,10 +32,10 @@ Agent Framework 可以直接使用 Spring AI 的 `ToolCallback`、`@Tool` 方法 | `WriteTodosTool` | 写入待办列表,支持事件处理器。 | ```java -import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.tools.GlobSearchTool; -import io.github.agentic.spring.ai.graph.agent.tools.GrepSearchTool; -import io.github.agentic.spring.ai.graph.agent.tools.ShellTool; +import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.tools.GlobSearchTool; +import io.github.agentic.ai.graph.agent.tools.GrepSearchTool; +import io.github.agentic.ai.graph.agent.tools.ShellTool; ToolCallback shell = ShellTool.builder("/workspace") .withCommandTimeout(30_000) @@ -60,7 +60,7 @@ ReactAgent agent = ReactAgent.builder() ## 文件系统工具 -`io.github.agentic.spring.ai.graph.agent.extension.tools.filesystem` 包提供文件读写、编辑、列表、glob 和 grep 工具。 +`io.github.agentic.ai.graph.agent.extension.tools.filesystem` 包提供文件读写、编辑、列表、glob 和 grep 工具。 | 类 | 说明 | | --- | --- | @@ -74,7 +74,7 @@ ReactAgent agent = ReactAgent.builder() | `FilesystemBackend`、`LocalFilesystemBackend` | 文件系统后端抽象和本地实现。 | ```java -import io.github.agentic.spring.ai.graph.agent.extension.tools.filesystem.FileSystemTools; +import io.github.agentic.ai.graph.agent.extension.tools.filesystem.FileSystemTools; FileSystemTools fileSystemTools = FileSystemTools.builder() .rootDir("/workspace") @@ -100,7 +100,7 @@ ReactAgent agent = ReactAgent.builder() | `ToolStateCollector` | 汇总多个工具的状态更新,用于并行工具执行后合并状态。 | ```java -import io.github.agentic.spring.ai.graph.agent.tools.ToolContextHelper; +import io.github.agentic.ai.graph.agent.tools.ToolContextHelper; import org.springframework.ai.chat.model.ToolContext; Optional config = ToolContextHelper.getConfig(toolContext); @@ -156,7 +156,7 @@ ReactAgent agent = ReactAgent.builder() | `AgentSpecReactAgentFactory` | 基于 `AgentSpec` 创建 `ReactAgent`。 | ```java -import io.github.agentic.spring.ai.graph.agent.tools.task.TaskToolsBuilder; +import io.github.agentic.ai.graph.agent.tools.task.TaskToolsBuilder; ReactAgent worker = ReactAgent.builder() .name("worker") diff --git a/docs/frameworks/agent-framework/hitl.md b/docs/frameworks/agent-framework/hitl.md index f6769486..c80a4e06 100644 --- a/docs/frameworks/agent-framework/hitl.md +++ b/docs/frameworks/agent-framework/hitl.md @@ -19,7 +19,7 @@ keywords: 人工介入(HITL)Hook 允许你为 Agent 工具调用添加人工监督。当模型提出需要审查的操作时——例如写入文件或执行 SQL——Hook 可以暂停执行并等待人工决策。 -它通过检查每个工具调用并与可配置的策略进行比对来实现。如果需要人工干预,Hook 会发出中断(interrupt)来暂停执行。图的状态会通过 Agentic AI 的检查点机制保存,因此执行可以安全暂停并在之后恢复。 +它通过检查每个工具调用并与可配置的策略进行比对来实现。如果需要人工干预,Hook 会发出中断(interrupt)来暂停执行。图的状态会通过 ARGI 的检查点机制保存,因此执行可以安全暂停并在之后恢复。 人工决策决定接下来发生什么:操作可以被原样批准(`approve`)、修改后运行(`edit`)或拒绝并提供反馈(`reject`)。 @@ -49,10 +49,10 @@ Hook 定义了三种人工响应中断的内置方式: language="java" title="HumanInTheLoopHook 配置示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.hook.hip.HumanInTheLoopHook; -import io.github.agentic.spring.ai.graph.agent.hook.hip.ToolConfig; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.hook.hip.HumanInTheLoopHook; +import io.github.agentic.ai.graph.agent.hook.hip.ToolConfig; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; // 配置检查点保存器(人工介入需要检查点来处理中断) MemorySaver memorySaver = new MemorySaver(); @@ -92,9 +92,9 @@ ReactAgent agent = ReactAgent.builder() language="java" title="响应中断示例" > -{`import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.NodeOutput; -import io.github.agentic.spring.ai.graph.action.InterruptionMetadata; +{`import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.NodeOutput; +import io.github.agentic.ai.graph.action.InterruptionMetadata; // 人工介入利用检查点机制。 // 你必须提供线程ID以将执行与会话线程关联, @@ -306,13 +306,13 @@ Hook 定义了一个在模型生成响应后但在执行任何工具调用之前 language="java" title="HumanInTheLoop 完整示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.hook.hip.HumanInTheLoopHook; -import io.github.agentic.spring.ai.graph.agent.hook.hip.ToolConfig; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.NodeOutput; -import io.github.agentic.spring.ai.graph.action.InterruptionMetadata; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.hook.hip.HumanInTheLoopHook; +import io.github.agentic.ai.graph.agent.hook.hip.ToolConfig; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.NodeOutput; +import io.github.agentic.ai.graph.action.InterruptionMetadata; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; public class HumanInTheLoopExample { @@ -413,22 +413,22 @@ public class HumanInTheLoopExample { language="java" title="Workflow 中嵌套 Agent 的人工中断示例" > -{`import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.NodeOutput; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.action.InterruptionMetadata; -import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.hook.hip.HumanInTheLoopHook; -import io.github.agentic.spring.ai.graph.agent.hook.hip.ToolConfig; -import io.github.agentic.spring.ai.graph.checkpoint.config.SaverConfig; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.NodeOutput; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.action.InterruptionMetadata; +import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.hook.hip.HumanInTheLoopHook; +import io.github.agentic.ai.graph.agent.hook.hip.ToolConfig; +import io.github.agentic.ai.graph.checkpoint.config.SaverConfig; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import org.springframework.ai.chat.messages.Message; import org.springframework.ai.tool.ToolCallback; @@ -439,8 +439,8 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import static io.github.agentic.spring.ai.graph.action.AsyncEdgeAction.edge_async; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.action.AsyncEdgeAction.edge_async; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; // 1. 创建工具回调 ToolCallback searchTool = FunctionToolCallback diff --git a/docs/frameworks/agent-framework/hooks-interceptors.md b/docs/frameworks/agent-framework/hooks-interceptors.md index c5da5939..9b9586ad 100644 --- a/docs/frameworks/agent-framework/hooks-interceptors.md +++ b/docs/frameworks/agent-framework/hooks-interceptors.md @@ -30,9 +30,9 @@ Hooks 和 Interceptors 在这些步骤的前后暴露了钩子点,允许你: language="java" title="添加 Hooks 和 Interceptors 到 ReactAgent" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.hook.*; -import io.github.agentic.spring.ai.graph.agent.interceptor.*; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.hook.*; +import io.github.agentic.ai.graph.agent.interceptor.*; ReactAgent agent = ReactAgent.builder() .name("my_agent") @@ -55,7 +55,7 @@ ReactAgent agent = ReactAgent.builder() ## 内置实现 -Agentic AI 为常见用例提供了预构建的 Hooks 和 Interceptors 实现: +ARGI 为常见用例提供了预构建的 Hooks 和 Interceptors 实现: ### 消息压缩(Summarization) @@ -70,7 +70,7 @@ Agentic AI 为常见用例提供了预构建的 Hooks 和 Interceptors 实现: language="java" title="SummarizationHook 消息压缩示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.summarization.SummarizationHook; +{`import io.github.agentic.ai.graph.agent.hook.summarization.SummarizationHook; // 创建消息压缩 Hook SummarizationHook summarizationHook = SummarizationHook.builder() @@ -105,8 +105,8 @@ ReactAgent agent = ReactAgent.builder() language="java" title="HumanInTheLoopHook 人机协同示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.hip.HumanInTheLoopHook; -import io.github.agentic.spring.ai.graph.agent.hook.hip.ToolConfig; +{`import io.github.agentic.ai.graph.agent.hook.hip.HumanInTheLoopHook; +import io.github.agentic.ai.graph.agent.hook.hip.ToolConfig; // 创建 Human-in-the-Loop Hook HumanInTheLoopHook humanReviewHook = HumanInTheLoopHook.builder() @@ -159,9 +159,9 @@ ReactAgent agent = ReactAgent.builder() language="java" title="PIIDetectionHook PII 检测示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.pii.PIIDetectionHook; -import io.github.agentic.spring.ai.graph.agent.hook.pii.PIIType; -import io.github.agentic.spring.ai.graph.agent.hook.pii.RedactionStrategy; +{`import io.github.agentic.ai.graph.agent.hook.pii.PIIDetectionHook; +import io.github.agentic.ai.graph.agent.hook.pii.PIIType; +import io.github.agentic.ai.graph.agent.hook.pii.RedactionStrategy; PIIDetectionHook pii = PIIDetectionHook.builder() .piiType(PIIType.EMAIL) @@ -190,7 +190,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="ToolRetryInterceptor 工具重试示例" > -{`import io.github.agentic.spring.ai.graph.agent.interceptor.toolretry.ToolRetryInterceptor; +{`import io.github.agentic.ai.graph.agent.interceptor.toolretry.ToolRetryInterceptor; // 使用 ReactAgent agent = ReactAgent.builder() @@ -212,7 +212,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="ToolErrorInterceptor 工具异常处理示例" > -{`import io.github.agentic.spring.ai.graph.agent.interceptor.toolerror.ToolErrorInterceptor; +{`import io.github.agentic.ai.graph.agent.interceptor.toolerror.ToolErrorInterceptor; ReactAgent agent = ReactAgent.builder() .name("tool_error_agent") @@ -230,7 +230,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="ModelRetryInterceptor 模型重试示例" > -{`import io.github.agentic.spring.ai.graph.agent.interceptor.modelretry.ModelRetryInterceptor; +{`import io.github.agentic.ai.graph.agent.interceptor.modelretry.ModelRetryInterceptor; ReactAgent agent = ReactAgent.builder() .name("model_retry_agent") @@ -252,7 +252,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="ModelFallbackInterceptor 模型回退示例" > -{`import io.github.agentic.spring.ai.graph.agent.interceptor.modelfallback.ModelFallbackInterceptor; +{`import io.github.agentic.ai.graph.agent.interceptor.modelfallback.ModelFallbackInterceptor; ReactAgent agent = ReactAgent.builder() .name("fallback_agent") @@ -271,7 +271,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="ToolCallLimitHook 工具调用限制示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.toolcalllimit.ToolCallLimitHook; +{`import io.github.agentic.ai.graph.agent.hook.toolcalllimit.ToolCallLimitHook; ReactAgent agent = ReactAgent.builder() .name("limited_tool_agent") @@ -291,7 +291,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="ReturnDirectModelHook 示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.returndirect.ReturnDirectModelHook; +{`import io.github.agentic.ai.graph.agent.hook.returndirect.ReturnDirectModelHook; ReactAgent agent = ReactAgent.builder() .name("return_direct_agent") @@ -326,7 +326,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="TodoListInterceptor 规划示例" > -{`import io.github.agentic.spring.ai.graph.agent.interceptor.todolist.TodoListInterceptor; +{`import io.github.agentic.ai.graph.agent.interceptor.todolist.TodoListInterceptor; // 使用 ReactAgent agent = ReactAgent.builder() @@ -350,7 +350,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="ToolSelectionInterceptor LLM 工具选择器示例" > -{`import io.github.agentic.spring.ai.graph.agent.interceptor.toolselection.ToolSelectionInterceptor; +{`import io.github.agentic.ai.graph.agent.interceptor.toolselection.ToolSelectionInterceptor; // 使用 ReactAgent agent = ReactAgent.builder() @@ -374,7 +374,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="ToolEmulatorInterceptor LLM 工具模拟器示例" > -{`import io.github.agentic.spring.ai.graph.agent.interceptor.toolemulator.ToolEmulatorInterceptor; +{`import io.github.agentic.ai.graph.agent.interceptor.toolemulator.ToolEmulatorInterceptor; // 使用 ReactAgent agent = ReactAgent.builder() @@ -398,7 +398,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="ContextEditingInterceptor 上下文编辑示例" > -{`import io.github.agentic.spring.ai.graph.agent.interceptor.contextediting.ContextEditingInterceptor; +{`import io.github.agentic.ai.graph.agent.interceptor.contextediting.ContextEditingInterceptor; // 使用 ReactAgent agent = ReactAgent.builder() @@ -447,12 +447,12 @@ Agent Framework 的 `extension/interceptor` 包中还提供了若干面向复杂 language="java" title="MessageTrimmingHook 消息修剪示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.messages.MessagesModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.messages.AgentCommand; -import io.github.agentic.spring.ai.graph.agent.hook.messages.UpdatePolicy; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.hook.messages.MessagesModelHook; +import io.github.agentic.ai.graph.agent.hook.messages.AgentCommand; +import io.github.agentic.ai.graph.agent.hook.messages.UpdatePolicy; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.chat.messages.Message; @HookPositions({HookPosition.BEFORE_MODEL}) @@ -492,12 +492,12 @@ public class MessageTrimmingHook extends MessagesModelHook { language="java" title="使用不同策略的 MessagesModelHook 示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.messages.MessagesModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.messages.AgentCommand; -import io.github.agentic.spring.ai.graph.agent.hook.messages.UpdatePolicy; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.hook.messages.MessagesModelHook; +import io.github.agentic.ai.graph.agent.hook.messages.AgentCommand; +import io.github.agentic.ai.graph.agent.hook.messages.UpdatePolicy; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.chat.messages.Message; import org.springframework.ai.chat.messages.SystemMessage; import org.springframework.ai.chat.messages.UserMessage; @@ -537,12 +537,12 @@ public class ContextEnhancementHook extends MessagesModelHook { language="java" title="MessagesModelHook 跳转控制示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.JumpTo; -import io.github.agentic.spring.ai.graph.agent.hook.messages.MessagesModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.messages.AgentCommand; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.hook.JumpTo; +import io.github.agentic.ai.graph.agent.hook.messages.MessagesModelHook; +import io.github.agentic.ai.graph.agent.hook.messages.AgentCommand; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.chat.messages.Message; import java.util.List; @@ -583,9 +583,9 @@ public class EarlyExitHook extends MessagesModelHook { language="java" title="CustomModelHook 自定义 ModelHook 示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.ModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; +{`import io.github.agentic.ai.graph.agent.hook.ModelHook; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; import java.util.concurrent.CompletableFuture; @HookPositions({HookPosition.BEFORE_MODEL, HookPosition.AFTER_MODEL}) @@ -625,12 +625,12 @@ public class CustomModelHook extends ModelHook { language="java" title="使用 RemoveByHash 删除消息示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.ModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.state.RemoveByHash; +{`import io.github.agentic.ai.graph.agent.hook.ModelHook; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.state.RemoveByHash; import org.springframework.ai.chat.messages.Message; import java.util.ArrayList; import java.util.List; @@ -708,12 +708,12 @@ public class MessageDeletionHook extends ModelHook { language="java" title="使用 MessagesModelHook 实现消息修剪" > -{`import io.github.agentic.spring.ai.graph.agent.hook.messages.MessagesModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.messages.AgentCommand; -import io.github.agentic.spring.ai.graph.agent.hook.messages.UpdatePolicy; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.hook.messages.MessagesModelHook; +import io.github.agentic.ai.graph.agent.hook.messages.AgentCommand; +import io.github.agentic.ai.graph.agent.hook.messages.UpdatePolicy; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.chat.messages.Message; import java.util.List; @@ -746,12 +746,12 @@ public class SimpleMessageTrimmingHook extends MessagesModelHook { language="java" title="使用 ModelHook 实现消息修剪(可访问状态)" > -{`import io.github.agentic.spring.ai.graph.agent.hook.ModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.state.ReplaceAllWith; +{`import io.github.agentic.ai.graph.agent.hook.ModelHook; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.state.ReplaceAllWith; import org.springframework.ai.chat.messages.Message; import java.util.List; import java.util.Map; @@ -812,9 +812,9 @@ public class AdvancedMessageTrimmingHook extends ModelHook { language="java" title="CustomAgentHook 自定义 AgentHook 示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.AgentHook; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; +{`import io.github.agentic.ai.graph.agent.hook.AgentHook; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; import java.util.concurrent.CompletableFuture; @HookPositions({HookPosition.BEFORE_AGENT, HookPosition.AFTER_AGENT}) @@ -854,10 +854,10 @@ public class CustomAgentHook extends AgentHook { language="java" title="LoggingInterceptor 自定义 ModelInterceptor 示例" > -{`import io.github.agentic.spring.ai.graph.agent.interceptor.ModelInterceptor; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelRequest; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelResponse; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelCallHandler; +{`import io.github.agentic.ai.graph.agent.interceptor.ModelInterceptor; +import io.github.agentic.ai.graph.agent.interceptor.ModelRequest; +import io.github.agentic.ai.graph.agent.interceptor.ModelResponse; +import io.github.agentic.ai.graph.agent.interceptor.ModelCallHandler; public class LoggingInterceptor extends ModelInterceptor { @@ -896,10 +896,10 @@ public class LoggingInterceptor extends ModelInterceptor { language="java" title="DynamicToolInterceptor 动态工具管理示例" > -{`import io.github.agentic.spring.ai.graph.agent.interceptor.ModelInterceptor; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelRequest; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelResponse; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelCallHandler; +{`import io.github.agentic.ai.graph.agent.interceptor.ModelInterceptor; +import io.github.agentic.ai.graph.agent.interceptor.ModelRequest; +import io.github.agentic.ai.graph.agent.interceptor.ModelResponse; +import io.github.agentic.ai.graph.agent.interceptor.ModelCallHandler; import org.springframework.ai.tool.ToolCallback; import org.springframework.ai.tool.function.FunctionToolCallback; import java.util.ArrayList; @@ -971,10 +971,10 @@ public class DynamicToolInterceptor extends ModelInterceptor { language="java" title="ToolMonitoringInterceptor 自定义 ToolInterceptor 示例" > -{`import io.github.agentic.spring.ai.graph.agent.interceptor.ToolInterceptor; -import io.github.agentic.spring.ai.graph.agent.interceptor.ToolCallRequest; -import io.github.agentic.spring.ai.graph.agent.interceptor.ToolCallResponse; -import io.github.agentic.spring.ai.graph.agent.interceptor.ToolCallHandler; +{`import io.github.agentic.ai.graph.agent.interceptor.ToolInterceptor; +import io.github.agentic.ai.graph.agent.interceptor.ToolCallRequest; +import io.github.agentic.ai.graph.agent.interceptor.ToolCallResponse; +import io.github.agentic.ai.graph.agent.interceptor.ToolCallHandler; public class ToolMonitoringInterceptor extends ToolInterceptor { @@ -1027,11 +1027,11 @@ public class ToolMonitoringInterceptor extends ToolInterceptor { language="java" title="ModelCallCounterHook 调用计数器示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.ModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.OverAllState; +{`import io.github.agentic.ai.graph.agent.hook.ModelHook; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.OverAllState; import java.util.concurrent.CompletableFuture; import java.util.Map; @@ -1095,10 +1095,10 @@ public class ModelCallCounterHook extends ModelHook { language="java" title="ModelCallLimiterHook 调用次数限制示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.ModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.agent.hook.JumpTo; +{`import io.github.agentic.ai.graph.agent.hook.ModelHook; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.agent.hook.JumpTo; import org.springframework.ai.chat.messages.AssistantMessage; import java.util.List; import java.util.ArrayList; @@ -1242,7 +1242,7 @@ public class ModelCallLimiterHook extends ModelHook { - + @@ -1465,7 +1465,7 @@ ReactAgent agent = ReactAgent.builder() ## 与 Interceptor 的区别 -在 Agentic AI 中,Hook 和 Interceptor 都可以用于干预 Agent 执行: +在 ARGI 中,Hook 和 Interceptor 都可以用于干预 Agent 执行: | 特性 | Hook | Interceptor | | ------------ | ---------------------------------------------------- | ----------------------------- | diff --git a/docs/frameworks/agent-framework/memory.md b/docs/frameworks/agent-framework/memory.md index 93c2cc7d..0ade801f 100644 --- a/docs/frameworks/agent-framework/memory.md +++ b/docs/frameworks/agent-framework/memory.md @@ -16,7 +16,7 @@ keywords: [Memory, 短期记忆, Short-term Memory, 对话历史, 线程, Thread > **注意**:会话可以隔离同一个 Agent 实例中的多个不同交互,类似于电子邮件在单个对话中分组消息的方式。 ## 理解 ReactAgent 中的短期记忆 -Agentic AI 将短期记忆作为 Agent 状态的一部分进行管理。 +ARGI 将短期记忆作为 Agent 状态的一部分进行管理。 通过将这些存储在 Graph 的状态中,Agent 可以访问给定对话的完整上下文,同时保持不同对话之间的分离。状态使用 checkpointer 持久化到数据库(或内存),以便可以随时恢复线程。短期记忆在调用 Agent 或完成步骤(如工具调用)时更新,并在每个步骤开始时读取状态。 @@ -26,21 +26,21 @@ Agentic AI 将短期记忆作为 Agent 状态的一部分进行管理。 即使你在使用的大模型上下文长度足够大,大多数模型在处理较长上下文时的表现仍然很差。因为很多模型会被过时或偏离主题的内容"分散注意力"。同时,过长的上下文,还会带来响应时间变长、Token 成本增加等问题。 -在 Agentic AI 中,ReactAgent 使用 [messages](./messages.md) 记录和传递上下文,其中包括指令(SystemMessage)和输入(UserMessage)。在 ReactAgent 中,消息(Message)在用户输入和模型响应之间交替,导致消息列表随着时间的推移变得越来越长。由于上下文窗口有限,许多应用程序可以从使用技术来移除或"忘记"过时信息中受益,即 “上下文工程”。 +在 ARGI 中,ReactAgent 使用 [messages](./messages.md) 记录和传递上下文,其中包括指令(SystemMessage)和输入(UserMessage)。在 ReactAgent 中,消息(Message)在用户输入和模型响应之间交替,导致消息列表随着时间的推移变得越来越长。由于上下文窗口有限,许多应用程序可以从使用技术来移除或"忘记"过时信息中受益,即 “上下文工程”。 ## 使用方法 -在 Agentic AI 中,要向 Agent 添加短期记忆(会话级持久化),你需要在创建 Agent 时指定 `checkpointer`。 +在 ARGI 中,要向 Agent 添加短期记忆(会话级持久化),你需要在创建 Agent 时指定 `checkpointer`。 -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; -import io.github.agentic.spring.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.RunnableConfig; // 配置 checkpointer ReactAgent agent = ReactAgent.builder() @@ -81,7 +81,7 @@ Graph Core 的 refactor 分支提供了多种 checkpoint saver。它们用于保 language="java" title="使用 Redis Checkpointer 示例" > -{`import io.github.agentic.spring.ai.graph.checkpoint.savers.RedisSaver; +{`import io.github.agentic.ai.graph.checkpoint.savers.RedisSaver; import org.redisson.api.RedissonClient; // 配置 Redis checkpointer @@ -105,10 +105,10 @@ ReactAgent agent = ReactAgent.builder() language="java" title="自定义记忆 Hook 示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.ModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.hook.ModelHook; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.chat.messages.Message; import java.util.List; import java.util.Map; @@ -178,12 +178,12 @@ public class CustomMemoryHook extends ModelHook { language="java" title="MessageTrimmingHook 修剪消息示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.agent.hook.messages.MessagesModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.messages.AgentCommand; -import io.github.agentic.spring.ai.graph.agent.hook.messages.UpdatePolicy; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.agent.hook.messages.MessagesModelHook; +import io.github.agentic.ai.graph.agent.hook.messages.AgentCommand; +import io.github.agentic.ai.graph.agent.hook.messages.UpdatePolicy; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.chat.messages.Message; import java.util.ArrayList; import java.util.List; @@ -255,12 +255,12 @@ System.out.println(finalResponse.getText()); language="java" title="MessageDeletionHook 删除消息示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.agent.hook.messages.MessagesModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.messages.AgentCommand; -import io.github.agentic.spring.ai.graph.agent.hook.messages.UpdatePolicy; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.agent.hook.messages.MessagesModelHook; +import io.github.agentic.ai.graph.agent.hook.messages.AgentCommand; +import io.github.agentic.ai.graph.agent.hook.messages.UpdatePolicy; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.chat.messages.Message; import java.util.List; @@ -291,12 +291,12 @@ public class MessageDeletionHook extends MessagesModelHook { language="java" title="ClearAllMessagesHook 删除所有消息示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.agent.hook.messages.MessagesModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.messages.AgentCommand; -import io.github.agentic.spring.ai.graph.agent.hook.messages.UpdatePolicy; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.agent.hook.messages.MessagesModelHook; +import io.github.agentic.ai.graph.agent.hook.messages.AgentCommand; +import io.github.agentic.ai.graph.agent.hook.messages.UpdatePolicy; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.chat.messages.Message; import java.util.ArrayList; import java.util.List; @@ -326,12 +326,12 @@ public class ClearAllMessagesHook extends MessagesModelHook { language="java" title="DeleteOldMessagesHook 删除旧消息示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.agent.hook.messages.MessagesModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.messages.AgentCommand; -import io.github.agentic.spring.ai.graph.agent.hook.messages.UpdatePolicy; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.agent.hook.messages.MessagesModelHook; +import io.github.agentic.ai.graph.agent.hook.messages.AgentCommand; +import io.github.agentic.ai.graph.agent.hook.messages.UpdatePolicy; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.chat.messages.Message; import java.util.List; @@ -386,12 +386,12 @@ agent.call("我叫什么名字?", config); language="java" title="MessageSummarizationHook 总结消息示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.agent.hook.messages.MessagesModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.messages.AgentCommand; -import io.github.agentic.spring.ai.graph.agent.hook.messages.UpdatePolicy; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.agent.hook.messages.MessagesModelHook; +import io.github.agentic.ai.graph.agent.hook.messages.AgentCommand; +import io.github.agentic.ai.graph.agent.hook.messages.UpdatePolicy; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.chat.model.ChatModel; import org.springframework.ai.chat.model.ChatResponse; import org.springframework.ai.chat.messages.Message; @@ -524,12 +524,12 @@ System.out.println(finalResponse.getText()); language="java" title="在工具中读取短期记忆示例" > -{`import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.tool.ToolCallback; import org.springframework.ai.tool.function.FunctionToolCallback; import org.springframework.ai.chat.model.ToolContext; import org.springframework.ai.chat.messages.AssistantMessage; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; import java.util.function.BiFunction; public class UserInfoTool implements BiFunction { @@ -586,10 +586,10 @@ System.out.println(response.getText());`} language="java" title="DynamicPromptInterceptor 动态提示示例" > -{`import io.github.agentic.spring.ai.graph.agent.interceptor.ModelInterceptor; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelRequest; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelResponse; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelCallHandler; +{`import io.github.agentic.ai.graph.agent.interceptor.ModelInterceptor; +import io.github.agentic.ai.graph.agent.interceptor.ModelRequest; +import io.github.agentic.ai.graph.agent.interceptor.ModelResponse; +import io.github.agentic.ai.graph.agent.interceptor.ModelCallHandler; public class DynamicPromptInterceptor extends ModelInterceptor { @@ -643,12 +643,12 @@ Map context = Map.of("user_name", "John Smith");`} language="java" title="TrimMessagesHook Before Model 示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.agent.hook.messages.MessagesModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.messages.AgentCommand; -import io.github.agentic.spring.ai.graph.agent.hook.messages.UpdatePolicy; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.agent.hook.messages.MessagesModelHook; +import io.github.agentic.ai.graph.agent.hook.messages.AgentCommand; +import io.github.agentic.ai.graph.agent.hook.messages.UpdatePolicy; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.chat.messages.Message; import java.util.ArrayList; import java.util.List; @@ -700,12 +700,12 @@ ReactAgent agent = ReactAgent.builder() language="java" title="ValidateResponseHook After Model 示例" > -{`import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.agent.hook.messages.MessagesModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.messages.AgentCommand; -import io.github.agentic.spring.ai.graph.agent.hook.messages.UpdatePolicy; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.agent.hook.messages.MessagesModelHook; +import io.github.agentic.ai.graph.agent.hook.messages.AgentCommand; +import io.github.agentic.ai.graph.agent.hook.messages.UpdatePolicy; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.chat.messages.AssistantMessage; import org.springframework.ai.chat.messages.Message; import java.util.ArrayList; diff --git a/docs/frameworks/agent-framework/messages.md b/docs/frameworks/agent-framework/messages.md index abf7b03e..51fc34da 100644 --- a/docs/frameworks/agent-framework/messages.md +++ b/docs/frameworks/agent-framework/messages.md @@ -7,7 +7,7 @@ keywords: [Message, Message 定义, 消息, Role, Content, Metadata, UserMessage # Message 定义 -Messages 是 Agentic AI 中模型交互的基本单元。它们代表模型的输入和输出,携带在与 LLM 交互时表示对话状态所需的内容和元数据。 +Messages 是 ARGI 中模型交互的基本单元。它们代表模型的输入和输出,携带在与 LLM 交互时表示对话状态所需的内容和元数据。 Messages 是包含以下内容的对象: @@ -15,7 +15,7 @@ Messages 是包含以下内容的对象: * **Content(内容)** - 表示消息的实际内容(如文本、图像、音频、文档等) * **Metadata(元数据)** - 可选字段,如响应信息、消息 ID 和 token 使用情况 -Agentic AI 提供了一个标准的消息类型系统,可在所有模型提供商之间工作,确保无论调用哪个模型都具有一致的行为。 +ARGI 提供了一个标准的消息类型系统,可在所有模型提供商之间工作,确保无论调用哪个模型都具有一致的行为。 ## 基础使用 @@ -265,7 +265,7 @@ if (aiMessage.hasToolCalls()) { #### Token 使用 -Agentic AI 的 `ChatResponse` 可以在其元数据中保存 token 计数和其他使用元数据: +ARGI 的 `ChatResponse` 可以在其元数据中保存 token 计数和其他使用元数据: {`// UserMessage with builder UserMessage userMsg = UserMessage.builder() - .text("你好,我想学习 Agentic AI") + .text("你好,我想学习 ARGI") .metadata(Map.of("user_id", "user_123")) .build(); @@ -490,7 +490,7 @@ SystemMessage systemMsg = SystemMessage.builder() // AssistantMessage with builder AssistantMessage assistantMsg = AssistantMessage.builder() - .content("我很乐意帮助你学习 Agentic AI!") + .content("我很乐意帮助你学习 ARGI!") .build();`} @@ -519,7 +519,7 @@ ReactAgent 自动管理消息历史,但你也可以直接使用消息: language="java" title="在 ReactAgent 中使用消息" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.chat.messages.UserMessage; import org.springframework.ai.chat.messages.AssistantMessage; diff --git a/docs/frameworks/agent-framework/multi-agent.md b/docs/frameworks/agent-framework/multi-agent.md index 78224b47..ae5e7dd3 100644 --- a/docs/frameworks/agent-framework/multi-agent.md +++ b/docs/frameworks/agent-framework/multi-agent.md @@ -42,7 +42,7 @@ refactor 分支当前可确认的 Multi-agent 模式如下: ## 自定义Agent上下文 -Multi-agent设计的核心是**上下文工程**——决定每个Agent看到什么信息。Agentic AI 为你提供细粒度的控制: +Multi-agent设计的核心是**上下文工程**——决定每个Agent看到什么信息。ARGI 为你提供细粒度的控制: * 将对话或状态的哪些部分传递给每个Agent * 为子Agent定制专门的提示 @@ -121,7 +121,7 @@ ReactAgent reviewerAgent = ReactAgent.builder() 3. **Agent B**处理并传递给**Agent C** 4. 最后一个Agent返回最终结果 -![Agentic AI SequentialAgent](/img/agent/multi-agent/sequential.png) +![ARGI SequentialAgent](/img/agent/multi-agent/sequential.png) #### 实现 @@ -129,8 +129,8 @@ ReactAgent reviewerAgent = ReactAgent.builder() language="java" title="SequentialAgent 实现示例" > -{`import io.github.agentic.spring.ai.graph.agent.flow.agent.SequentialAgent; -import io.github.agentic.spring.ai.graph.OverAllState; +{`import io.github.agentic.ai.graph.agent.flow.agent.SequentialAgent; +import io.github.agentic.ai.graph.OverAllState; // 创建专业化的子Agent ReactAgent writerAgent = ReactAgent.builder() @@ -233,7 +233,7 @@ if (result.isPresent()) { 2. 所有Agent**并行**处理 3. 结果被**合并**成单一输出 -![Agentic AI ParallelAgent](/img/agent/multi-agent/parallel.png) +![ARGI ParallelAgent](/img/agent/multi-agent/parallel.png) #### 实现 @@ -241,7 +241,7 @@ if (result.isPresent()) { language="java" title="ParallelAgent 实现示例" > -{`import io.github.agentic.spring.ai.graph.agent.flow.agent.ParallelAgent; +{`import io.github.agentic.ai.graph.agent.flow.agent.ParallelAgent; // 创建多个专业化Agent ReactAgent proseWriterAgent = ReactAgent.builder() @@ -349,7 +349,7 @@ ParallelAgent parallelAgent = ParallelAgent.builder() 3. **选中的子Agent**处理请求 4. 结果返回给用户 -![Agentic AI LlmRoutingAgent](/img/agent/multi-agent/routing.png) +![ARGI LlmRoutingAgent](/img/agent/multi-agent/routing.png) #### 实现 @@ -357,8 +357,8 @@ ParallelAgent parallelAgent = ParallelAgent.builder() language="java" title="LlmRoutingAgent 实现示例" > -{`import io.github.agentic.spring.ai.graph.agent.flow.agent.LlmRoutingAgent; -import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.flow.agent.LlmRoutingAgent; +import io.github.agentic.ai.graph.agent.ReactAgent; // 创建专业化的子Agent ReactAgent writerAgent = ReactAgent.builder() @@ -608,9 +608,9 @@ LlmRoutingAgent routingAgent = LlmRoutingAgent.builder() language="java" title="LoopAgent 固定次数循环示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.flow.agent.LoopAgent; -import io.github.agentic.spring.ai.graph.agent.flow.agent.loop.LoopMode; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.flow.agent.LoopAgent; +import io.github.agentic.ai.graph.agent.flow.agent.loop.LoopMode; ReactAgent reviseAgent = ReactAgent.builder() .name("revise_agent") @@ -627,15 +627,15 @@ LoopAgent loopAgent = LoopAgent.builder() .loopStrategy(LoopMode.count(3)) .build(); -loopAgent.invoke("请润色这段文字:Agentic AI 可以编排多个智能体。");`} +loopAgent.invoke("请润色这段文字:ARGI 可以编排多个智能体。");`} -{`import io.github.agentic.spring.ai.graph.agent.flow.agent.LoopAgent; -import io.github.agentic.spring.ai.graph.agent.flow.agent.loop.LoopMode; +{`import io.github.agentic.ai.graph.agent.flow.agent.LoopAgent; +import io.github.agentic.ai.graph.agent.flow.agent.loop.LoopMode; import org.springframework.ai.chat.messages.Message; LoopAgent qualityLoop = LoopAgent.builder() @@ -652,7 +652,7 @@ LoopAgent qualityLoop = LoopAgent.builder() ### 自定义(Customized) -Agentic AI 提供了 `FlowAgent` 抽象类,允许你创建自定义的Agent工作流模式。通过继承 `FlowAgent` 并实现特定的图构建逻辑,你可以实现任何复杂的多Agent协作模式。 +ARGI 提供了 `FlowAgent` 抽象类,允许你创建自定义的Agent工作流模式。通过继承 `FlowAgent` 并实现特定的图构建逻辑,你可以实现任何复杂的多Agent协作模式。 #### FlowAgent 架构 @@ -686,12 +686,12 @@ Agentic AI 提供了 `FlowAgent` 抽象类,允许你创建自定义的Agent工 language="java" title="实现自定义FlowAgent示例" > -{`import io.github.agentic.spring.ai.graph.agent.flow.agent.FlowAgent; -import io.github.agentic.spring.ai.graph.agent.flow.builder.FlowAgentBuilder; -import io.github.agentic.spring.ai.graph.agent.flow.builder.FlowGraphBuilder; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.agent.Agent; +{`import io.github.agentic.ai.graph.agent.flow.agent.FlowAgent; +import io.github.agentic.ai.graph.agent.flow.builder.FlowAgentBuilder; +import io.github.agentic.ai.graph.agent.flow.builder.FlowGraphBuilder; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.agent.Agent; import java.util.List; import java.util.function.Predicate; @@ -777,7 +777,7 @@ public class ConditionalAgent extends FlowAgent { language="java" title="使用自定义Agent示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.ReactAgent; import java.util.Map; // 创建两个分支Agent diff --git a/docs/frameworks/agent-framework/quick-start.md b/docs/frameworks/agent-framework/quick-start.md index abaa1759..957e4979 100644 --- a/docs/frameworks/agent-framework/quick-start.md +++ b/docs/frameworks/agent-framework/quick-start.md @@ -1,7 +1,7 @@ --- title: Agent Framework 快速开始 sidebar_label: 快速开始 -description: 使用 Agentic AI Agent Framework 创建一个基于 ReactAgent 的智能体。 +description: 使用 ARGI Agent Framework 创建一个基于 ReactAgent 的智能体。 --- # Agent Framework 快速开始 @@ -15,18 +15,18 @@ Agent Framework 提供面向智能体应用的上层 API。当前核心入口是 ```xml io.github.agentic-ai - agentic-ai-agent-framework + argi-agent-framework ``` -`agentic-ai-agent-framework` 依赖 `agentic-ai-graph-core`。如果应用只直接使用 `ReactAgent`,通常不需要再显式声明 Graph Core 依赖。 +`argi-agent-framework` 依赖 `argi-graph-core`。如果应用只直接使用 `ReactAgent`,通常不需要再显式声明 Graph Core 依赖。 ## 创建 ReactAgent `ReactAgent` 使用 Spring AI 的 `ChatModel`。模型实例由应用按所选模型提供方创建或注入。 ```java -import io.github.agentic.spring.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.chat.messages.AssistantMessage; import org.springframework.ai.chat.model.ChatModel; import org.springframework.ai.tool.annotation.Tool; diff --git a/docs/frameworks/agent-framework/rag.md b/docs/frameworks/agent-framework/rag.md index f94e1dfb..6c1bd46a 100644 --- a/docs/frameworks/agent-framework/rag.md +++ b/docs/frameworks/agent-framework/rag.md @@ -29,7 +29,7 @@ keywords: **知识库**是用于检索的文档或结构化数据的存储库。 -如果你需要自定义知识库,可以使用 Agentic AI 的文档加载器和向量存储从你自己的数据构建。 +如果你需要自定义知识库,可以使用 ARGI 的文档加载器和向量存储从你自己的数据构建。 > 如果你已经有一个知识库(例如 SQL 数据库、CRM 或内部文档系统),你**不需要**重建它。你可以: > @@ -46,13 +46,13 @@ keywords: 典型的检索工作流如下: -![Agentic AI RAG](/img/agent/rag/rag1.png) +![ARGI RAG](/img/agent/rag/rag1.png) 每个组件都是模块化的:你可以交换加载器、分割器、嵌入或向量存储,而无需重写应用程序的逻辑。 ### 构建模块 -在 Agentic AI 中,你可以使用以下组件构建 RAG 系统: +在 ARGI 中,你可以使用以下组件构建 RAG 系统: #### 文档加载器和解析器 @@ -94,7 +94,7 @@ RAG 可以以多种方式实现,具体取决于你的系统需求。我们在 在**两步 RAG**中,检索步骤总是在生成步骤之前执行。这种架构简单且可预测,适合许多应用,其中检索相关文档是生成答案的明确前提。 -![Agentic AI RAG](/img/agent/rag/rag2.png) +![ARGI RAG](/img/agent/rag/rag2.png) Spring AI 提供了开箱即用的 `QuestionAnswerAdvisor` 和 `RetrievalAugmentationAdvisor`,简化两步 RAG 的实现。这些 Advisor 自动处理检索和上下文增强,详见 [Spring AI Advisor 架构](https://docs.spring.io/spring-ai/reference/api/advisors.html)。 @@ -106,13 +106,13 @@ Spring AI 提供了开箱即用的 `QuestionAnswerAdvisor` 和 `RetrievalAugment language="java" title="使用 MessagesModelHook 实现两步RAG" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.hook.messages.MessagesModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.messages.AgentCommand; -import io.github.agentic.spring.ai.graph.agent.hook.messages.UpdatePolicy; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.hook.messages.MessagesModelHook; +import io.github.agentic.ai.graph.agent.hook.messages.AgentCommand; +import io.github.agentic.ai.graph.agent.hook.messages.UpdatePolicy; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.document.Document; import org.springframework.ai.vectorstore.VectorStore; import org.springframework.ai.chat.messages.Message; @@ -202,7 +202,7 @@ ReactAgent ragAgent = ReactAgent.builder() .build(); // 调用 Agent -AssistantMessage response = ragAgent.call("Agentic AI支持哪些模型?"); +AssistantMessage response = ragAgent.call("ARGI支持哪些模型?"); System.out.println("答案: " + response.getText());`} @@ -214,11 +214,11 @@ System.out.println("答案: " + response.getText());`} language="java" title="使用 ModelInterceptor 实现两步RAG" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelInterceptor; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelRequest; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelResponse; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelCallHandler; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.interceptor.ModelInterceptor; +import io.github.agentic.ai.graph.agent.interceptor.ModelRequest; +import io.github.agentic.ai.graph.agent.interceptor.ModelResponse; +import io.github.agentic.ai.graph.agent.interceptor.ModelCallHandler; import org.springframework.ai.document.Document; import org.springframework.ai.vectorstore.VectorStore; import org.springframework.ai.chat.messages.SystemMessage; @@ -309,7 +309,7 @@ ReactAgent ragAgent = ReactAgent.builder() .build(); // 调用 Agent -AssistantMessage response = ragAgent.call("Agentic AI支持哪些模型?"); +AssistantMessage response = ragAgent.call("ARGI支持哪些模型?"); System.out.println("答案: " + response.getText());`} @@ -321,16 +321,16 @@ System.out.println("答案: " + response.getText());`} language="java" title="使用 AgentHook 实现两步RAG(只检索一次)" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.hook.AgentHook; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelInterceptor; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelRequest; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelResponse; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelCallHandler; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.hook.AgentHook; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.agent.interceptor.ModelInterceptor; +import io.github.agentic.ai.graph.agent.interceptor.ModelRequest; +import io.github.agentic.ai.graph.agent.interceptor.ModelResponse; +import io.github.agentic.ai.graph.agent.interceptor.ModelCallHandler; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.document.Document; import org.springframework.ai.vectorstore.VectorStore; import org.springframework.ai.chat.messages.SystemMessage; @@ -463,7 +463,7 @@ ReactAgent ragAgent = ReactAgent.builder() .build(); // 调用 Agent(RAG 检索只会在 Agent 开始时执行一次) -AssistantMessage response = ragAgent.call("Agentic AI支持哪些模型?"); +AssistantMessage response = ragAgent.call("ARGI支持哪些模型?"); System.out.println("答案: " + response.getText());`} @@ -523,7 +523,7 @@ List results = vectorStore.similaritySearch("查询文本");`} Agent 启用 RAG 行为所需的唯一条件是访问一个或多个可以获取外部知识的**工具**——例如文档加载器、Web API 或数据库查询。 ::: -![Agentic AI RAG](/img/agent/rag/rag3.png) +![ARGI RAG](/img/agent/rag/rag3.png) #### Java 实现示例 @@ -531,7 +531,7 @@ Agent 启用 RAG 行为所需的唯一条件是访问一个或多个可以获取 language="java" title="Agentic RAG实现示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.document.Document; import org.springframework.ai.tool.ToolCallback; import org.springframework.ai.tool.function.FunctionToolCallback; @@ -584,7 +584,7 @@ ReactAgent ragAgent = ReactAgent.builder() .build(); // Agent会自动决定何时调用检索工具 -ragAgent.invoke("Agentic AI支持哪些向量数据库?");`} +ragAgent.invoke("ARGI支持哪些向量数据库?");`} 在这个例子中: @@ -601,7 +601,7 @@ ragAgent.invoke("Agentic AI支持哪些向量数据库?");`} language="java" title="多工具Agentic RAG示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.document.Document; import org.springframework.ai.tool.ToolCallback; import org.springframework.ai.tool.function.FunctionToolCallback; @@ -700,7 +700,7 @@ multiSourceAgent.invoke("比较我们的产品文档中的功能和最新的市 架构通常支持这些步骤之间的多次迭代: -![Agentic AI RAG](/img/agent/rag/rag4.png) +![ARGI RAG](/img/agent/rag/rag4.png) #### Java 实现示例 @@ -710,16 +710,16 @@ multiSourceAgent.invoke("比较我们的产品文档中的功能和最新的市 language="java" title="混合RAG实现示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.hook.AgentHook; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.agent.hook.HookPositions; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelInterceptor; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelRequest; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelResponse; -import io.github.agentic.spring.ai.graph.agent.interceptor.ModelCallHandler; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.hook.AgentHook; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.agent.hook.HookPositions; +import io.github.agentic.ai.graph.agent.interceptor.ModelInterceptor; +import io.github.agentic.ai.graph.agent.interceptor.ModelRequest; +import io.github.agentic.ai.graph.agent.interceptor.ModelResponse; +import io.github.agentic.ai.graph.agent.interceptor.ModelCallHandler; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; import org.springframework.ai.document.Document; import org.springframework.ai.tool.ToolCallback; import org.springframework.ai.tool.function.FunctionToolCallback; @@ -939,7 +939,7 @@ ReactAgent hybridRAGAgent = ReactAgent.builder() // ========== 5. 使用混合 RAG Agent ========== -AssistantMessage response = hybridRAGAgent.call("Agentic AI支持哪些向量数据库?"); +AssistantMessage response = hybridRAGAgent.call("ARGI支持哪些向量数据库?"); System.out.println("答案: " + response.getText());`} @@ -989,9 +989,9 @@ System.out.println("答案: " + response.getText());`} - 使用异步检索 - 批量处理文档嵌入 -## Agentic AI RAG 组件 +## ARGI RAG 组件 -Agentic AI 提供了构建 RAG 系统的核心组件和模块化架构: +ARGI 提供了构建 RAG 系统的核心组件和模块化架构: -目录配置:`userSkillsDirectory(String|Resource)`、`projectSkillsDirectory(String|Resource)`;不设置时用户级默认 `~/saa/skills`,项目级默认 `./skills`,同名技能“项目级别”覆盖“用户级别”。 +目录配置:`userSkillsDirectory(String|Resource)`、`projectSkillsDirectory(String|Resource)`;不设置时用户级默认 `~/argi/skills`,项目级默认 `./skills`,同名技能“项目级别”覆盖“用户级别”。 ### 使用 ClasspathSkillRegistry @@ -103,14 +103,14 @@ ReactAgent agent = ReactAgent.builder() 技能常需配合脚本执行(如技能目录下的 Python 脚本)和 Shell 命令。下面示例使用 **ClasspathSkillRegistry** 加载技能、**SkillsAgentHook** 提供 `read_skill`、**ShellToolAgentHook** 提供 Shell 工具、**PythonTool** 提供 Python 执行能力,Agent 可根据技能说明读取并处理技能目录下的文件。 -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.hook.skills.SkillsAgentHook; -import io.github.agentic.spring.ai.graph.agent.hook.shelltool.ShellToolAgentHook; -import io.github.agentic.spring.ai.graph.agent.tools.PythonTool; -import io.github.agentic.spring.ai.graph.agent.tools.ShellTool2; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; -import io.github.agentic.spring.ai.graph.skills.registry.classpath.ClasspathSkillRegistry; -import io.github.agentic.spring.ai.graph.skills.registry.SkillRegistry; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.hook.skills.SkillsAgentHook; +import io.github.agentic.ai.graph.agent.hook.shelltool.ShellToolAgentHook; +import io.github.agentic.ai.graph.agent.tools.PythonTool; +import io.github.agentic.ai.graph.agent.tools.ShellTool2; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.skills.registry.classpath.ClasspathSkillRegistry; +import io.github.agentic.ai.graph.skills.registry.SkillRegistry; // 1. 技能注册表:从 classpath:skills 加载(如 src/main/resources/skills/) SkillRegistry registry = ClasspathSkillRegistry.builder() @@ -138,7 +138,7 @@ ReactAgent agent = ReactAgent.builder() .build(); // 5. 调用示例:用户请求处理技能目录下的文件时,模型可先 read_skill 再按技能说明调用 Python/Shell -String skillFilePath = "/path/to/skills/pdf-extractor/agentic-ai-roadmap.pdf"; // 实际路径来自技能目录或 hook.listSkills() +String skillFilePath = "/path/to/skills/pdf-extractor/argi-roadmap.pdf"; // 实际路径来自技能目录或 hook.listSkills() AssistantMessage response = agent.call("请从 " + skillFilePath + " 文件中提取关键信息。");`} @@ -187,7 +187,7 @@ SkillsAgentHook hook = SkillsAgentHook.builder() {`SkillRegistry registry = FileSystemSkillRegistry.builder() - .userSkillsDirectory("/home/user/agentic-ai/skills") + .userSkillsDirectory("/home/user/argi/skills") .projectSkillsDirectory("/app/project/skills") .build();`} @@ -196,7 +196,7 @@ SkillsAgentHook hook = SkillsAgentHook.builder() #### 自定义系统提示模板 -Agentic AI 框架内置了 Skill Prompt 模板,用来引导实现 Skill 的渐进式披露。用户可结合自己系统的 Skill 组织方式定制 Prompt 模板。 +ARGI 框架内置了 Skill Prompt 模板,用来引导实现 Skill 的渐进式披露。用户可结合自己系统的 Skill 组织方式定制 Prompt 模板。 {`SystemPromptTemplate customTemplate = SystemPromptTemplate.builder() @@ -219,7 +219,7 @@ FileSystemSkillRegistry registry = FileSystemSkillRegistry.builder() ## 在 Graph 中使用 Skills -除在 **ReactAgent** 上通过 **SkillsAgentHook** 使用 Skills 外,在基于 **Graph** 或 **ChatClient** 的链路中,可通过 **ChatClient** 配合 **SkillPromptAugmentAdvisor**(`agentic-ai-graph-core`)将技能列表注入系统提示,实现渐进式披露的「技能发现」部分。 +除在 **ReactAgent** 上通过 **SkillsAgentHook** 使用 Skills 外,在基于 **Graph** 或 **ChatClient** 的链路中,可通过 **ChatClient** 配合 **SkillPromptAugmentAdvisor**(`argi-graph-core`)将技能列表注入系统提示,实现渐进式披露的「技能发现」部分。 ### 使用 ChatClient + SkillPromptAugmentAdvisor @@ -227,12 +227,12 @@ FileSystemSkillRegistry registry = FileSystemSkillRegistry.builder() {`import org.springframework.ai.chat.client.ChatClient; -import io.github.agentic.spring.ai.graph.advisors.SkillPromptAugmentAdvisor; +import io.github.agentic.ai.graph.advisors.SkillPromptAugmentAdvisor; // 方式一:指定技能目录(字符串路径),Advisor 内部创建 FileSystemSkillRegistry SkillPromptAugmentAdvisor skillAdvisor = SkillPromptAugmentAdvisor.builder() .projectSkillsDirectory("./skills") // 或绝对路径 /path/to/skills - // .userSkillsDirectory("~/saa/skills") // 可选,默认 ~/saa/skills + // .userSkillsDirectory("~/argi/skills") // 可选,默认 ~/argi/skills .lazyLoad(false) // 可选,true 则首次请求时再加载技能 .build(); @@ -248,8 +248,8 @@ String response = chatClient.prompt() -{`import io.github.agentic.spring.ai.graph.skills.registry.SkillRegistry; -import io.github.agentic.spring.ai.graph.skills.registry.filesystem.FileSystemSkillRegistry; +{`import io.github.agentic.ai.graph.skills.registry.SkillRegistry; +import io.github.agentic.ai.graph.skills.registry.filesystem.FileSystemSkillRegistry; SkillRegistry registry = FileSystemSkillRegistry.builder() .projectSkillsDirectory("./skills") diff --git a/docs/frameworks/agent-framework/structured-io.md b/docs/frameworks/agent-framework/structured-io.md index d82aa5d4..d18237c5 100644 --- a/docs/frameworks/agent-framework/structured-io.md +++ b/docs/frameworks/agent-framework/structured-io.md @@ -19,8 +19,8 @@ keywords: [ReactAgent, inputSchema, inputType, outputSchema, outputType, outputK 当使用 `AgentTool.create(agent)` 或 `AgentTool.getFunctionToolCallback(agent)` 时,`AgentTool` 会读取子 Agent 的 `inputSchema` 或 `inputType`,并把原始 schema 包装到名为 `input` 的工具参数中。 ```java -import io.github.agentic.spring.ai.graph.agent.AgentTool; -import io.github.agentic.spring.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.AgentTool; +import io.github.agentic.ai.graph.agent.ReactAgent; record ResearchRequest(String topic, int maxItems) {} diff --git a/docs/frameworks/agent-framework/tools-as-agent.md b/docs/frameworks/agent-framework/tools-as-agent.md index 162cf9a4..7c76bb43 100644 --- a/docs/frameworks/agent-framework/tools-as-agent.md +++ b/docs/frameworks/agent-framework/tools-as-agent.md @@ -34,7 +34,7 @@ Multi-agent系统在以下情况下很有用: ## 自定义Agent上下文 -Multi-agent设计的核心是**上下文工程**——决定每个Agent看到什么信息。Agentic AI 为你提供细粒度的控制: +Multi-agent设计的核心是**上下文工程**——决定每个Agent看到什么信息。ARGI 为你提供细粒度的控制: * 将对话或状态的哪些部分传递给每个Agent * 为子Agent定制专门的提示 @@ -68,8 +68,8 @@ Multi-agent设计的核心是**上下文工程**——决定每个Agent看到什 language="java" title="AgentTool 基础示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.AgentTool; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.AgentTool; import org.springframework.ai.chat.model.ChatModel; // 创建子Agent @@ -122,8 +122,8 @@ Optional result = blogAgent.invoke("帮我写一个100字左右的 language="java" title="使用 inputSchema 示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.AgentTool; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.AgentTool; // 定义子Agent的输入Schema(标准 JSON Schema 格式) String writerInputSchema = """ @@ -170,8 +170,8 @@ Optional result = coordinatorAgent.invoke("请写一篇关于春 language="java" title="使用 inputType 示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.AgentTool; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.AgentTool; // 定义输入类型 public record ArticleRequest( @@ -215,8 +215,8 @@ Optional result = coordinatorAgent.invoke("请写一篇关于秋 language="java" title="使用 outputSchema 示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.AgentTool; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.AgentTool; import org.springframework.ai.converter.BeanOutputConverter; // 定义输出类型 @@ -264,8 +264,8 @@ Optional result = coordinatorAgent.invoke("写一篇关于冬天 language="java" title="使用 outputType 示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.AgentTool; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.AgentTool; import org.springframework.ai.converter.BeanOutputConverter; // 定义输出类型 @@ -303,8 +303,8 @@ Optional result = coordinatorAgent.invoke("写一篇关于夏天 language="java" title="完整类型化示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.AgentTool; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.AgentTool; // 定义输入和输出类型 public record ArticleRequest(String topic, int wordCount, String style) {} @@ -362,8 +362,8 @@ Optional result = orchestratorAgent.invoke("请写一篇关于友 language="java" title="多个子Agent作为工具示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.agent.AgentTool; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.AgentTool; // 创建写作Agent ReactAgent writerAgent = ReactAgent.builder() diff --git a/docs/frameworks/agent-framework/tools.md b/docs/frameworks/agent-framework/tools.md index d9b51603..7cc4c0f1 100644 --- a/docs/frameworks/agent-framework/tools.md +++ b/docs/frameworks/agent-framework/tools.md @@ -1049,9 +1049,9 @@ import java.util.function.BiFunction; import java.util.List; import java.util.Map; -import static io.github.agentic.spring.ai.graph.agent.tools.ToolContextConstants.AGENT_STATE_CONTEXT_KEY; -import static io.github.agentic.spring.ai.graph.agent.tools.ToolContextConstants.AGENT_CONFIG_CONTEXT_KEY; -import static io.github.agentic.spring.ai.graph.agent.tools.ToolContextConstants.AGENT_STATE_FOR_UPDATE_CONTEXT_KEY; +import static io.github.agentic.ai.graph.agent.tools.ToolContextConstants.AGENT_STATE_CONTEXT_KEY; +import static io.github.agentic.ai.graph.agent.tools.ToolContextConstants.AGENT_CONFIG_CONTEXT_KEY; +import static io.github.agentic.ai.graph.agent.tools.ToolContextConstants.AGENT_STATE_FOR_UPDATE_CONTEXT_KEY; // 访问当前对话状态 public class ConversationSummaryTool implements BiFunction { @@ -1099,17 +1099,17 @@ ToolCallback summaryTool = FunctionToolCallback **更新状态**: -在 Agentic AI 中,你可以通过 Hook 或在工具执行后返回的信息来更新 Agent 的状态。 +在 ARGI 中,你可以通过 Hook 或在工具执行后返回的信息来更新 Agent 的状态。 {`// 在 Hook 中更新状态 -import io.github.agentic.spring.ai.graph.agent.hook.ModelHook; -import io.github.agentic.spring.ai.graph.agent.hook.HookPosition; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.agent.hook.ModelHook; +import io.github.agentic.ai.graph.agent.hook.HookPosition; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; import java.util.concurrent.CompletableFuture; public class UpdateStateHook extends ModelHook { @@ -1147,7 +1147,7 @@ public class UpdateStateHook extends ModelHook { import java.util.function.BiFunction; import java.util.Map; -import static io.github.agentic.spring.ai.graph.agent.tools.ToolContextConstants.AGENT_CONFIG_CONTEXT_KEY; +import static io.github.agentic.ai.graph.agent.tools.ToolContextConstants.AGENT_CONFIG_CONTEXT_KEY; public class AccountInfoTool implements BiFunction { @@ -1214,13 +1214,13 @@ agent.call("question", config);`} ### Memory(存储) -使用存储访问跨对话的持久数据。在 Agentic AI 中,你可以使用 checkpointer 来实现长期记忆。 +使用存储访问跨对话的持久数据。在 ARGI 中,你可以使用 checkpointer 来实现长期记忆。 -{`import io.github.agentic.spring.ai.graph.checkpoint.savers.RedisSaver; +{`import io.github.agentic.ai.graph.checkpoint.savers.RedisSaver; // 配置持久化存储 RedisSaver redisSaver = new RedisSaver(redissonClient); @@ -1269,7 +1269,7 @@ ReactAgent 提供了多种方式来提供和使用工具。根据你的使用场 language="java" title="使用 tools() 方法提供工具" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.tool.ToolCallback; import org.springframework.ai.tool.function.FunctionToolCallback; @@ -1309,7 +1309,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="使用 methodTools() 方法提供工具" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.tool.annotation.Tool; import org.springframework.ai.tool.annotation.ToolParam; @@ -1364,7 +1364,7 @@ ReactAgent multiAgent = ReactAgent.builder() language="java" title="使用 toolCallbackProviders() 方法提供工具" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.tool.ToolCallback; import org.springframework.ai.tool.ToolCallbackProvider; import org.springframework.ai.tool.function.FunctionToolCallback; @@ -1417,7 +1417,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="使用 toolNames() 和 resolver() 方法提供工具" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.tool.ToolCallback; import org.springframework.ai.tool.function.FunctionToolCallback; import org.springframework.ai.tool.resolution.StaticToolCallbackResolver; @@ -1465,7 +1465,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="使用 resolver() 方法提供工具" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.tool.ToolCallback; import org.springframework.ai.tool.function.FunctionToolCallback; import org.springframework.ai.tool.resolution.StaticToolCallbackResolver; @@ -1506,7 +1506,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="组合使用多种工具提供方式" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.tool.ToolCallback; import org.springframework.ai.tool.ToolCallbackProvider; import org.springframework.ai.tool.function.FunctionToolCallback; @@ -1563,7 +1563,7 @@ ReactAgent agent = ReactAgent.builder() language="java" title="在 ReactAgent 中使用工具示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; +{`import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.tool.ToolCallback; import org.springframework.ai.tool.function.FunctionToolCallback; @@ -1596,7 +1596,7 @@ System.out.println(response.getText());`} ### React Agent 远程 MCP 工具调用示例 -在实际应用中,工具通常来自独立的 MCP Server。Agentic AI 的 ReAct Agent 不直接绑定某个模型厂商:只要应用中已经有 Spring AI `ChatModel` 和 `ToolCallbackProvider`,就可以把 MCP 工具挂到 `ReactAgent` 或 `ChatClient` 上。 +在实际应用中,工具通常来自独立的 MCP Server。ARGI 的 ReAct Agent 不直接绑定某个模型厂商:只要应用中已经有 Spring AI `ChatModel` 和 `ToolCallbackProvider`,就可以把 MCP 工具挂到 `ReactAgent` 或 `ChatClient` 上。 #### 1. 通过 Spring AI MCP Client 接入远程工具 @@ -1606,7 +1606,7 @@ System.out.println(response.getText());`} io.github.agentic-ai - agentic-ai-agent-framework + argi-agent-framework org.springframework.ai @@ -1631,7 +1631,7 @@ spring: mcp: client: enabled: true - name: agentic-ai-mcp-client + name: argi-mcp-client type: async toolcallback: enabled: true @@ -1653,9 +1653,9 @@ spring: language="java" title="通过 ToolCallbackProvider 为 ReactAgent 提供 MCP 工具" > -{`import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; +{`import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; import org.springframework.ai.chat.messages.AssistantMessage; import org.springframework.ai.chat.model.ChatModel; import org.springframework.ai.tool.ToolCallbackProvider; @@ -1734,7 +1734,7 @@ public class RemoteMcpChatService { }`} -## Agentic AI 扩展工具能力 +## ARGI 扩展工具能力 除 Spring AI 的基础工具抽象外,Agent Framework refactor 分支还提供了面向 Agent 运行时的工具扩展。 @@ -1759,7 +1759,7 @@ ReactAgent agent = ReactAgent.builder() 已实现 `AsyncToolCallback` 的工具可以直接异步执行。实现 `CancellableAsyncToolCallback` 的工具还能响应取消;同步工具可通过 `wrapSyncToolsAsAsync(true)` 适配为异步执行。 ```java -import io.github.agentic.spring.ai.graph.agent.tool.AsyncToolCallback; +import io.github.agentic.ai.graph.agent.tool.AsyncToolCallback; import org.springframework.ai.chat.model.ToolContext; import org.springframework.ai.tool.definition.ToolDefinition; @@ -1812,7 +1812,7 @@ ReactAgent agent = ReactAgent.builder() `ToolMultimodalResult` 用于让工具返回文本加图片、音频等 Spring AI `Media` 内容。它支持 URL、URI、字节数组、`Resource`、Base64,以及同时携带 URL 与 Base64 的结果。 ```java -import io.github.agentic.spring.ai.graph.agent.tool.multimodal.ToolMultimodalResult; +import io.github.agentic.ai.graph.agent.tool.multimodal.ToolMultimodalResult; import org.springframework.util.MimeTypeUtils; ToolMultimodalResult result = ToolMultimodalResult.builder() @@ -1836,10 +1836,10 @@ refactor 分支当前可确认的内置工具包括: | `TaskTool` / `TaskOutputTool` | 启动子 Agent 任务并获取任务输出。 | `TaskToolsBuilder.builder().subAgent(...).build()` 或加载 Agent spec 后 `build()` | ```java -import io.github.agentic.spring.ai.graph.agent.tools.GlobSearchTool; -import io.github.agentic.spring.ai.graph.agent.tools.GrepSearchTool; -import io.github.agentic.spring.ai.graph.agent.tools.ShellTool; -import io.github.agentic.spring.ai.graph.agent.tools.task.TaskToolsBuilder; +import io.github.agentic.ai.graph.agent.tools.GlobSearchTool; +import io.github.agentic.ai.graph.agent.tools.GrepSearchTool; +import io.github.agentic.ai.graph.agent.tools.ShellTool; +import io.github.agentic.ai.graph.agent.tools.task.TaskToolsBuilder; import org.springframework.ai.tool.ToolCallback; ToolCallback shellTool = ShellTool.builder("/workspace/project") diff --git a/docs/frameworks/agent-framework/workflow.md b/docs/frameworks/agent-framework/workflow.md index a5492e4e..2a384ed2 100644 --- a/docs/frameworks/agent-framework/workflow.md +++ b/docs/frameworks/agent-framework/workflow.md @@ -11,10 +11,10 @@ Graph 是 Agent Framework 的底层运行时。**我们建议开发者使用 Age Graph 是一个低级工作流和多智能体编排框架,使开发者能够实现复杂的应用程序编排。 ## Agent 编排的核心引擎 -Agentic AI Graph 是 Agent 编排背后的核心引擎,在底层,Agentic AI 框架会将 Agent 编排为 Graph,组成一个由节点串联而成的 DAG 图。 +ARGI Graph 是 Agent 编排背后的核心引擎,在底层,ARGI 框架会将 Agent 编排为 Graph,组成一个由节点串联而成的 DAG 图。 ### Graph 引擎核心概念与定义 -Agentic AI Graph 有以下三个核心概念: +ARGI Graph 有以下三个核心概念: + **状态(State)**:定义了在 Node 与 Edge 之间传递的数据结构,是整个 Agent 上下文传递的核心载体,具体实现上是一个 `Map`。 + **节点(Node)**:Graph 中的每个 Node 是执行逻辑单元,接受当前 State 作为输入,执行某些操作(如调用 LLM 或自定义逻辑),并返回对 State 的更新。 @@ -22,20 +22,20 @@ Agentic AI Graph 有以下三个核心概念: ![](/img/agent/workflow/graph.png) -通过组合 Node 和 Edge,开发者可以创建复杂的循环工作流,随着时间的推移不断更新 State 状态。然而,真正的力量来自 Agentic AI 如何管理这种 State 状态。 +通过组合 Node 和 Edge,开发者可以创建复杂的循环工作流,随着时间的推移不断更新 State 状态。然而,真正的力量来自 ARGI 如何管理这种 State 状态。 简而言之:Node 完成工作,Edge 告诉下一步该做什么。 ### Graph 引擎提供的 Low-level API -Agentic AI 同时提供了声明式的 Agentic API 与底层原子化的 Graph API,两种模式都对开发者开发,**Agentic API vs Graph API **应该怎么选?前文我们已经重点介绍了 Agentic API 的开发模式,相比于 Agentic API,Graph API 可以让开发者对流程有更全面的控制,开发者可以独立定义每个 Node 的逻辑、每条边的逻辑,最终按照业务需要编排成完成的流程图。 +ARGI 同时提供了声明式的 Agentic API 与底层原子化的 Graph API,两种模式都对开发者开发,**Agentic API vs Graph API **应该怎么选?前文我们已经重点介绍了 Agentic API 的开发模式,相比于 Agentic API,Graph API 可以让开发者对流程有更全面的控制,开发者可以独立定义每个 Node 的逻辑、每条边的逻辑,最终按照业务需要编排成完成的流程图。 以下是使用 Graph API 实现 DeepResearch 类工作流的流程图定义,演示了 Graph API 的具体使用方法: ### Graph 引擎提供更多运行时特性 -整个 Agentic AI 框架底层基于 Spring AI 实现(下图绿色部分),因此在 Augmented LLM 层次提供了 Model、Tool Calling、MCP、RAG 等原子能力的完善定义,具备厂商无关、易用性高、可扩展性强的特点。 +整个 ARGI 框架底层基于 Spring AI 实现(下图绿色部分),因此在 Augmented LLM 层次提供了 Model、Tool Calling、MCP、RAG 等原子能力的完善定义,具备厂商无关、易用性高、可扩展性强的特点。 -在 Agentic Framework 这一层(下图蓝色部分),是 Agentic AI 框架提供的核心抽象。定义了 Graph 引擎将以及面向开发者的 Agentic API、Graph API 来实现智能体流程编排。 +在 Agentic Framework 这一层(下图蓝色部分),是 ARGI 框架提供的核心抽象。定义了 Graph 引擎将以及面向开发者的 Agentic API、Graph API 来实现智能体流程编排。 ![](/img/agent/overview/architecture.png) @@ -48,7 +48,7 @@ Agentic AI 同时提供了声明式的 Agentic API 与底层原子化的 Graph A ## 定义自己的Node -在 Agentic AI Graph 中,Node 是工作流的基本执行单元。每个 Node 负责处理特定的业务逻辑,接收状态(State)作为输入,并返回更新后的状态。 +在 ARGI Graph 中,Node 是工作流的基本执行单元。每个 Node 负责处理特定的业务逻辑,接收状态(State)作为输入,并返回更新后的状态。 ### Node 接口 @@ -79,8 +79,8 @@ public interface NodeActionWithConfig { language="java" title="基础 Node 示例" > -{`import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.action.NodeAction; +{`import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.action.NodeAction; import java.util.HashMap; import java.util.Map; @@ -110,9 +110,9 @@ public class TextProcessorNode implements NodeAction { language="java" title="高级 Node 示例:带配置的 AI Node" > -{`import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.action.NodeActionWithConfig; +{`import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.action.NodeActionWithConfig; import org.springframework.ai.chat.client.ChatClient; import org.springframework.ai.chat.prompt.PromptTemplate; @@ -169,8 +169,8 @@ public class QueryExpanderNode implements NodeActionWithConfig { language="java" title="条件评估 Node 示例" > -{`import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.action.NodeAction; +{`import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.action.NodeAction; import java.util.HashMap; import java.util.Map; @@ -208,8 +208,8 @@ public class ConditionEvaluatorNode implements NodeAction { language="java" title="并行结果聚合 Node 示例" > -{`import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.action.NodeAction; +{`import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.action.NodeAction; import java.util.*; @@ -247,18 +247,18 @@ public class ParallelResultAggregatorNode implements NodeAction { language="java" title="集成自定义 Node 到 StateGraph 示例" > -{`import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; -import static io.github.agentic.spring.ai.graph.action.AsyncEdgeAction.edge_async; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.action.AsyncEdgeAction.edge_async; @Configuration public class WorkflowConfiguration { @@ -361,14 +361,14 @@ public class WorkflowConfiguration { language="java" title="ReactAgent 作为 SubGraph Node 示例" > -{`import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; -import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.NodeOutput; -import io.github.agentic.spring.ai.graph.streaming.StreamingOutput; +{`import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; +import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.NodeOutput; +import io.github.agentic.ai.graph.streaming.StreamingOutput; import org.springframework.ai.chat.model.ChatModel; import java.util.HashMap; @@ -453,14 +453,14 @@ public class AgentWorkflowExample { language="java" title="多 Agent 协作工作流示例" > -{`import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.NodeOutput; -import io.github.agentic.spring.ai.graph.streaming.StreamingOutput; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.NodeOutput; +import io.github.agentic.ai.graph.streaming.StreamingOutput; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import org.springframework.ai.chat.model.ChatModel; import org.springframework.ai.tool.ToolCallback; import org.springframework.ai.tool.function.FunctionToolCallback; @@ -562,24 +562,24 @@ public class MultiAgentWorkflow { language="java" title="Agent Node 与普通 Node 混合使用示例" > -{`import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.NodeOutput; -import io.github.agentic.spring.ai.graph.streaming.StreamingOutput; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.NodeOutput; +import io.github.agentic.ai.graph.streaming.StreamingOutput; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import org.springframework.ai.chat.model.ChatModel; import org.springframework.ai.chat.messages.Message; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; -import static io.github.agentic.spring.ai.graph.action.AsyncEdgeAction.edge_async; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.action.AsyncEdgeAction.edge_async; public class HybridWorkflow { @@ -670,7 +670,7 @@ public class HybridWorkflow { ### 执行工作流 -Agentic AI Graph 支持两种执行方式: +ARGI Graph 支持两种执行方式: 1. **流式执行**:使用 `compiledGraph.stream()` 方法,实时获取每个节点的输出,适合需要实时反馈的场景 2. **同步执行**:使用 `compiledGraph.invoke()` 方法,等待整个工作流执行完成后返回最终结果 @@ -681,10 +681,10 @@ Agentic AI Graph 支持两种执行方式: language="java" title="流式执行工作流示例" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.NodeOutput; -import io.github.agentic.spring.ai.graph.streaming.StreamingOutput; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.NodeOutput; +import io.github.agentic.ai.graph.streaming.StreamingOutput; import java.util.Map; @@ -716,21 +716,21 @@ System.out.println("最终结果: " + lastOutput.state().data());`} language="java" title="同步执行工作流示例" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; -import io.github.agentic.spring.ai.graph.action.NodeAction; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; +import io.github.agentic.ai.graph.action.NodeAction; import java.util.HashMap; import java.util.Map; import java.util.Optional; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; public class WorkflowExecutor { @@ -849,38 +849,38 @@ workflow.addEdge("aggregator", StateGraph.END);`} ## 与Dify低代码平台集成 -使用 Agentic AI Admin 平台,可以实现 Dify DSL 到 Agentic AI 高代码工程的导出。 +使用 ARGI Admin 平台,可以实现 Dify DSL 到 ARGI 高代码工程的导出。 ### 压测数据 #### 压测集群规格 -1. Agentic AI 工程,独立部署的容器,保持默认线程池等配置参数,2个POD,POD 规格 2C4G +1. ARGI 工程,独立部署的容器,保持默认线程池等配置参数,2个POD,POD 规格 2C4G 2. Dify 平台,官方部署方式,保持默认配置参数,每个组件都拉起2个POD,POD 规格 2C4G #### 有效并发处理上限 * **压测方式:** 每个场景从 10 个 RPS(Request Per Second)开始,逐步提升,直到提升 RPS 值并不能带来 TPS 提升、成功率答复下降。 -* **结论:** Dify 能处理的上限 RPS < 10;Agentic AI 能处理的上限 RPS 约 150。 +* **结论:** Dify 能处理的上限 RPS < 10;ARGI 能处理的上限 RPS 约 150。 Dify 压测截图: ![Dify DSL to Graph](/img/user/ai/practices/dify/dify-base-rps.png) -Agentic AI 压测截图: +ARGI 压测截图: -![Dify DSL to Graph](/img/user/ai/practices/dify/agentic-ai-base-rps.png) +![Dify DSL to Graph](/img/user/ai/practices/dify/argi-base-rps.png) #### 极限场景下的吞吐量 * **压测方式:** 给集群远高于合理并发的压测请求量(测试场景为 1000 RPS),看集群的吞吐量、成功率变化。 -* **结论:** Dify 在此场景下成功率小于 10%,平均 RT 接近 60s,大部分请求出现超时(响应大于 60s);Agentic AI 成功率变化不大,维持 99% 以上,平均 RT 也在 18s 左右。 +* **结论:** Dify 在此场景下成功率小于 10%,平均 RT 接近 60s,大部分请求出现超时(响应大于 60s);ARGI 成功率变化不大,维持 99% 以上,平均 RT 也在 18s 左右。 Dify 压测截图: ![Dify DSL to Graph](/img/user/ai/practices/dify/dify-extreme-rps.png) -Agentic AI 压测截图: +ARGI 压测截图: -![Dify DSL to Graph](/img/user/ai/practices/dify/agentic-ai-extreme-rps.png) +![Dify DSL to Graph](/img/user/ai/practices/dify/argi-extreme-rps.png) ## 相关资源 diff --git a/docs/frameworks/extensions/chat-memory.md b/docs/frameworks/extensions/chat-memory.md index 5ad2f75f..4fdb7d6b 100644 --- a/docs/frameworks/extensions/chat-memory.md +++ b/docs/frameworks/extensions/chat-memory.md @@ -1,7 +1,7 @@ --- title: 聊天记忆仓储 (Chat Memory) sidebar_label: 聊天记忆 -description: 深入了解 Agentic AI Extensions 聊天记忆仓储套件:Redis(支持 Lettuce/Jedis/Redisson 及集群/SSL)、JDBC(支持 MySQL/PG/Oracle/SQLServer/H2/SQLite)、MongoDB、Elasticsearch、Memcached、TableStore 与 Mem0 智能记忆层。 +description: 深入了解 ARGI Extensions 聊天记忆仓储套件:Redis(支持 Lettuce/Jedis/Redisson 及集群/SSL)、JDBC(支持 MySQL/PG/Oracle/SQLServer/H2/SQLite)、MongoDB、Elasticsearch、Memcached、TableStore 与 Mem0 智能记忆层。 keywords: [Extensions, Chat Memory, Redis, JDBC, MySQL, PostgreSQL, MongoDB, Elasticsearch, Memcached, TableStore, Mem0, 聊天记忆] --- @@ -9,7 +9,7 @@ keywords: [Extensions, Chat Memory, Redis, JDBC, MySQL, PostgreSQL, MongoDB, Ela 在多轮会话交互中,大语言模型本身是无状态的,需要外部存储机制保存并提供对话历史上下文。 -Agentic AI Extensions 提供了基于 Spring AI `ChatMemoryRepository` 接口的企业级聊天记忆仓储实现体系。 +ARGI Extensions 提供了基于 Spring AI `ChatMemoryRepository` 接口的企业级聊天记忆仓储实现体系。 :::tip 关键架构概念区分 - **Spring AI `ChatMemoryRepository`**(本项目):面向用户与模型的多轮对话消息(`Message`、`UserMessage`、`AssistantMessage`)流水持久化。 @@ -23,14 +23,14 @@ Agentic AI Extensions 提供了基于 Spring AI `ChatMemoryRepository` 接口的 | 存储介质 | 对应 Starter 坐标 | 特性与底层支持 | | --- | --- | --- | -| **基础配置** | `agentic-ai-starter-model-chat-memory` | 统一的会话记忆抽象与配置属性模型 | -| **Redis** | `agentic-ai-starter-model-chat-memory-repository-redis` | 支持 **Lettuce**、**Jedis**、**Redisson** 三种驱动;支持单机与集群;支持 SSL 加密通信 | -| **JDBC** | `agentic-ai-starter-model-chat-memory-repository-jdbc` | 复用 Spring Boot 标准 `DataSource`/`JdbcTemplate`,内置 **MySQL**、**PostgreSQL**、**Oracle**、**SQL Server**、**H2**、**SQLite** 6 种方言适配 | -| **MongoDB** | `agentic-ai-starter-model-chat-memory-repository-mongodb` | 基于 Mongo 驱动原生连接与持久化,天然适配灵活消息元数据 | -| **Elasticsearch**| `agentic-ai-starter-model-chat-memory-repository-elasticsearch`| 基于 ElasticsearchClient,支持大规模会话的高并发检索与归档 | -| **Memcached** | `agentic-ai-starter-model-chat-memory-repository-memcached` | 高性能纯内存缓存,支持自定义序列化与过期淘汰机制 | -| **TableStore** | `agentic-ai-starter-model-chat-memory-repository-tablestore` | 阿里云表格存储(NoSQL),分表管理会话与消息索引,高并发与低成本存储 | -| **Mem0 智能记忆**| `agentic-ai-starter-model-chat-memory-mem0` | 集成 Mem0 智能记忆平台,提供记忆抽取、向量图谱检索与跨会话用户偏好注入 | +| **基础配置** | `argi-starter-model-chat-memory` | 统一的会话记忆抽象与配置属性模型 | +| **Redis** | `argi-starter-model-chat-memory-repository-redis` | 支持 **Lettuce**、**Jedis**、**Redisson** 三种驱动;支持单机与集群;支持 SSL 加密通信 | +| **JDBC** | `argi-starter-model-chat-memory-repository-jdbc` | 复用 Spring Boot 标准 `DataSource`/`JdbcTemplate`,内置 **MySQL**、**PostgreSQL**、**Oracle**、**SQL Server**、**H2**、**SQLite** 6 种方言适配 | +| **MongoDB** | `argi-starter-model-chat-memory-repository-mongodb` | 基于 Mongo 驱动原生连接与持久化,天然适配灵活消息元数据 | +| **Elasticsearch**| `argi-starter-model-chat-memory-repository-elasticsearch`| 基于 ElasticsearchClient,支持大规模会话的高并发检索与归档 | +| **Memcached** | `argi-starter-model-chat-memory-repository-memcached` | 高性能纯内存缓存,支持自定义序列化与过期淘汰机制 | +| **TableStore** | `argi-starter-model-chat-memory-repository-tablestore` | 阿里云表格存储(NoSQL),分表管理会话与消息索引,高并发与低成本存储 | +| **Mem0 智能记忆**| `argi-starter-model-chat-memory-mem0` | 集成 Mem0 智能记忆平台,提供记忆抽取、向量图谱检索与跨会话用户偏好注入 | --- @@ -41,48 +41,46 @@ Agentic AI Extensions 提供了基于 Spring AI `ChatMemoryRepository` 接口的 ```xml io.github.agentic-ai - agentic-ai-starter-model-chat-memory-repository-redis + argi-starter-model-chat-memory-repository-redis ``` ### 单机模式(Lettuce 驱动示例) ```yaml -spring: - ai: - chat: - memory: - repository: - redis: - enabled: true - client-type: lettuce # 可选: lettuce / jedis / redisson - mode: standalone # 可选: standalone / cluster - host: ${REDIS_HOST:localhost} - port: ${REDIS_PORT:6379} - database: 0 - password: ${REDIS_PASSWORD:} - timeout: 2000 - key-prefix: "agentic:chat:" +argi: + chat: + memory: + repository: + redis: + enabled: true + client-type: lettuce # 可选: lettuce / jedis / redisson + mode: standalone # 可选: standalone / cluster + host: ${REDIS_HOST:localhost} + port: ${REDIS_PORT:6379} + database: 0 + password: ${REDIS_PASSWORD:} + timeout: 2000 + key-prefix: "agentic:chat:" ``` ### 集群模式与 SSL 加密 ```yaml -spring: - ai: - chat: - memory: - repository: - redis: +argi: + chat: + memory: + repository: + redis: + enabled: true + client-type: redisson + mode: cluster + cluster: + nodes: + - 192.168.1.10:6379 + - 192.168.1.11:6379 + - 192.168.1.12:6379 + max-redirects: 5 + ssl: enabled: true - client-type: redisson - mode: cluster - cluster: - nodes: - - 192.168.1.10:6379 - - 192.168.1.11:6379 - - 192.168.1.12:6379 - max-redirects: 5 - ssl: - enabled: true ``` --- @@ -95,7 +93,7 @@ JDBC 仓储直接复用 Spring Boot 标准的 `DataSource` 和 `JdbcTemplate`, io.github.agentic-ai - agentic-ai-starter-model-chat-memory-repository-jdbc + argi-starter-model-chat-memory-repository-jdbc @@ -117,14 +115,14 @@ spring: username: root password: secret driver-class-name: com.mysql.cj.jdbc.Driver - ai: - chat: - memory: - repository: - # 支持 mysql / postgresql / oracle / sqlserver / h2 / sqlite - mysql: - enabled: true - initialize-schema: true # 首次启动是否自动初始化记忆表结构 +argi: + chat: + memory: + repository: + # 支持 mysql / postgresql / oracle / sqlserver / h2 / sqlite + mysql: + enabled: true + initialize-schema: true # 首次启动是否自动初始化记忆表结构 ``` --- @@ -132,19 +130,18 @@ spring: ## 3. MongoDB 仓储 ```yaml -spring: - ai: - chat: - memory: - repository: - mongodb: - enabled: true - host: 127.0.0.1 - port: 27017 - user-name: root - password: secret - auth-database-name: admin - database-name: spring_ai +argi: + chat: + memory: + repository: + mongodb: + enabled: true + host: 127.0.0.1 + port: 27017 + user-name: root + password: secret + auth-database-name: admin + database-name: spring_ai ``` --- @@ -152,19 +149,18 @@ spring: ## 4. Elasticsearch 仓储 ```yaml -spring: - ai: - chat: - memory: - repository: - elasticsearch: - enabled: true - host: localhost - port: 9200 - index: chat_memory_index - query-field: content - max-results: 20 - scheme: http +argi: + chat: + memory: + repository: + elasticsearch: + enabled: true + host: localhost + port: 9200 + index: chat_memory_index + query-field: content + max-results: 20 + scheme: http ``` --- @@ -174,21 +170,20 @@ spring: 阿里云 TableStore 采用会话主表与消息从表分离架构,并支持二级索引加速: ```yaml -spring: - ai: - chat: - memory: - repository: - tablestore: - enabled: true - endpoint: https://your-instance.cn-hangzhou.ots.aliyuncs.com - instance-name: your-instance - access-key-id: ${OTS_AK} - access-key-secret: ${OTS_SK} - session-table-name: session - session-secondary-index-name: session_secondary_index - message-table-name: message - message-secondary-index-name: message_secondary_index +argi: + chat: + memory: + repository: + tablestore: + enabled: true + endpoint: https://your-instance.cn-hangzhou.ots.aliyuncs.com + instance-name: your-instance + access-key-id: ${OTS_AK} + access-key-secret: ${OTS_SK} + session-table-name: session + session-secondary-index-name: session_secondary_index + message-table-name: message + message-secondary-index-name: message_secondary_index ``` --- @@ -200,32 +195,31 @@ Mem0 不仅存储会话字符串,还能从对话中提取出用户的个人偏 ```xml io.github.agentic-ai - agentic-ai-starter-model-chat-memory-mem0 + argi-starter-model-chat-memory-mem0 ``` ```yaml -spring: - ai: - chat: - memory: - mem0: - client: - base-url: http://localhost:8888 - timeout-seconds: 30 - enable-cache: true - max-retry-attempts: 3 - async: - enabled: true - core-pool-size: 2 - max-pool-size: 4 - server: - version: "v1.1" - llm: - provider: openai - config: - api-key: ${OPENAI_API_KEY} - model: gpt-4.1-mini +argi: + chat: + memory: + mem0: + client: + base-url: http://localhost:8888 + timeout-seconds: 30 + enable-cache: true + max-retry-attempts: 3 + async: + enabled: true + core-pool-size: 2 + max-pool-size: 4 + server: + version: "v1.1" + llm: + provider: openai + config: + api-key: ${OPENAI_API_KEY} + model: gpt-4.1-mini ``` --- @@ -235,9 +229,9 @@ spring: 在生产应用中,推荐将 `ChatMemory` 与 Graph Core 的 `RedisSaver` 一同使用: ```java -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.agent.ReactAgent; -import io.github.agentic.spring.ai.graph.checkpoint.savers.redis.RedisSaver; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.checkpoint.savers.redis.RedisSaver; // 1. RedisSaver 负责持久化 Agent 决策循环与图节点状态 ReactAgent agent = ReactAgent.builder() diff --git a/docs/frameworks/extensions/mcp-gateway.md b/docs/frameworks/extensions/mcp-gateway.md index ff47581d..6cd032f6 100644 --- a/docs/frameworks/extensions/mcp-gateway.md +++ b/docs/frameworks/extensions/mcp-gateway.md @@ -1,7 +1,7 @@ --- title: MCP 服务网关 (Gateway) sidebar_label: MCP 网关 -description: 深入了解 Agentic AI MCP Gateway:统一流量入口、多 Server 聚合代理、WebFlux/WebMvc 双栈支持、OAuth 2.0 认证与 JSON 响应模板转换。 +description: 深入了解 ARGI MCP Gateway:统一流量入口、多 Server 聚合代理、WebFlux/WebMvc 双栈支持、OAuth 2.0 认证与 JSON 响应模板转换。 keywords: [Extensions, MCP Gateway, 网关, OAuth2, WebFlux, WebMvc, MultiServer, Nacos] --- @@ -9,7 +9,7 @@ keywords: [Extensions, MCP Gateway, 网关, OAuth2, WebFlux, WebMvc, MultiServer 随着企业内模型与工具服务数量的快速增长,直接让每个智能体与散落各处的后端 MCP Server 直连会导致拓扑混乱、鉴权分散、安全不可控等问题。 -**`agentic-ai-starter-mcp-gateway`** 提供了统一的企业级 MCP 流量入口网关,承担工具聚合、权限校验、多后端代理和数据转换等职责。 +**`argi-starter-mcp-gateway`** 提供了统一的企业级 MCP 流量入口网关,承担工具聚合、权限校验、多后端代理和数据转换等职责。 --- @@ -42,7 +42,7 @@ keywords: [Extensions, MCP Gateway, 网关, OAuth2, WebFlux, WebMvc, MultiServer ```xml io.github.agentic-ai - agentic-ai-starter-mcp-gateway + argi-starter-mcp-gateway ``` @@ -51,34 +51,32 @@ keywords: [Extensions, MCP Gateway, 网关, OAuth2, WebFlux, WebMvc, MultiServer 在 `application.yml` 中声明网关属性及多个后端的聚合代理: ```yaml -spring: - ai: - alibaba: - mcp: - gateway: - enabled: false # 单实例默认网关关闭,启用 multi-server 模式 - tool-timeout: 30s - webclient-connector: default - multi-server: - enabled: true - servers: - - name: finance-server - transport: SSE - sse-endpoint: /mcp/finance/sse - message-endpoint: /mcp/finance/message - server-name: mcp-gateway-finance - server-version: 1.0.0 - service-names: - - nacos-mcp-invoice-service - - nacos-mcp-tax-service - - name: operation-server - transport: STREAMABLE - mcp-endpoint: /mcp/ops/mcp - server-name: mcp-gateway-ops - server-version: 1.0.0 - service-names: - - nacos-mcp-log-service - - nacos-mcp-deploy-service +argi: + mcp: + gateway: + enabled: false # 单实例默认网关关闭,启用 multi-server 模式 + tool-timeout: 30s + webclient-connector: default + multi-server: + enabled: true + servers: + - name: finance-server + transport: SSE + sse-endpoint: /mcp/finance/sse + message-endpoint: /mcp/finance/message + server-name: mcp-gateway-finance + server-version: 1.0.0 + service-names: + - nacos-mcp-invoice-service + - nacos-mcp-tax-service + - name: operation-server + transport: STREAMABLE + mcp-endpoint: /mcp/ops/mcp + server-name: mcp-gateway-ops + server-version: 1.0.0 + service-names: + - nacos-mcp-log-service + - nacos-mcp-deploy-service ``` --- @@ -88,27 +86,25 @@ spring: 如果网关上游或后端 MCP Server 受到 OAuth 保护,网关可自动完成凭证获取与请求签名: ```yaml -spring: - ai: - alibaba: - mcp: - gateway: - oauth: - enabled: true - provider: - client-id: ${MCP_CLIENT_ID} - client-secret: ${MCP_CLIENT_SECRET} - token-uri: https://auth.company.com/oauth2/token - authorization-uri: https://auth.company.com/oauth2/authorize - scope: "read,write" - grant-type: client_credentials - token-cache: - enabled: true - refresh-before-expiry: 5m - max-size: 1000 - retry: - max-attempts: 3 - backoff: 1s +argi: + mcp: + gateway: + oauth: + enabled: true + provider: + client-id: ${MCP_CLIENT_ID} + client-secret: ${MCP_CLIENT_SECRET} + token-uri: https://auth.company.com/oauth2/token + authorization-uri: https://auth.company.com/oauth2/authorize + scope: "read,write" + grant-type: client_credentials + token-cache: + enabled: true + refresh-before-expiry: 5m + max-size: 1000 + retry: + max-attempts: 3 + backoff: 1s ``` `McpGatewayOAuthTokenManager` 将在发起 HTTP 请求时通过拦截器自动加上 `Authorization: Bearer ` 请求头。 @@ -117,7 +113,7 @@ spring: ## 核心配置属性清单 -### `spring.ai.alibaba.mcp.gateway` +### `argi.mcp.gateway` | 配置项 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `enabled` | Boolean | `true` | 是否启用单实例网关 | @@ -132,7 +128,7 @@ spring: | `streamable.enabled` | Boolean | `false` | 是否启用 Streamable HTTP 模式 | | `streamable.mcp-endpoint` | String | `/mcp` | Streamable 统一定义端点 | -### `spring.ai.alibaba.mcp.gateway.multi-server` +### `argi.mcp.gateway.multi-server` | 配置项 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `enabled` | Boolean | `false` | 是否开启 Multi-Server 模式 | @@ -144,7 +140,7 @@ spring: | `servers[].server-name` | String | - | 暴露出的 MCP 服务名 | | `servers[].service-names` | List | - | 从 Nacos 订阅并聚合的微服务列表 | -### `spring.ai.alibaba.mcp.gateway.oauth` +### `argi.mcp.gateway.oauth` | 配置项 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `enabled` | Boolean | `false` | 是否启用 OAuth 2.0 鉴权 | diff --git a/docs/frameworks/extensions/mcp-router.md b/docs/frameworks/extensions/mcp-router.md index ccf9cb4d..3c0c3153 100644 --- a/docs/frameworks/extensions/mcp-router.md +++ b/docs/frameworks/extensions/mcp-router.md @@ -1,7 +1,7 @@ --- title: MCP 智能路由与服务管理 (Router) sidebar_label: MCP 路由 -description: 了解 Agentic AI MCP Router:基于向量存储的 MCP Server 语义搜索、Nacos/DB/File 三重服务发现、定时监控 Watcher 与智能请求代理。 +description: 了解 ARGI MCP Router:基于向量存储的 MCP Server 语义搜索、Nacos/DB/File 三重服务发现、定时监控 Watcher 与智能请求代理。 keywords: [Extensions, MCP Router, 语义搜索, 向量存储, 服务代理, 服务发现, 动态路由] --- @@ -9,7 +9,7 @@ keywords: [Extensions, MCP Router, 语义搜索, 向量存储, 服务代理, 服 在包含几十乃至上百个 MCP Server 的大规模智能体应用集群中,如果将所有 Server 里的所有工具无差别全部注入给大模型,会导致严重的上下文膨胀、工具选错(Tool Selection Failure)以及单次请求 Token 暴增。 -**`agentic-ai-starter-mcp-router`** 提供了**语义感知型智能路由**:根据用户任务的目标语义,在大规模 MCP Server 注册表中精准召回最契合的 Server 与工具子集,并提供统一的反向代理转发。 +**`argi-starter-mcp-router`** 提供了**语义感知型智能路由**:根据用户任务的目标语义,在大规模 MCP Server 注册表中精准召回最契合的 Server 与工具子集,并提供统一的反向代理转发。 --- @@ -63,7 +63,7 @@ keywords: [Extensions, MCP Router, 语义搜索, 向量存储, 服务代理, 服 io.github.agentic-ai - agentic-ai-starter-mcp-router + argi-starter-mcp-router @@ -82,23 +82,23 @@ spring: ai: openai: api-key: ${OPENAI_API_KEY} - alibaba: - mcp: - nacos: - server-addr: 127.0.0.1:8848 - namespace: public - router: - enabled: true - # 发现顺序:按优先级排列 - discovery-order: - - nacos - - database - - file - # 由 Watcher 定时监听同步的 MCP 服务列表 - service-names: - - mcp-weather-service - - mcp-stock-service - - mcp-payment-service +argi: + mcp: + nacos: + server-addr: 127.0.0.1:8848 + namespace: public + router: + enabled: true + # 发现顺序:按优先级排列 + discovery-order: + - nacos + - database + - file + # 由 Watcher 定时监听同步的 MCP 服务列表 + service-names: + - mcp-weather-service + - mcp-stock-service + - mcp-payment-service ``` ### 3. 配置数据库服务发现源(可选) @@ -106,21 +106,19 @@ spring: 若希望通过数据库集中维护各团队注册的 MCP Server 拓扑: ```yaml -spring: - ai: - alibaba: - mcp: - router: - database: - enabled: true - url: jdbc:mysql://localhost:3306/mcp_registry - username: root - password: secret - driver-class-name: com.mysql.cj.jdbc.Driver - table-name: mcp_server_info - max-pool-size: 10 - min-idle: 2 - connection-timeout: 30000 +argi: + mcp: + router: + database: + enabled: true + url: jdbc:mysql://localhost:3306/mcp_registry + username: root + password: secret + driver-class-name: com.mysql.cj.jdbc.Driver + table-name: mcp_server_info + max-pool-size: 10 + min-idle: 2 + connection-timeout: 30000 ``` --- @@ -130,7 +128,7 @@ spring: 由于 Starter 已将 `routerTools` 注册为 `ToolCallbackProvider`,你可以直接将其绑定给 Agent: ```java -import io.github.agentic.spring.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.chat.model.ChatModel; import org.springframework.ai.tool.ToolCallbackProvider; import org.springframework.beans.factory.annotation.Qualifier; @@ -169,7 +167,7 @@ public class MetaRouterAgentService { ## 配置属性参考 -### `spring.ai.alibaba.mcp.router` +### `argi.mcp.router` | 配置项 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `enabled` | Boolean | `true` | 是否启用 MCP Router 自动装配 | @@ -177,7 +175,7 @@ public class MetaRouterAgentService { | `discovery-order` | List | `["nacos"]` | 服务发现源查找优先级(支持 `nacos`、`database`、`file`) | | `services` | List | `[]` | 静态声明的文件型 MCP Server 清单 | -### `spring.ai.alibaba.mcp.router.database` +### `argi.mcp.router.database` | 配置项 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `enabled` | Boolean | `false` | 是否开启数据库服务发现 | diff --git a/docs/frameworks/extensions/mcp.md b/docs/frameworks/extensions/mcp.md index 831ce02c..66ecd5f9 100644 --- a/docs/frameworks/extensions/mcp.md +++ b/docs/frameworks/extensions/mcp.md @@ -9,9 +9,9 @@ keywords: [Extensions, MCP, Model Context Protocol, Nacos, ToolCallbackProvider, **Model Context Protocol (MCP)** 是一种开放协议,旨在统一大语言模型(LLM)与外部数据源及工具服务之间的交互。在分布式微服务架构中,随着 MCP Server 数量的增长,静态配置每个 Server 的网络地址与端口已无法满足敏捷运维需求。 -Agentic AI Extensions 提供了基于 **Nacos** 的 MCP 自动化服务注册与分布式发现套件: -- **`agentic-ai-starter-mcp-distributed`**:面向客户端/调用方,动态从 Nacos 发现远程 MCP Server,并暴露为 Spring AI 标准的 `ToolCallbackProvider`。 -- **`agentic-ai-starter-mcp-registry`**:面向 MCP Server 提供方,自动将本地工具服务及其 JSON Schema 注册至 Nacos。 +ARGI Extensions 提供了基于 **Nacos** 的 MCP 自动化服务注册与分布式发现套件: +- **`argi-starter-mcp-distributed`**:面向客户端/调用方,动态从 Nacos 发现远程 MCP Server,并暴露为 Spring AI 标准的 `ToolCallbackProvider`。 +- **`argi-starter-mcp-registry`**:面向 MCP Server 提供方,自动将本地工具服务及其 JSON Schema 注册至 Nacos。 --- @@ -36,7 +36,7 @@ Agentic AI Extensions 提供了基于 **Nacos** 的 MCP 自动化服务注册与 io.github.agentic-ai - agentic-ai-starter-mcp-distributed + argi-starter-mcp-distributed @@ -56,28 +56,28 @@ spring: mcp: client: type: async # 可选 sync / async - alibaba: - mcp: - nacos: - server-addr: ${NACOS_SERVER_ADDR:127.0.0.1:8848} - namespace: ${NACOS_NAMESPACE:public} - username: ${NACOS_USERNAME:} - password: ${NACOS_PASSWORD:} - client: - enabled: true - lazy-init: false - # SSE 协议服务列表 - sse: - connections: - train-service: - service-name: mcp-train-service - version: 1.0.0 - # Streamable HTTP 协议服务列表 - streamable: - connections: - map-service: - service-name: mcp-map-service - version: 1.0.0 +argi: + mcp: + nacos: + server-addr: ${NACOS_SERVER_ADDR:127.0.0.1:8848} + namespace: ${NACOS_NAMESPACE:public} + username: ${NACOS_USERNAME:} + password: ${NACOS_PASSWORD:} + client: + enabled: true + lazy-init: false + # SSE 协议服务列表 + sse: + connections: + train-service: + service-name: mcp-train-service + version: 1.0.0 + # Streamable HTTP 协议服务列表 + streamable: + connections: + map-service: + service-name: mcp-map-service + version: 1.0.0 ``` ### 3. 在 ReAct Agent 中直接使用发现到的远程工具 @@ -85,7 +85,7 @@ spring: Starter 会根据 Nacos 中注册的 MCP Server 元数据自动生成 Spring AI `ToolCallbackProvider` Bean。你可以将其直接注入到 `ReactAgent` 中: ```java -import io.github.agentic.spring.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.chat.messages.AssistantMessage; import org.springframework.ai.chat.model.ChatModel; import org.springframework.ai.tool.ToolCallbackProvider; @@ -120,36 +120,34 @@ public class RemoteMcpAgentService { ## 场景二:MCP Server 自动注册(Server 端) -如果你正在开发一个 MCP Server,希望对外发布工具并自动登记到 Nacos 供其他智能体调用,可使用 `agentic-ai-starter-mcp-registry`。 +如果你正在开发一个 MCP Server,希望对外发布工具并自动登记到 Nacos 供其他智能体调用,可使用 `argi-starter-mcp-registry`。 ### 1. 引入 Starter ```xml io.github.agentic-ai - agentic-ai-starter-mcp-registry + argi-starter-mcp-registry ``` ### 2. 配置注册信息 ```yaml -spring: - ai: - alibaba: - mcp: - nacos: - server-addr: 127.0.0.1:8848 - namespace: public - register: - enabled: true # 开启自动注册条件 - service-register: true # 启用注册行为 - service-ephemeral: true # 注册为临时实例 - service-name: mcp-calculator-service - service-group: DEFAULT_GROUP - port: 8080 - host: 127.0.0.1 # 可选,默认读取本地 IP 或 NACOS_MCP_SERVER_HOST 环境变量 - sse-export-context-path: /mcp +argi: + mcp: + nacos: + server-addr: 127.0.0.1:8848 + namespace: public + register: + enabled: true # 开启自动注册条件 + service-register: true # 启用注册行为 + service-ephemeral: true # 注册为临时实例 + service-name: mcp-calculator-service + service-group: DEFAULT_GROUP + port: 8080 + host: 127.0.0.1 # 可选,默认读取本地 IP 或 NACOS_MCP_SERVER_HOST 环境变量 + sse-export-context-path: /mcp ``` ### 3. 核心机制 @@ -164,7 +162,7 @@ spring: ## 配置属性参考 -### `spring.ai.alibaba.mcp.nacos` +### `argi.mcp.nacos` | 参数项 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `server-addr` | String | `127.0.0.1:8848` | Nacos 服务器连接地址 | @@ -172,7 +170,7 @@ spring: | `username` | String | 空 | Nacos 认证用户名 | | `password` | String | 空 | Nacos 认证密码 | -### `spring.ai.alibaba.mcp.nacos.client` +### `argi.mcp.nacos.client` | 参数项 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `enabled` | Boolean | `true` | 是否启用 MCP 客户端发现功能 | @@ -182,7 +180,7 @@ spring: | `streamable.connections..service-name` | String | - | 监听的 Streamable 服务名 | | `streamable.connections..version` | String | - | 监听的 Streamable 服务版本 | -### `spring.ai.alibaba.mcp.nacos.register` +### `argi.mcp.nacos.register` | 参数项 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `enabled` | Boolean | `false` | 自动装配总开关(需显式置为 `true` 生效) | diff --git a/docs/frameworks/extensions/nacos-prompt.md b/docs/frameworks/extensions/nacos-prompt.md index cd9de31e..9cffdc5c 100644 --- a/docs/frameworks/extensions/nacos-prompt.md +++ b/docs/frameworks/extensions/nacos-prompt.md @@ -9,7 +9,7 @@ keywords: [Extensions, Nacos Prompt, Prompt Template, 提示词管理, 热更新 在传统的 LLM 应用开发中,系统提示词(System Prompt)和指令模板通常硬编码在 Java 代码中或写在静态资源文件里。一旦需要调优提示词、修复边界 Bad Case 或针对线上节日活动临时变更,通常需要重新编译、打包并灰度发布整个应用,运维成本极高。 -**`agentic-ai-starter-nacos-prompt`** 提供了基于 **Nacos 配置中心**的 Prompt 模板动态管理与热更新能力,允许运营与算法工程师在 Nacos 控制台上实时调整提示词,应用秒级生效,无需重启任何服务。 +**`argi-starter-nacos-prompt`** 提供了基于 **Nacos 配置中心**的 Prompt 模板动态管理与热更新能力,允许运营与算法工程师在 Nacos 控制台上实时调整提示词,应用秒级生效,无需重启任何服务。 --- @@ -18,7 +18,7 @@ keywords: [Extensions, Nacos Prompt, Prompt Template, 提示词管理, 热更新 ``` ┌─────────────────────────────────┐ │ Nacos 配置中心 (控制台) │ -│ DataId: spring.ai.alibaba. │ +│ DataId: argi. │ │ configurable.prompt │ └────────────────┬────────────────┘ │ (配置发布 / 变更推送) @@ -38,7 +38,7 @@ keywords: [Extensions, Nacos Prompt, Prompt Template, 提示词管理, 热更新 ``` 1. **统一模板工厂(`ConfigurablePromptTemplateFactory`)**:在应用启动时加载默认模板或本地资源模板(`.st` 格式)。 -2. **Nacos 监听器机制**:工厂内部通过 `@NacosConfigListener` 持续监听指定的 Nacos 配置集(默认 Data ID 为 `spring.ai.alibaba.configurable.prompt`,Group 为 `DEFAULT_GROUP`)。 +2. **Nacos 监听器机制**:工厂内部通过 `@NacosConfigListener` 持续监听指定的 Nacos 配置集(默认 Data ID 为 `argi.configurable.prompt`,Group 为 `DEFAULT_GROUP`)。 3. **零停机无缝切换**:当 Nacos 配置被发布时,工厂自动解析最新配置模型列表并刷新内部 `ConcurrentHashMap`,所有正在执行或后续发起的智能体请求将立即读取最新渲染模板。 --- @@ -50,7 +50,7 @@ keywords: [Extensions, Nacos Prompt, Prompt Template, 提示词管理, 热更新 ```xml io.github.agentic-ai - agentic-ai-starter-nacos-prompt + argi-starter-nacos-prompt ``` @@ -59,12 +59,11 @@ keywords: [Extensions, Nacos Prompt, Prompt Template, 提示词管理, 热更新 在 `application.yml` 中开启 Nacos Prompt 自动配置并配置 Nacos 连接信息: ```yaml -spring: - ai: - nacos: - prompt: - template: - enabled: true # 必须置为 true 以激活自动装配 +argi: + nacos: + prompt: + template: + enabled: true # 必须置为 true 以激活自动装配 ``` --- @@ -72,7 +71,7 @@ spring: ## 3. Nacos 端配置格式规范 在 Nacos 控制台中,创建如下配置项: -- **Data ID**:`spring.ai.alibaba.configurable.prompt` +- **Data ID**:`argi.configurable.prompt` - **Group**:`DEFAULT_GROUP` - **配置格式**:`JSON` @@ -102,9 +101,9 @@ spring: 你可以直接通过 Spring 容器注入的 `ConfigurablePromptTemplateFactory` 获取模板并渲染: ```java -import io.github.agentic.spring.ai.prompt.ConfigurablePromptTemplate; -import io.github.agentic.spring.ai.prompt.ConfigurablePromptTemplateFactory; -import io.github.agentic.spring.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.prompt.ConfigurablePromptTemplate; +import io.github.agentic.ai.prompt.ConfigurablePromptTemplateFactory; +import io.github.agentic.ai.graph.agent.ReactAgent; import org.springframework.ai.chat.model.ChatModel; import org.springframework.stereotype.Service; @@ -152,7 +151,7 @@ public class DynamicAgentService { 模块提供了 `PromptTemplateCustomizer` 与 `PromptTemplateBuilderConfigure` 函数式接口。开发者可在 Spring 容器中声明自定义 Bean,在模板创建前后插入全局切面逻辑,例如注入全局租户环境变量或接入安全脱敏预检: ```java -import io.github.agentic.spring.ai.prompt.PromptTemplateCustomizer; +import io.github.agentic.ai.prompt.PromptTemplateCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/docs/frameworks/extensions/observation.md b/docs/frameworks/extensions/observation.md index 0a17dc29..4a9a168b 100644 --- a/docs/frameworks/extensions/observation.md +++ b/docs/frameworks/extensions/observation.md @@ -1,7 +1,7 @@ --- title: 应用可观测性与 ARMS 集成 (Observation) sidebar_label: 应用可观测性 -description: 了解 Agentic AI Extensions 可观测性套件:阿里云 ARMS 监控无缝集成、OpenTelemetry 与 Langfuse 双模支持、LLM 输入输出合规采集与工具调用精细化指标。 +description: 了解 ARGI Extensions 可观测性套件:阿里云 ARMS 监控无缝集成、OpenTelemetry 与 Langfuse 双模支持、LLM 输入输出合规采集与工具调用精细化指标。 keywords: [Extensions, Observation, ARMS, OpenTelemetry, Langfuse, Micrometer, 可观测性, 链路追踪, 指标监控] --- @@ -9,7 +9,7 @@ keywords: [Extensions, Observation, ARMS, OpenTelemetry, Langfuse, Micrometer, AI 智能体应用具有高度不确定性、多轮循环决策以及复杂的工具调用拓扑。当线上出现回答延迟大、死循环或工具执行失败时,传统的以 HTTP 接口为核心的监控往往只能看到总体耗时,无法透视智能体内部的思维链(Reasoning Chain)、单次 LLM 推理延迟与各个工具调用的执行状态。 -**`agentic-ai-starter-arms-observation`** 为 Spring AI 与 Agentic AI 提供了面向**阿里云 ARMS(应用实时监控服务)**与 **OpenTelemetry** 标准生态的全链路可观测性扩展。 +**`argi-starter-arms-observation`** 为 Spring AI 与 ARGI 提供了面向**阿里云 ARMS(应用实时监控服务)**与 **OpenTelemetry** 标准生态的全链路可观测性扩展。 --- @@ -38,7 +38,7 @@ AI 智能体应用具有高度不确定性、多轮循环决策以及复杂的 ```xml io.github.agentic-ai - agentic-ai-starter-arms-observation + argi-starter-arms-observation ``` @@ -47,21 +47,19 @@ AI 智能体应用具有高度不确定性、多轮循环决策以及复杂的 在 `application.yml` 中开启 ARMS 监控并配置采集策略: ```yaml -spring: - ai: - alibaba: - arms: - enabled: true - # 工具调用度量与拦截管理 - tool: - enabled: true - # 大模型调用观测与追踪 - model: - enabled: true - message-mode: OPEN_TELEMETRY # 可选: OPEN_TELEMETRY / LANGFUSE - # 生产环境合规配置:是否采集原始输入与输出文本到监控链路中 - capture-input: false - capture-output: false +argi: + arms: + enabled: true + # 工具调用度量与拦截管理 + tool: + enabled: true + # 大模型调用观测与追踪 + model: + enabled: true + message-mode: OPEN_TELEMETRY # 可选: OPEN_TELEMETRY / LANGFUSE + # 生产环境合规配置:是否采集原始输入与输出文本到监控链路中 + capture-input: false + capture-output: false ``` :::warning 生产隐私与数据合规建议 @@ -76,7 +74,7 @@ spring: `ReactAgent.Builder` 原生支持注入 Micrometer `ObservationRegistry`: ```java -import io.github.agentic.spring.ai.graph.agent.ReactAgent; +import io.github.agentic.ai.graph.agent.ReactAgent; import io.micrometer.observation.ObservationRegistry; import org.springframework.stereotype.Service; @@ -105,15 +103,13 @@ public class MonitoredAgentService { ``` ### 2. 结合 Graph Core 观测 -核心图引擎本身也支持生命周期与观测扩展(对应前缀 `spring.ai.alibaba.graph.observation`): +核心图引擎本身也支持生命周期与观测扩展(对应前缀 `argi.graph.observation`): ```yaml -spring: - ai: - alibaba: - graph: - observation: - enabled: true +argi: + graph: + observation: + enabled: true ``` 图工作流中的每个节点(Node)执行和边(Edge)条件跳转都会自动产生嵌套 Span,与外部 ARMS 监控串联为一条完整的树状调用追踪链(Trace Tree)。 @@ -124,10 +120,10 @@ spring: | 配置项 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | -| `spring.ai.alibaba.arms.enabled` | Boolean | `false` | 是否全局开启 ARMS 观测增强 | -| `spring.ai.alibaba.arms.tool.enabled` | Boolean | `true` | 是否开启工具调用的性能度量与追踪(自动装配 `ObservableToolCallingManager`) | -| `spring.ai.alibaba.arms.model.enabled` | Boolean | `true` | 是否开启大模型交互观测 | -| `spring.ai.alibaba.arms.model.message-mode` | String | `OPEN_TELEMETRY` | 语义导出规范模式(`OPEN_TELEMETRY` 或 `LANGFUSE`) | -| `spring.ai.alibaba.arms.model.capture-input` | Boolean | `false` | 是否上报并记录用户输入的 Prompt 内容 | -| `spring.ai.alibaba.arms.model.capture-output` | Boolean | `false` | 是否上报并记录模型生成的回答内容 | -| `spring.ai.alibaba.graph.observation.enabled` | Boolean | `true` | 是否开启底层 Graph 节点与边流转观测 | +| `argi.arms.enabled` | Boolean | `false` | 是否全局开启 ARMS 观测增强 | +| `argi.arms.tool.enabled` | Boolean | `true` | 是否开启工具调用的性能度量与追踪(自动装配 `ObservableToolCallingManager`) | +| `argi.arms.model.enabled` | Boolean | `true` | 是否开启大模型交互观测 | +| `argi.arms.model.message-mode` | String | `OPEN_TELEMETRY` | 语义导出规范模式(`OPEN_TELEMETRY` 或 `LANGFUSE`) | +| `argi.arms.model.capture-input` | Boolean | `false` | 是否上报并记录用户输入的 Prompt 内容 | +| `argi.arms.model.capture-output` | Boolean | `false` | 是否上报并记录模型生成的回答内容 | +| `argi.graph.observation.enabled` | Boolean | `true` | 是否开启底层 Graph 节点与边流转观测 | diff --git a/docs/frameworks/extensions/overview.md b/docs/frameworks/extensions/overview.md index 2bd5a3a8..6609e9ce 100644 --- a/docs/frameworks/extensions/overview.md +++ b/docs/frameworks/extensions/overview.md @@ -1,13 +1,13 @@ --- title: Extensions 概览 sidebar_label: 概览 -description: 深入了解 Agentic AI Extensions 生态扩展组件库:统一 BOM、20 个核心 Starter 清单、配置前缀映射与架构集成指南。 +description: 深入了解 ARGI Extensions 生态扩展组件库:统一 BOM、20 个核心 Starter 清单、配置前缀映射与架构集成指南。 keywords: [Extensions, MCP, Nacos, Prompt, Memory, RAG, Vector Store, ARMS, Starter, BOM] --- # Extensions 概览 -**Agentic AI Extensions** 是面向企业级 Java AI 应用的 Spring Boot 扩展组件库。它不替代底层图引擎(`Graph Core`)与智能体抽象(`ReAct Agent`),而是作为外部系统与周边生态的“连接器”与“能力增强包”,为智能体应用补齐 MCP 协议互联、海量聊天记忆持久化、企业级向量检索、高级 RAG 检索增强、动态提示词热更新以及全链路可观测性等生产就绪能力。 +**ARGI Extensions** 是面向企业级 Java AI 应用的 Spring Boot 扩展组件库。它不替代底层图引擎(`Graph Core`)与智能体抽象(`ReAct Agent`),而是作为外部系统与周边生态的“连接器”与“能力增强包”,为智能体应用补齐 MCP 协议互联、海量聊天记忆持久化、企业级向量检索、高级 RAG 检索增强、动态提示词热更新以及全链路可观测性等生产就绪能力。 所有扩展模块均采用标准 Spring Boot Starter 与自动装配规范设计,开箱即用。 @@ -15,15 +15,15 @@ keywords: [Extensions, MCP, Nacos, Prompt, Memory, RAG, Vector Store, ARMS, Star ## 依赖管理(BOM) -为避免不同模块间的版本冲突,建议通过 `agentic-ai-extensions-bom` 统一管理所有扩展模块依赖版本: +为避免不同模块间的版本冲突,建议通过 `argi-extensions-bom` 统一管理所有扩展模块依赖版本: ```xml io.github.agentic-ai - agentic-ai-extensions-bom - ${agentic-ai-extensions.version} + argi-extensions-bom + ${argi-extensions.version} pom import @@ -41,26 +41,26 @@ Extensions 当前代码库(版本 `2.1.0-dev`)共提供 **20 个独立 Start | 生态领域 | 对应 Starter 坐标 | 核心功能与适配实现 | | --- | --- | --- | -| **MCP 生态** | `agentic-ai-starter-mcp-distributed` | 基于 Nacos 动态发现 SSE / Streamable HTTP 类型的 MCP Server,暴露为 Spring AI `ToolCallbackProvider` | -| | `agentic-ai-starter-mcp-registry` | 将本地 MCP Server 自动注册至 Nacos 注册中心,支持无状态(Stateless)注册与工具 Schema 校验 | -| | `agentic-ai-starter-mcp-gateway` | MCP 统一流量网关,支持 WebFlux/WebMvc 双栈、多 Server 聚合代理转发、OAuth 2.0 客户端认证与 JSON 模板解析 | -| | `agentic-ai-starter-mcp-router` | 基于向量存储的 MCP Server 语义搜索路由、动态服务注册、统一工具请求代理与定时 Watcher 监控 | -| **聊天记忆**
**(Chat Memory)** | `agentic-ai-starter-model-chat-memory` | 基础 Chat Memory 自动装配与通用配置模型 | -| | `agentic-ai-starter-model-chat-memory-repository-redis` | Redis 会话记忆仓储,支持 Lettuce、Jedis、Redisson 客户端,支持单机、集群与 SSL | -| | `agentic-ai-starter-model-chat-memory-repository-jdbc` | 关系型数据库通用记忆仓储,内置 MySQL、PostgreSQL、Oracle、SQL Server、H2、SQLite 方言实现 | -| | `agentic-ai-starter-model-chat-memory-repository-mongodb` | 基于 Spring Data MongoDB 的会话文档化存储 | -| | `agentic-ai-starter-model-chat-memory-repository-elasticsearch` | 基于 Elasticsearch 客户端的高并发消息仓储 | -| | `agentic-ai-starter-model-chat-memory-repository-memcached` | 高性能内存级 Memcached 聊天记忆存储 | -| | `agentic-ai-starter-model-chat-memory-repository-tablestore` | 阿里云表格存储(TableStore)高可靠 NoSQL 记忆仓储 | -| | `agentic-ai-starter-model-chat-memory-mem0` | Mem0 智能记忆层集成,提供会话与用户维度的长期记忆提取与上下文增强 | -| **向量存储**
**(Vector Store)** | `agentic-ai-starter-vector-store-analyticdb` | 阿里云 AnalyticDB for PostgreSQL / MySQL 向量检索适配器 | -| | `agentic-ai-starter-vector-store-oceanbase` | 蚂蚁集团 OceanBase 分布式数据库向量检索适配器 | -| | `agentic-ai-starter-vector-store-opensearch` | 阿里云 OpenSearch 开放搜索向量版集成 | -| | `agentic-ai-starter-vector-store-tablestore` | 阿里云表格存储(TableStore)向量索引支持 | -| | `agentic-ai-starter-vector-store-tair` | 阿里云内存数据库 Tair 向量引擎适配器 | -| **检索增强 (RAG)** | `agentic-ai-starter-rag` | 包含 Elasticsearch 混合检索(KNN + BM25 + RRF 融合打分)、HyDE 假设性文档检索与多模式 Advisors | -| **动态提示词** | `agentic-ai-starter-nacos-prompt` | 基于 Nacos 配置中心的 Prompt Template 动态热更新机制(无需重启应用) | -| **应用可观测性** | `agentic-ai-starter-arms-observation` | 阿里云 ARMS(应用实时监控服务)与 OpenTelemetry 桥接,支持模型与工具调用的全链路追踪与指标度量 | +| **MCP 生态** | `argi-starter-mcp-distributed` | 基于 Nacos 动态发现 SSE / Streamable HTTP 类型的 MCP Server,暴露为 Spring AI `ToolCallbackProvider` | +| | `argi-starter-mcp-registry` | 将本地 MCP Server 自动注册至 Nacos 注册中心,支持无状态(Stateless)注册与工具 Schema 校验 | +| | `argi-starter-mcp-gateway` | MCP 统一流量网关,支持 WebFlux/WebMvc 双栈、多 Server 聚合代理转发、OAuth 2.0 客户端认证与 JSON 模板解析 | +| | `argi-starter-mcp-router` | 基于向量存储的 MCP Server 语义搜索路由、动态服务注册、统一工具请求代理与定时 Watcher 监控 | +| **聊天记忆**
**(Chat Memory)** | `argi-starter-model-chat-memory` | 基础 Chat Memory 自动装配与通用配置模型 | +| | `argi-starter-model-chat-memory-repository-redis` | Redis 会话记忆仓储,支持 Lettuce、Jedis、Redisson 客户端,支持单机、集群与 SSL | +| | `argi-starter-model-chat-memory-repository-jdbc` | 关系型数据库通用记忆仓储,内置 MySQL、PostgreSQL、Oracle、SQL Server、H2、SQLite 方言实现 | +| | `argi-starter-model-chat-memory-repository-mongodb` | 基于 Spring Data MongoDB 的会话文档化存储 | +| | `argi-starter-model-chat-memory-repository-elasticsearch` | 基于 Elasticsearch 客户端的高并发消息仓储 | +| | `argi-starter-model-chat-memory-repository-memcached` | 高性能内存级 Memcached 聊天记忆存储 | +| | `argi-starter-model-chat-memory-repository-tablestore` | 阿里云表格存储(TableStore)高可靠 NoSQL 记忆仓储 | +| | `argi-starter-model-chat-memory-mem0` | Mem0 智能记忆层集成,提供会话与用户维度的长期记忆提取与上下文增强 | +| **向量存储**
**(Vector Store)** | `argi-starter-vector-store-analyticdb` | 阿里云 AnalyticDB for PostgreSQL / MySQL 向量检索适配器 | +| | `argi-starter-vector-store-oceanbase` | 蚂蚁集团 OceanBase 分布式数据库向量检索适配器 | +| | `argi-starter-vector-store-opensearch` | 阿里云 OpenSearch 开放搜索向量版集成 | +| | `argi-starter-vector-store-tablestore` | 阿里云表格存储(TableStore)向量索引支持 | +| | `argi-starter-vector-store-tair` | 阿里云内存数据库 Tair 向量引擎适配器 | +| **检索增强 (RAG)** | `argi-starter-rag` | 包含 Elasticsearch 混合检索(KNN + BM25 + RRF 融合打分)、HyDE 假设性文档检索与多模式 Advisors | +| **动态提示词** | `argi-starter-nacos-prompt` | 基于 Nacos 配置中心的 Prompt Template 动态热更新机制(无需重启应用) | +| **应用可观测性** | `argi-starter-arms-observation` | 阿里云 ARMS(应用实时监控服务)与 OpenTelemetry 桥接,支持模型与工具调用的全链路追踪与指标度量 | --- @@ -70,26 +70,26 @@ Extensions 遵循严格的属性前缀命名规范,各模块配置前缀汇总 | 功能模块 | 对应 Spring Boot 配置前缀 | 说明 | | --- | --- | --- | -| **Nacos MCP 基础** | `spring.ai.alibaba.mcp.nacos` | Nacos 服务器连接地址、命名空间、鉴权等 | -| **MCP Client (分布式发现)** | `spring.ai.alibaba.mcp.nacos.client` | 客户端总开关、lazy-init、连接池等 | -| **MCP SSE Client** | `spring.ai.alibaba.mcp.nacos.client.sse` | SSE 类型的 MCP 客户端连接与服务名映射 | -| **MCP Streamable Client** | `spring.ai.alibaba.mcp.nacos.client.streamable` | Streamable HTTP 类型的 MCP 客户端连接配置 | -| **MCP 注册** | `spring.ai.alibaba.mcp.nacos.register` | 本地 MCP Server 注册到 Nacos 的服务名、端口与元数据 | -| **MCP 网关** | `spring.ai.alibaba.mcp.gateway` | 网关代理路径、跨域、多 Server 聚合配置 | -| **MCP 网关 OAuth 认证** | `spring.ai.alibaba.mcp.gateway.oauth` | OAuth 2.0 客户端模式(`client-id`、`client-secret`、`token-uri`、`token-cache`、`retry`) | -| **MCP 智能路由** | `spring.ai.alibaba.mcp.router` | 路由服务发现顺序(`discovery-order`)、服务名列表、数据库路由配置 | -| **Chat Memory 基础** | `spring.ai.chat.memory` | 默认会话保留轮数等通用配置 | -| **Chat Memory - Redis** | `spring.ai.chat.memory.repository.redis` | Redis 连接、键前缀、客户端类型(`lettuce`/`jedis`/`redisson`)、集群与 SSL | -| **Chat Memory - JDBC** | `spring.ai.chat.memory.repository.mysql`
`spring.ai.chat.memory.repository.postgresql`
`spring.ai.chat.memory.repository.oracle`
`spring.ai.chat.memory.repository.sqlserver`
`spring.ai.chat.memory.repository.h2`
`spring.ai.chat.memory.repository.sqlite` | 复用 Spring Boot 标准数据源,配置对应方言的 `enabled` 与 `initialize-schema` | -| **Chat Memory - MongoDB** | `spring.ai.chat.memory.repository.mongodb` | `host`、`port`、`userName`、`password`、`authDatabaseName`、`databaseName` | -| **Chat Memory - ES** | `spring.ai.chat.memory.repository.elasticsearch` | `host`、`port`、`nodes`、`index`、`queryField`、`maxResults`、`scheme` | -| **Chat Memory - Memcached** | `spring.ai.chat.memory.repository.memcached` | `host` 与 `port` | -| **Chat Memory - TableStore** | `spring.ai.chat.memory.repository.tablestore` | `endpoint`、`instanceName`、`accessKeyId`、`accessKeySecret`、`sessionTableName`、`messageTableName` | -| **Chat Memory - Mem0** | `spring.ai.chat.memory.mem0` | `client` 配置(`base-url`、`async`)与 `server` 配置(`llm`、`embedder`、`vectorStore`、`graphStore`) | -| **Vector Store** | `spring.ai.vectorstore.analyticdb`
`spring.ai.vectorstore.oceanbase`
`spring.ai.vectorstore.opensearch`
`spring.ai.vectorstore.tablestore`
`spring.ai.vectorstore.tair` | 各向量数据库的端点、索引名/集合名、维度、距离函数与专属认证参数 | -| **RAG Elasticsearch** | `spring.ai.alibaba.rag.elasticsearch` | 检索类型(BM25/KNN/HYBRID)、RRF 开关与权重偏置、召回阈值 | -| **Nacos Prompt** | `spring.ai.nacos.prompt.template` | 提示词模板 DataId、Group 与动态刷新开关 | -| **ARMS 可观测性** | `spring.ai.alibaba.arms` | ARMS 监控开关、模型输入输出采集开关(`capture-input`/`capture-output`)、语义模式(`OPEN_TELEMETRY`/`LANGFUSE`)、工具监控开关 | +| **Nacos MCP 基础** | `argi.mcp.nacos` | Nacos 服务器连接地址、命名空间、鉴权等 | +| **MCP Client (分布式发现)** | `argi.mcp.nacos.client` | 客户端总开关、lazy-init、连接池等 | +| **MCP SSE Client** | `argi.mcp.nacos.client.sse` | SSE 类型的 MCP 客户端连接与服务名映射 | +| **MCP Streamable Client** | `argi.mcp.nacos.client.streamable` | Streamable HTTP 类型的 MCP 客户端连接配置 | +| **MCP 注册** | `argi.mcp.nacos.register` | 本地 MCP Server 注册到 Nacos 的服务名、端口与元数据 | +| **MCP 网关** | `argi.mcp.gateway` | 网关代理路径、跨域、多 Server 聚合配置 | +| **MCP 网关 OAuth 认证** | `argi.mcp.gateway.oauth` | OAuth 2.0 客户端模式(`client-id`、`client-secret`、`token-uri`、`token-cache`、`retry`) | +| **MCP 智能路由** | `argi.mcp.router` | 路由服务发现顺序(`discovery-order`)、服务名列表、数据库路由配置 | +| **Chat Memory 基础** | `argi.chat.memory` | 默认会话保留轮数等通用配置 | +| **Chat Memory - Redis** | `argi.chat.memory.repository.redis` | Redis 连接、键前缀、客户端类型(`lettuce`/`jedis`/`redisson`)、集群与 SSL | +| **Chat Memory - JDBC** | `argi.chat.memory.repository.mysql`
`argi.chat.memory.repository.postgresql`
`argi.chat.memory.repository.oracle`
`argi.chat.memory.repository.sqlserver`
`argi.chat.memory.repository.h2`
`argi.chat.memory.repository.sqlite` | 复用 Spring Boot 标准数据源,配置对应方言的 `enabled` 与 `initialize-schema` | +| **Chat Memory - MongoDB** | `argi.chat.memory.repository.mongodb` | `host`、`port`、`userName`、`password`、`authDatabaseName`、`databaseName` | +| **Chat Memory - ES** | `argi.chat.memory.repository.elasticsearch` | `host`、`port`、`nodes`、`index`、`queryField`、`maxResults`、`scheme` | +| **Chat Memory - Memcached** | `argi.chat.memory.repository.memcached` | `host` 与 `port` | +| **Chat Memory - TableStore** | `argi.chat.memory.repository.tablestore` | `endpoint`、`instanceName`、`accessKeyId`、`accessKeySecret`、`sessionTableName`、`messageTableName` | +| **Chat Memory - Mem0** | `argi.chat.memory.mem0` | `client` 配置(`base-url`、`async`)与 `server` 配置(`llm`、`embedder`、`vectorStore`、`graphStore`) | +| **Vector Store** | `argi.vectorstore.analyticdb`
`argi.vectorstore.oceanbase`
`argi.vectorstore.opensearch`
`argi.vectorstore.tablestore`
`argi.vectorstore.tair` | 各向量数据库的端点、索引名/集合名、维度、距离函数与专属认证参数 | +| **RAG Elasticsearch** | `argi.rag.elasticsearch` | 检索类型(BM25/KNN/HYBRID)、RRF 开关与权重偏置、召回阈值 | +| **Nacos Prompt** | `argi.nacos.prompt.template` | 提示词模板 DataId、Group 与动态刷新开关 | +| **ARMS 可观测性** | `argi.arms` | ARMS 监控开关、模型输入输出采集开关(`capture-input`/`capture-output`)、语义模式(`OPEN_TELEMETRY`/`LANGFUSE`)、工具监控开关 | --- @@ -110,7 +110,7 @@ Extensions 旨在与 `Graph Core` 和 `ReAct Agent` 紧密配合: └────────────────┬───────────────┘ ▼ ┌───────────────────────────────────────────────────────────┐ - │ Agentic AI Extensions │ + │ ARGI Extensions │ │ ┌─────────────┐ ┌──────────────┐ ┌──────────────────────┐ │ │ │ MCP 生态 │ │ 记忆与存储 │ │ RAG 检索增强 │ │ │ │(网关/路由/ │ │(Redis/JDBC/ │ │(Hybrid Search / │ │ @@ -122,7 +122,7 @@ Extensions 旨在与 `Graph Core` 和 `ReAct Agent` 紧密配合: └───────────────────────────────────────────────────────────┘ ``` -1. **远程工具扩展**:使用 `agentic-ai-starter-mcp-distributed` 从 Nacos 动态发现微服务导出的 MCP 工具,通过 `ReactAgent.builder().toolCallbackProviders(...)` 无缝注入智能体。 +1. **远程工具扩展**:使用 `argi-starter-mcp-distributed` 从 Nacos 动态发现微服务导出的 MCP 工具,通过 `ReactAgent.builder().toolCallbackProviders(...)` 无缝注入智能体。 2. **多模态记忆**:Spring AI 的 `ChatMemoryRepository` 负责存储用户交互消息历史,而 Graph Core 的 `CheckpointSaver`(如 `RedisSaver`)负责保存图或 Agent 执行的状态快照。两者相辅相成。 -3. **企业知识接入**:通过 5 大向量存储和 `agentic-ai-starter-rag` 构建混合检索,智能体可通过 Hook 预加载知识库,或以工具调用形式自主按需检索(Agentic RAG)。 +3. **企业知识接入**:通过 5 大向量存储和 `argi-starter-rag` 构建混合检索,智能体可通过 Hook 预加载知识库,或以工具调用形式自主按需检索(Agentic RAG)。 4. **运行时热更与监控**:通过 Nacos 动态修改 System Prompt,通过 ARMS 实时追踪每次 LLM 调用与工具执行的消耗与性能。 diff --git a/docs/frameworks/extensions/rag.md b/docs/frameworks/extensions/rag.md index 55ecec86..c97dddbf 100644 --- a/docs/frameworks/extensions/rag.md +++ b/docs/frameworks/extensions/rag.md @@ -1,7 +1,7 @@ --- title: 检索增强生成 (RAG) sidebar_label: 检索增强 (RAG) -description: 深入解析 Agentic AI Extensions RAG 模块:基于 Elasticsearch 的混合检索 (BM25 + KNN + RRF 融合打分)、HyDE 假设性文档检索、多查询改写与生产级 Advisors。 +description: 深入解析 ARGI Extensions RAG 模块:基于 Elasticsearch 的混合检索 (BM25 + KNN + RRF 融合打分)、HyDE 假设性文档检索、多查询改写与生产级 Advisors。 keywords: [Extensions, RAG, Hybrid Search, BM25, KNN, RRF, HyDE, Elasticsearch, Advisors, 检索增强] --- @@ -9,7 +9,7 @@ keywords: [Extensions, RAG, Hybrid Search, BM25, KNN, RRF, HyDE, Elasticsearch, 单纯的密集向量检索(Dense Vector Search)在处理专有名词、产品型号、精确编码匹配时容易出现召回偏差;而传统的稀疏关键词检索(BM25)又缺乏语义理解能力。 -**`agentic-ai-starter-rag`** 提供了现代高级 RAG(Advanced RAG)所必需的关键基础设施,涵盖**混合检索(Hybrid Search)**、**假设性文档嵌入(HyDE)**、**多查询改写(Multi-Query)** 以及模块化 **Advisor** 编排。 +**`argi-starter-rag`** 提供了现代高级 RAG(Advanced RAG)所必需的关键基础设施,涵盖**混合检索(Hybrid Search)**、**假设性文档嵌入(HyDE)**、**多查询改写(Multi-Query)** 以及模块化 **Advisor** 编排。 --- @@ -38,30 +38,28 @@ keywords: [Extensions, RAG, Hybrid Search, BM25, KNN, RRF, HyDE, Elasticsearch, ```xml io.github.agentic-ai - agentic-ai-starter-rag + argi-starter-rag ``` -### 属性配置(`spring.ai.alibaba.rag.elasticsearch`) +### 属性配置(`argi.rag.elasticsearch`) ```yaml -spring: - ai: - alibaba: - rag: - elasticsearch: - enabled: true - retriever-type: HYBRID # 可选: BM25 / KNN / HYBRID - use-rrf: true # 是否启用 RRF 倒数排名融合 - top-k: 20 - bm25-bias: 1.0 # BM25 权重打分偏置 - knn-bias: 1.2 # KNN 向量权重打分偏置 - recall: - similarity-threshold: 0.75 - neighbors-num: 50 - candidate-num: 100 - rrf: - rank-constant: 60 # RRF 排名影响因子(值越大低排名文档权重越高) - rank-window-size: 50 # RRF 窗口大小 +argi: + rag: + elasticsearch: + enabled: true + retriever-type: HYBRID # 可选: BM25 / KNN / HYBRID + use-rrf: true # 是否启用 RRF 倒数排名融合 + top-k: 20 + bm25-bias: 1.0 # BM25 权重打分偏置 + knn-bias: 1.2 # KNN 向量权重打分偏置 + recall: + similarity-threshold: 0.75 + neighbors-num: 50 + candidate-num: 100 + rrf: + rank-constant: 60 # RRF 排名影响因子(值越大低排名文档权重越高) + rank-window-size: 50 # RRF 窗口大小 ``` ### 自动装配说明与注入使用 @@ -73,7 +71,7 @@ Starter 内部的 `RagElasticSearchAutoConfiguration` 会在检测到配置生 开发者无需手动编写 `@Bean` 工厂方法,直接注入即可使用: ```java -import io.github.agentic.spring.ai.rag.retrieval.search.HybridElasticsearchRetriever; +import io.github.agentic.ai.rag.retrieval.search.HybridElasticsearchRetriever; import org.springframework.ai.document.Document; import org.springframework.ai.rag.Query; import org.springframework.stereotype.Service; @@ -172,7 +170,7 @@ Extensions 内置了可直接装配到 Spring AI `ChatClient` 的高级 Advisor 2. **`MultiQueryRetrieverAdvisor`**:将用户单个 Query 自动裂变为多角度的子查询并行检索并去重合并,避免由于用户提问措辞狭隘导致漏召回。 ```java -import io.github.agentic.spring.ai.rag.advisor.HybridSearchAdvisor; +import io.github.agentic.ai.rag.advisor.HybridSearchAdvisor; import org.springframework.ai.chat.client.ChatClient; // 使用 Builder 模式构建 Advisor diff --git a/docs/frameworks/extensions/vector-stores.md b/docs/frameworks/extensions/vector-stores.md index 15d7d24f..9e310973 100644 --- a/docs/frameworks/extensions/vector-stores.md +++ b/docs/frameworks/extensions/vector-stores.md @@ -1,7 +1,7 @@ --- title: 向量存储 (Vector Stores) sidebar_label: 向量存储 -description: 了解 Agentic AI Extensions 提供的 5 大企业级云原生与分布式向量数据库实现:AnalyticDB、OceanBase、OpenSearch、TableStore 与 Tair,全面支持 Spring AI VectorStore 标准接口与过滤表达式。 +description: 了解 ARGI Extensions 提供的 5 大企业级云原生与分布式向量数据库实现:AnalyticDB、OceanBase、OpenSearch、TableStore 与 Tair,全面支持 Spring AI VectorStore 标准接口与过滤表达式。 keywords: [Extensions, Vector Stores, 向量数据库, AnalyticDB, OceanBase, OpenSearch, TableStore, Tair, 向量检索] --- @@ -9,7 +9,7 @@ keywords: [Extensions, Vector Stores, 向量数据库, AnalyticDB, OceanBase, Op 在构建知识库问答、检索增强生成(RAG)和智能体长期记忆检索时,高效可靠的向量存储是不可或缺的基础底座。 -Agentic AI Extensions 针对企业主流的云原生数据库与分布式存储系统,提供了 5 大生产级 Spring AI `VectorStore` 实现及自动配置 Starter。每个实现均内置了**过滤表达式转换器(Filter Expression Converter)**,支持使用 Spring AI 标准语法执行复杂的元数据混合过滤查询。 +ARGI Extensions 针对企业主流的云原生数据库与分布式存储系统,提供了 5 大生产级 Spring AI `VectorStore` 实现及自动配置 Starter。每个实现均内置了**过滤表达式转换器(Filter Expression Converter)**,支持使用 Spring AI 标准语法执行复杂的元数据混合过滤查询。 --- @@ -17,11 +17,11 @@ Agentic AI Extensions 针对企业主流的云原生数据库与分布式存储 | 存储引擎 | 对应 Starter 坐标 | 适配场景与技术优势 | 配置前缀 | | --- | --- | --- | --- | -| **AnalyticDB** | `agentic-ai-starter-vector-store-analyticdb` | 阿里云 AnalyticDB for PostgreSQL / MySQL 向量引擎,具备海量结构化与向量数据混合分析能力 | `spring.ai.vectorstore.analyticdb` | -| **OceanBase** | `agentic-ai-starter-vector-store-oceanbase` | 蚂蚁集团 OceanBase 分布式数据库内置的向量检索能力,金融级高可用,支持 HybridSearch | `spring.ai.vectorstore.oceanbase` | -| **OpenSearch** | `agentic-ai-starter-vector-store-opensearch` | 阿里云 OpenSearch 开放搜索向量版,高 QPS 毫秒级响应,具备完整的全托管搜索生态 | `spring.ai.vectorstore.opensearch` | -| **TableStore** | `agentic-ai-starter-vector-store-tablestore` | 阿里云表格存储(NoSQL),超高并发、原生支持多租户(Multi-tenant)与自定义元数据 Schema | `spring.ai.vectorstore.tablestore` | -| **Tair** | `agentic-ai-starter-vector-store-tair` | 阿里云内存数据库 Tair(兼容 Redis 协议),纯内存超低延迟向量检索,支持 HNSW、Flat 等算法 | `spring.ai.vectorstore.tair` | +| **AnalyticDB** | `argi-starter-vector-store-analyticdb` | 阿里云 AnalyticDB for PostgreSQL / MySQL 向量引擎,具备海量结构化与向量数据混合分析能力 | `argi.vectorstore.analyticdb` | +| **OceanBase** | `argi-starter-vector-store-oceanbase` | 蚂蚁集团 OceanBase 分布式数据库内置的向量检索能力,金融级高可用,支持 HybridSearch | `argi.vectorstore.oceanbase` | +| **OpenSearch** | `argi-starter-vector-store-opensearch` | 阿里云 OpenSearch 开放搜索向量版,高 QPS 毫秒级响应,具备完整的全托管搜索生态 | `argi.vectorstore.opensearch` | +| **TableStore** | `argi-starter-vector-store-tablestore` | 阿里云表格存储(NoSQL),超高并发、原生支持多租户(Multi-tenant)与自定义元数据 Schema | `argi.vectorstore.tablestore` | +| **Tair** | `argi-starter-vector-store-tair` | 阿里云内存数据库 Tair(兼容 Redis 协议),纯内存超低延迟向量检索,支持 HNSW、Flat 等算法 | `argi.vectorstore.tair` | --- @@ -32,7 +32,7 @@ Agentic AI Extensions 针对企业主流的云原生数据库与分布式存储 io.github.agentic-ai - agentic-ai-starter-vector-store-opensearch + argi-starter-vector-store-opensearch @@ -51,17 +51,18 @@ spring: embedding: options: model: text-embedding-3-small - vectorstore: - opensearch: - enabled: true - instance-id: ${OPENSEARCH_INSTANCE_ID} - endpoint: https://ha-cn-xxxx.opensearch.aliyuncs.com - access-user-name: ${OPENSEARCH_USER} - access-pass-word: ${OPENSEARCH_PASS} - table-name: knowledge_base_vectors - primary-key-field: id - dimensions: 1536 - similarity-function: Cosine +argi: + vectorstore: + opensearch: + enabled: true + instance-id: ${OPENSEARCH_INSTANCE_ID} + endpoint: https://ha-cn-xxxx.opensearch.aliyuncs.com + access-user-name: ${OPENSEARCH_USER} + access-pass-word: ${OPENSEARCH_PASS} + table-name: knowledge_base_vectors + primary-key-field: id + dimensions: 1536 + similarity-function: Cosine ``` --- @@ -73,25 +74,24 @@ spring: ```xml io.github.agentic-ai - agentic-ai-starter-vector-store-tair + argi-starter-vector-store-tair ``` ```yaml -spring: - ai: - vectorstore: - tair: - host: ${TAIR_HOST:127.0.0.1} - port: ${TAIR_PORT:6379} - password: ${TAIR_PASSWORD:} - timeout: 2000 - options: - index-name: spring_ai_tair_vector_store - dimensions: 1536 - index-algorithm: HNSW # 可选: HNSW / FLAT - distance-method: L2 # 可选: L2 / IP / JACCARD - expire-seconds: 600 +argi: + vectorstore: + tair: + host: ${TAIR_HOST:127.0.0.1} + port: ${TAIR_PORT:6379} + password: ${TAIR_PASSWORD:} + timeout: 2000 + options: + index-name: spring_ai_tair_vector_store + dimensions: 1536 + index-algorithm: HNSW # 可选: HNSW / FLAT + distance-method: L2 # 可选: L2 / IP / JACCARD + expire-seconds: 600 ``` --- @@ -101,21 +101,20 @@ spring: ```xml io.github.agentic-ai - agentic-ai-starter-vector-store-oceanbase + argi-starter-vector-store-oceanbase ``` ```yaml -spring: - ai: - vectorstore: - oceanbase: - url: jdbc:oceanbase://localhost:2881/test?useSSL=false - username: root@test - password: secret - table-name: vector_store - dimension: 1536 - hybrid-search-type: RRF +argi: + vectorstore: + oceanbase: + url: jdbc:oceanbase://localhost:2881/test?useSSL=false + username: root@test + password: secret + table-name: vector_store + dimension: 1536 + hybrid-search-type: RRF ``` --- @@ -125,25 +124,24 @@ spring: ```xml io.github.agentic-ai - agentic-ai-starter-vector-store-analyticdb + argi-starter-vector-store-analyticdb ``` ```yaml -spring: - ai: - vectorstore: - analyticdb: - collect-name: adb_vectors - access-key-id: ${ALIBABA_AK} - access-key-secret: ${ALIBABA_SK} - region-id: cn-hangzhou - db-instance-id: gp-xxxxxx - manager-account: test_user - manager-account-password: test_password - namespace: public - metrics: cosine - read-timeout: 60000 +argi: + vectorstore: + analyticdb: + collect-name: adb_vectors + access-key-id: ${ALIBABA_AK} + access-key-secret: ${ALIBABA_SK} + region-id: cn-hangzhou + db-instance-id: gp-xxxxxx + manager-account: test_user + manager-account-password: test_password + namespace: public + metrics: cosine + read-timeout: 60000 ``` --- @@ -155,25 +153,24 @@ TableStore 原生支持多租户隔离与自定义扩展元数据模式(`extra ```xml io.github.agentic-ai - agentic-ai-starter-vector-store-tablestore + argi-starter-vector-store-tablestore ``` ```yaml -spring: - ai: - vectorstore: - tablestore: - enabled: true - endpoint: https://your-instance.cn-hangzhou.ots.aliyuncs.com - instance-name: your-instance - access-key-id: ${OTS_AK} - access-key-secret: ${OTS_SK} - table-name: spring_ai_multi_tenant_knowledge_store - text-field: text_1 - embedding-field: embedding_1 - embedding-dimension: 1536 - enable-multitenant: true +argi: + vectorstore: + tablestore: + enabled: true + endpoint: https://your-instance.cn-hangzhou.ots.aliyuncs.com + instance-name: your-instance + access-key-id: ${OTS_AK} + access-key-secret: ${OTS_SK} + table-name: spring_ai_multi_tenant_knowledge_store + text-field: text_1 + embedding-field: embedding_1 + embedding-dimension: 1536 + enable-multitenant: true ``` --- diff --git a/docs/frameworks/graph-core/concepts/edges.md b/docs/frameworks/graph-core/concepts/edges.md index d429db09..2792ff04 100644 --- a/docs/frameworks/graph-core/concepts/edges.md +++ b/docs/frameworks/graph-core/concepts/edges.md @@ -25,8 +25,8 @@ keywords: [Edges, 边, 条件边, ConditionalEdges, 路由控制, 工作流分 如果节点 A 总是无条件流向节点 B,可以使用 `addEdge` 方法直接建立单向连接: ```java -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.StateGraph.END; // 从 START 到流程第一步,再固定流转至总结节点并结束 stateGraph.addEdge(START, "classifier_node") @@ -41,7 +41,7 @@ stateGraph.addEdge(START, "classifier_node") 当流程需要根据大模型输出、业务规则或异常状态动态分支时,使用 `addConditionalEdges` 方法: ```java -import static io.github.agentic.spring.ai.graph.action.AsyncEdgeAction.edge_async; +import static io.github.agentic.ai.graph.action.AsyncEdgeAction.edge_async; import java.util.Map; // 动态路由函数:根据状态中的 intent 决定下一个节点 @@ -101,8 +101,8 @@ stateGraph.addEdge("node_a", "end_node") `MultiCommand` 可以在一次条件判断中返回多个目标节点。框架会将这些目标节点作为并行分支执行,并按状态键策略合并结果。 ```java -import io.github.agentic.spring.ai.graph.action.MultiCommand; -import static io.github.agentic.spring.ai.graph.action.AsyncMultiCommandAction.node_async; +import io.github.agentic.ai.graph.action.MultiCommand; +import static io.github.agentic.ai.graph.action.AsyncMultiCommandAction.node_async; stateGraph.addParallelConditionalEdges( "planner", diff --git a/docs/frameworks/graph-core/concepts/graph.md b/docs/frameworks/graph-core/concepts/graph.md index 8cb9a2b9..8452ccfc 100644 --- a/docs/frameworks/graph-core/concepts/graph.md +++ b/docs/frameworks/graph-core/concepts/graph.md @@ -26,8 +26,8 @@ Graph 将智能体工作流建模为有向图。通过组合状态、节点与 `StateGraph` 是图的声明式拓扑定义载体。开发者在 `StateGraph` 中注册状态键、更新合并策略(KeyStrategy)、添加节点和边,完成对智能体工作流结构的建模。 ```java -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; // 初始化 StateGraph 并定义状态键的更新策略 StateGraph stateGraph = new StateGraph() @@ -49,7 +49,7 @@ StateGraph stateGraph = new StateGraph() - 注入运行时参数,如持久化检查点管理器(Checkpointer)、人工介入中断点(Interrupts)等。 ```java -import io.github.agentic.spring.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.CompiledGraph; // 编译图生成可执行的 CompiledGraph 实例 CompiledGraph graph = stateGraph.compile(); diff --git a/docs/frameworks/graph-core/concepts/nodes.md b/docs/frameworks/graph-core/concepts/nodes.md index aabd2e00..bda7525c 100644 --- a/docs/frameworks/graph-core/concepts/nodes.md +++ b/docs/frameworks/graph-core/concepts/nodes.md @@ -29,7 +29,7 @@ keywords: [Nodes, 节点, AsyncNodeAction, START, END, 智能体图, 函数式 由于图底层基于响应式与异步流水线运行,您可以使用 `AsyncNodeAction.node_async` 工具方法将标准的同步业务逻辑包装为异步节点: ```java -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; import java.util.Map; // 定义一个基础计算节点 @@ -46,7 +46,7 @@ stateGraph.addNode("search_node", searchNode); ### 使用带配置的节点 ```java -import static io.github.agentic.spring.ai.graph.action.AsyncNodeActionWithConfig.node_async; +import static io.github.agentic.ai.graph.action.AsyncNodeActionWithConfig.node_async; var configAwareNode = node_async((state, config) -> { String threadId = config.threadId().orElse("default"); @@ -62,8 +62,8 @@ stateGraph.addNode("config_node", configAwareNode); 当节点的输出既包含状态更新,又包含下一跳选择时,可以使用 `CommandAction` / `AsyncCommandAction`。 ```java -import io.github.agentic.spring.ai.graph.action.Command; -import static io.github.agentic.spring.ai.graph.action.AsyncCommandAction.node_async; +import io.github.agentic.ai.graph.action.Command; +import static io.github.agentic.ai.graph.action.AsyncCommandAction.node_async; stateGraph.addNode("classify_and_route", node_async((state, config) -> { String intent = classify(state); @@ -87,7 +87,7 @@ stateGraph.addNode("classify_and_route", node_async((state, config) -> { `START` 是图的虚拟入口节点。当用户调用 `graph.invoke(inputs)` 时,输入状态首先经由从 `START` 发出的边流向第一个业务节点: ```java -import static io.github.agentic.spring.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.StateGraph.START; // 指定图从 START 节点进入分类节点 stateGraph.addEdge(START, "classifier_node"); @@ -98,7 +98,7 @@ stateGraph.addEdge(START, "classifier_node"); `END` 是图的虚拟终止节点。当执行流转到达 `END` 节点时,当前图的执行宣告完成,图引擎输出最终状态: ```java -import static io.github.agentic.spring.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.END; // 当回复生成完成后走向结束 stateGraph.addEdge("generate_reply_node", END); diff --git a/docs/frameworks/graph-core/concepts/serializer.md b/docs/frameworks/graph-core/concepts/serializer.md index 6d65ba75..06493a8b 100644 --- a/docs/frameworks/graph-core/concepts/serializer.md +++ b/docs/frameworks/graph-core/concepts/serializer.md @@ -60,8 +60,8 @@ public class CustomMessage { 通过 `getStateSerializer()` 获取现有的 Jackson 序列化器并定制底层的 `ObjectMapper`: ```java -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.serializer.StateSerializer; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.serializer.StateSerializer; import com.fasterxml.jackson.databind.ObjectMapper; StateGraph graph = new StateGraph(keyStrategyFactory); @@ -78,8 +78,8 @@ if (stateSerializer instanceof StateGraph.JacksonSerializer jacksonSerializer) { 通过继承 `SpringAIJacksonStateSerializer`,注册自定义序列化与反序列化逻辑: ```java -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.serializer.plain_text.jackson.SpringAIJacksonStateSerializer; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.serializer.plain_text.jackson.SpringAIJacksonStateSerializer; import com.fasterxml.jackson.databind.module.SimpleModule; public class CustomizedSerializer extends SpringAIJacksonStateSerializer { diff --git a/docs/frameworks/graph-core/concepts/state.md b/docs/frameworks/graph-core/concepts/state.md index 0cd9afac..e5e4d161 100644 --- a/docs/frameworks/graph-core/concepts/state.md +++ b/docs/frameworks/graph-core/concepts/state.md @@ -20,10 +20,10 @@ keywords: [OverAllState, State, KeyStrategy, ReplaceStrategy, AppendStrategy, 可以通过 `KeyStrategyFactory` 为不同的状态键配置策略: ```java -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.AppendStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.state.strategy.AppendStrategy; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.Map; @@ -96,7 +96,7 @@ List messages = (List) result.get().value("messages").orElse(Lis `AppendStrategy` 支持通过 `RemoveByHash` 移除集合中的特定元素: ```java -import io.github.agentic.spring.ai.graph.state.RemoveByHash; +import io.github.agentic.ai.graph.state.RemoveByHash; var nodeDelete = node_async(state -> Map.of("messages", RemoveByHash.of("消息2")) @@ -108,7 +108,7 @@ var nodeDelete = node_async(state -> `MergeStrategy` 用于合并 `Map` 或可合并的普通对象。两个值都是 `Map` 时,新 Map 会覆盖旧 Map 中的同名键;两个值是同一类型的可合并对象时,框架会尝试按字段合并。 ```java -import io.github.agentic.spring.ai.graph.state.strategy.MergeStrategy; +import io.github.agentic.ai.graph.state.strategy.MergeStrategy; KeyStrategyFactory factory = () -> Map.of("profile", new MergeStrategy()); @@ -123,10 +123,10 @@ var nodeB = node_async(state -> Map.of("profile", Map.of("language", "Java"))); 如果状态键较多,可以使用 `KeyStrategyFactoryBuilder` 集中声明策略。refactor 分支支持按固定 key、前缀、后缀、包含字符串、正则或谓词选择策略。 ```java -import io.github.agentic.spring.ai.graph.KeyStrategyFactoryBuilder; -import io.github.agentic.spring.ai.graph.state.strategy.AppendStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.MergeStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactoryBuilder; +import io.github.agentic.ai.graph.state.strategy.AppendStrategy; +import io.github.agentic.ai.graph.state.strategy.MergeStrategy; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; KeyStrategyFactory factory = new KeyStrategyFactoryBuilder() .defaultStrategy(new ReplaceStrategy()) @@ -142,7 +142,7 @@ KeyStrategyFactory factory = new KeyStrategyFactoryBuilder() 当需要自定义合并逻辑(例如按数值相加、字典递归合并或去重合并)时,您可以实现自定义的 `KeyStrategy` 接口: ```java -import io.github.agentic.spring.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategy; public class CustomMergeStrategy implements KeyStrategy { @Override diff --git a/docs/frameworks/graph-core/concepts/threads.md b/docs/frameworks/graph-core/concepts/threads.md index 4a3e7c33..94ac58c7 100644 --- a/docs/frameworks/graph-core/concepts/threads.md +++ b/docs/frameworks/graph-core/concepts/threads.md @@ -16,7 +16,7 @@ keywords: [Threads, 会话, Checkpointer, 检查点, 状态恢复, 多租户] 会话是分配给状态检查点(Checkpoint)序列的唯一标识符。通过在 `RunnableConfig` 中指定 `threadId`,图引擎会在每次超级步骤(Super-step)执行后,自动将当前状态快照与下一个待执行节点 ID 关联保存到指定的会话中。 ```java -import io.github.agentic.spring.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.RunnableConfig; import java.util.Map; // 为用户会话生成独立的配置 diff --git a/docs/frameworks/graph-core/context-management.md b/docs/frameworks/graph-core/context-management.md index 70084083..cd303fb1 100644 --- a/docs/frameworks/graph-core/context-management.md +++ b/docs/frameworks/graph-core/context-management.md @@ -7,7 +7,7 @@ keywords: [上下文管理, 内存管理, 短期内存, 长期内存, 检查点, # 上下文管理 -AI 应用程序需要支持在同一轮会话的多条消息间共享上下文,或者在不同的会话场景先共享上下文。在 Agentic AI Graph 中,您可以添加两种类型的内存: +AI 应用程序需要支持在同一轮会话的多条消息间共享上下文,或者在不同的会话场景先共享上下文。在 ARGI Graph 中,您可以添加两种类型的内存: * [添加短期内存](#添加短期内存)作为智能体状态的一部分,支持与智能体进行多轮聊天对话。 * [添加长期内存](#添加长期内存)是指跨会话存储的用户特定或应用程序级别的数据。 @@ -71,9 +71,9 @@ graph.invoke(input, config);`} language="java" title="Redis 检查点器配置" > -{`import io.github.agentic.spring.ai.graph.checkpoint.savers.RedisSaver; -import io.github.agentic.spring.ai.graph.checkpoint.config.SaverConfig; -import io.github.agentic.spring.ai.graph.checkpoint.constant.SaverConstant; +{`import io.github.agentic.ai.graph.checkpoint.savers.RedisSaver; +import io.github.agentic.ai.graph.checkpoint.config.SaverConfig; +import io.github.agentic.ai.graph.checkpoint.constant.SaverConstant; // Redis 配置 String redisHost = "localhost"; @@ -98,15 +98,15 @@ CompiledGraph graph = stateGraph.compile( language="java" title="使用短期内存的多轮对话示例" > -{`import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.checkpoint.config.SaverConfig; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; -import io.github.agentic.spring.ai.graph.state.strategy.AppendStrategy; +{`import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.checkpoint.config.SaverConfig; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.state.strategy.AppendStrategy; import org.springframework.ai.chat.client.ChatClient; @@ -114,9 +114,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; // 定义状态策略 KeyStrategyFactory keyStrategyFactory = () -> { @@ -178,15 +178,15 @@ graph.invoke(Map.of("messages", List.of( ### 在子图中使用 -如果您的图包含子图,您只需在编译父图时提供检查点器。Agentic AI Graph 将自动将检查点器传播到子图。 +如果您的图包含子图,您只需在编译父图时提供检查点器。ARGI Graph 将自动将检查点器传播到子图。 -{`import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import static io.github.agentic.spring.ai.graph.StateGraph.START; +{`import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.CompiledGraph; +import static io.github.agentic.ai.graph.StateGraph.START; // 定义状态 KeyStrategyFactory keyStrategyFactory = () -> { @@ -235,7 +235,7 @@ CompiledGraph graph = parentBuilder.compile( 使用长期内存跨对话存储用户特定或应用程序特定的数据。 -Agentic AI 借助 Store 组件来实现记忆的写入或读取管理。Store 是一个抽象接口,可以有不同的实现(如 `MemoryStore`、`RedisStore` 等),用于持久化存储跨会话的数据。 +ARGI 借助 Store 组件来实现记忆的写入或读取管理。Store 是一个抽象接口,可以有不同的实现(如 `MemoryStore`、`RedisStore` 等),用于持久化存储跨会话的数据。 ### 使用 Store 存储用户信息 @@ -245,26 +245,26 @@ Agentic AI 借助 Store 组件来实现记忆的写入或读取管理。Store language="java" title="使用 Store 存储用户信息" > -{`import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; -import io.github.agentic.spring.ai.graph.store.Store; -import io.github.agentic.spring.ai.graph.store.StoreItem; -import io.github.agentic.spring.ai.graph.store.stores.MemoryStore; +{`import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; +import io.github.agentic.ai.graph.store.Store; +import io.github.agentic.ai.graph.store.StoreItem; +import io.github.agentic.ai.graph.store.stores.MemoryStore; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeActionWithConfig.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeActionWithConfig.node_async; // 在节点中使用 Store 存储用户信息 var userProfileNode = node_async((state, config) -> { @@ -338,26 +338,26 @@ System.out.println("加载的用户配置: " + result.get("userProfile"));`} language="java" title="使用 Store 实现缓存" > -{`import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; -import io.github.agentic.spring.ai.graph.store.Store; -import io.github.agentic.spring.ai.graph.store.StoreItem; -import io.github.agentic.spring.ai.graph.store.stores.MemoryStore; +{`import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; +import io.github.agentic.ai.graph.store.Store; +import io.github.agentic.ai.graph.store.StoreItem; +import io.github.agentic.ai.graph.store.stores.MemoryStore; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeActionWithConfig.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeActionWithConfig.node_async; var cacheNode = node_async((state, config) -> { String key = (String) state.value("cacheKey").orElse(""); @@ -449,19 +449,19 @@ private static Object performExpensiveOperation(String key) { language="java" title="结合短期和长期内存的完整示例" > -{`import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.checkpoint.config.SaverConfig; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; -import io.github.agentic.spring.ai.graph.state.strategy.AppendStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; -import io.github.agentic.spring.ai.graph.store.Store; -import io.github.agentic.spring.ai.graph.store.StoreItem; -import io.github.agentic.spring.ai.graph.store.stores.MemoryStore; +{`import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.checkpoint.config.SaverConfig; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.state.strategy.AppendStrategy; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; +import io.github.agentic.ai.graph.store.Store; +import io.github.agentic.ai.graph.store.StoreItem; +import io.github.agentic.ai.graph.store.stores.MemoryStore; import org.springframework.ai.chat.client.ChatClient; @@ -470,10 +470,10 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeActionWithConfig.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.action.AsyncNodeActionWithConfig.node_async; // 定义状态 KeyStrategyFactory keyStrategyFactory = () -> { diff --git a/docs/frameworks/graph-core/examples/cancellation.md b/docs/frameworks/graph-core/examples/cancellation.md index ec9e66bb..270bb941 100644 --- a/docs/frameworks/graph-core/examples/cancellation.md +++ b/docs/frameworks/graph-core/examples/cancellation.md @@ -7,7 +7,7 @@ keywords: [Graph, 取消执行, AsyncGenerator, 流式处理, 工作流取消] # graph 执行取消 -Agentic AI Graph 提供了强大的图执行取消机制,这对于长时间运行的工作流程特别有用。此功能基于 `java-async-generator` 库的取消能力构建。 +ARGI Graph 提供了强大的图执行取消机制,这对于长时间运行的工作流程特别有用。此功能基于 `java-async-generator` 库的取消能力构建。 ## 取消图流 @@ -31,9 +31,9 @@ Agentic AI Graph 提供了强大的图执行取消机制,这对于长时间运 language="java" title="立即取消示例" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.NodeOutput; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.NodeOutput; +import io.github.agentic.ai.graph.RunnableConfig; import java.util.HashMap; import java.util.Map; @@ -100,9 +100,9 @@ System.out.println("是否已取消: " + disposable.isDisposed());`} language="java" title="使用迭代器消费流示例" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.NodeOutput; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.NodeOutput; +import io.github.agentic.ai.graph.RunnableConfig; import java.util.HashMap; import java.util.Map; diff --git a/docs/frameworks/graph-core/examples/hitl.md b/docs/frameworks/graph-core/examples/hitl.md index 23f76620..047feea6 100644 --- a/docs/frameworks/graph-core/examples/hitl.md +++ b/docs/frameworks/graph-core/examples/hitl.md @@ -7,7 +7,7 @@ description: "在构建 Agent 工作流中,利用 Graph 构建工作流中断 # 人类反馈 HITL -在实际业务场景中,经常会遇到人类介入的场景,人类的不同操作将影响工作流不同的走向。Agentic AI Graph 提供了两种方式来实现人类反馈: +在实际业务场景中,经常会遇到人类介入的场景,人类的不同操作将影响工作流不同的走向。ARGI Graph 提供了两种方式来实现人类反馈: 1. **InterruptionMetadata 模式**:可以在任意节点随时中断,通过实现 `InterruptableAction` 接口来控制中断时机 2. **interruptBefore 模式**:需要提前在编译配置中定义中断点,在指定节点执行前中断 @@ -28,31 +28,31 @@ InterruptionMetadata 模式允许节点在运行时动态决定是否需要中 language="java" title="定义带中断的 Graph" > -{`import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.action.AsyncNodeActionWithConfig; -import io.github.agentic.spring.ai.graph.action.InterruptableAction; -import io.github.agentic.spring.ai.graph.action.InterruptionMetadata; -import io.github.agentic.spring.ai.graph.checkpoint.config.SaverConfig; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; -import io.github.agentic.spring.ai.graph.exception.GraphStateException; -import io.github.agentic.spring.ai.graph.state.strategy.AppendStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.action.AsyncNodeActionWithConfig; +import io.github.agentic.ai.graph.action.InterruptableAction; +import io.github.agentic.ai.graph.action.InterruptionMetadata; +import io.github.agentic.ai.graph.checkpoint.config.SaverConfig; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.exception.GraphStateException; +import io.github.agentic.ai.graph.state.strategy.AppendStrategy; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletableFuture; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncEdgeAction.edge_async; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncEdgeAction.edge_async; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; /** * 定义带中断的 Graph @@ -163,10 +163,10 @@ public static class InterruptableNodeAction implements AsyncNodeActionWithConfig language="java" title="执行 Graph 直到中断" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.NodeOutput; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.action.InterruptionMetadata; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.NodeOutput; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.action.InterruptionMetadata; import java.util.Map; import java.util.concurrent.atomic.AtomicReference; @@ -313,24 +313,24 @@ interruptBefore 模式需要在编译 Graph 时提前指定中断点,在指定 language="java" title="定义带中断的 Graph (interruptBefore 模式)" > -{`import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.checkpoint.config.SaverConfig; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; -import io.github.agentic.spring.ai.graph.exception.GraphStateException; -import io.github.agentic.spring.ai.graph.state.strategy.AppendStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.checkpoint.config.SaverConfig; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.exception.GraphStateException; +import io.github.agentic.ai.graph.state.strategy.AppendStrategy; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncEdgeAction.edge_async; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncEdgeAction.edge_async; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; /** * 定义带中断的 Graph @@ -395,8 +395,8 @@ public static CompiledGraph createGraphWithInterrupt() throws GraphStateExceptio language="java" title="执行 Graph 直到中断 (interruptBefore 模式)" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.RunnableConfig; import java.util.Map; @@ -436,8 +436,8 @@ NodeOutput{node=step_1, state={messages=[Step 0, Step 1]}} language="java" title="等待用户输入并更新状态 (interruptBefore 模式)" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.RunnableConfig; import java.util.Map; @@ -576,11 +576,11 @@ NodeOutput{node=__END__, state={messages=[Step 0, Step 1, Step 3], human_feedbac > {`package com.spring.ai.tutorial.graph.human.node; -import io.github.agentic.spring.ai.graph.NodeOutput; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.async.AsyncGenerator; -import io.github.agentic.spring.ai.graph.streaming.StreamingChatGenerator; +import io.github.agentic.ai.graph.NodeOutput; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.async.AsyncGenerator; +import io.github.agentic.ai.graph.streaming.StreamingChatGenerator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.ai.chat.client.ChatClient; @@ -652,11 +652,11 @@ public class ExpanderNode implements NodeAction { > {`package com.spring.ai.tutorial.graph.human.node; -import io.github.agentic.spring.ai.graph.NodeOutput; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.async.AsyncGenerator; -import io.github.agentic.spring.ai.graph.streaming.StreamingChatGenerator; +import io.github.agentic.ai.graph.NodeOutput; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.async.AsyncGenerator; +import io.github.agentic.ai.graph.streaming.StreamingChatGenerator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.ai.chat.client.ChatClient; @@ -725,9 +725,9 @@ public class TranslateNode implements NodeAction { > {`package com.spring.ai.tutorial.graph.human.dispatcher; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.action.EdgeAction; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.action.EdgeAction; public class HumanFeedbackDispatcher implements EdgeAction { @Override diff --git a/docs/frameworks/graph-core/examples/parallel-nodes.md b/docs/frameworks/graph-core/examples/parallel-nodes.md index 6b42c948..0575d40a 100644 --- a/docs/frameworks/graph-core/examples/parallel-nodes.md +++ b/docs/frameworks/graph-core/examples/parallel-nodes.md @@ -7,7 +7,7 @@ keywords: [并行节点, 并行输出, Graph并发, Executor, RunnableConfig, As # 并行节点定义/输出 -Agentic AI Graph 允许您定义并行节点以加速总图执行。 +ARGI Graph 允许您定义并行节点以加速总图执行。 ## 图管理的并发执行 @@ -17,7 +17,7 @@ Agentic AI Graph 允许您定义并行节点以加速总图执行。 language="java" title="配置并行节点 Executor" > -{`import io.github.agentic.spring.ai.graph.RunnableConfig; +{`import io.github.agentic.ai.graph.RunnableConfig; import java.util.concurrent.ForkJoinPool; RunnableConfig runnableConfig = RunnableConfig.builder() @@ -89,21 +89,21 @@ RunnableConfig runnableConfig = RunnableConfig.builder() language="java" title="定义并行节点" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.action.AsyncNodeAction; -import io.github.agentic.spring.ai.graph.exception.GraphStateException; -import io.github.agentic.spring.ai.graph.state.strategy.AppendStrategy; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.action.AsyncNodeAction; +import io.github.agentic.ai.graph.exception.GraphStateException; +import io.github.agentic.ai.graph.state.strategy.AppendStrategy; import java.util.HashMap; import java.util.List; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; // 定义状态策略 KeyStrategyFactory keyStrategyFactory = () -> { @@ -176,11 +176,11 @@ compiledGraph.stream(Map.of()) language="java" title="条件返回到并行节点" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.StateGraph; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncEdgeAction.edge_async; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.StateGraph; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncEdgeAction.edge_async; StateGraph workflow = new StateGraph(keyStrategyFactory) .addNode("A", makeNode("A")) @@ -224,11 +224,11 @@ CompiledGraph graph = workflow.compile();`} language="java" title="混合节点和子图" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.StateGraph; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.StateGraph; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; // 创建子图 A3 StateGraph subgraphA3Builder = new StateGraph(keyStrategyFactory) @@ -342,8 +342,8 @@ CompiledGraph graph = workflow.compile();`} language="java" title="完整示例:并行数据处理" > -{`import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.CompiledGraph; +{`import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.CompiledGraph; import java.util.concurrent.ForkJoinPool; // 定义状态 diff --git a/docs/frameworks/graph-core/examples/persistence.md b/docs/frameworks/graph-core/examples/persistence.md index db3f60aa..b6b5c404 100644 --- a/docs/frameworks/graph-core/examples/persistence.md +++ b/docs/frameworks/graph-core/examples/persistence.md @@ -7,20 +7,20 @@ keywords: [持久化, Persistence, 记忆, Checkpointer, MemorySaver, StateGraph # 为图添加持久化能力 -许多 AI 应用程序需要记忆来跨多个交互共享上下文。在 Agentic AI 中,通过 [`Checkpointer`] 为任何 [`StateGraph`] 提供记忆。 +许多 AI 应用程序需要记忆来跨多个交互共享上下文。在 ARGI 中,通过 [`Checkpointer`] 为任何 [`StateGraph`] 提供记忆。 ## 核心概念 -在创建任何 Agentic AI 工作流时,可以通过以下方式设置持久化: +在创建任何 ARGI 工作流时,可以通过以下方式设置持久化: 1. 创建一个 [`Checkpointer`],例如 [`MemorySaver`] 2. 在编译图时通过 [`CompileConfig`] 传递 Checkpointer 3. 使用 `threadId` 来标识不同的会话 -[`StateGraph`]: https://github.com/agentic-spring-ai/agentic-spring-ai/blob/refactor/agentic-ai-graph-core/src/main/java/io/github/agentic/ai/graph/StateGraph.java -[`Checkpointer`]: https://github.com/agentic-spring-ai/agentic-spring-ai/blob/refactor/agentic-ai-graph-core/src/main/java/io/github/agentic/ai/graph/checkpoint/Checkpoint.java -[`MemorySaver`]: https://github.com/agentic-spring-ai/agentic-spring-ai/blob/refactor/agentic-ai-graph-core/src/main/java/io/github/agentic/ai/graph/checkpoint/savers/MemorySaver.java -[`CompileConfig`]: https://github.com/agentic-spring-ai/agentic-spring-ai/blob/refactor/agentic-ai-graph-core/src/main/java/io/github/agentic/ai/graph/CompileConfig.java +[`StateGraph`]: https://github.com/agentic-ai-java/argi/blob/main/argi-graph-core/src/main/java/io/github/agentic/ai/graph/StateGraph.java +[`Checkpointer`]: https://github.com/agentic-ai-java/argi/blob/main/argi-graph-core/src/main/java/io/github/agentic/ai/graph/checkpoint/Checkpoint.java +[`MemorySaver`]: https://github.com/agentic-ai-java/argi/blob/main/argi-graph-core/src/main/java/io/github/agentic/ai/graph/checkpoint/savers/MemorySaver.java +[`CompileConfig`]: https://github.com/agentic-ai-java/argi/blob/main/argi-graph-core/src/main/java/io/github/agentic/ai/graph/CompileConfig.java ## 初始化配置 @@ -34,14 +34,14 @@ private static final Logger log = LoggerFactory.getLogger("Persistence"); ## 定义状态和策略 -状态是在图中所有节点之间共享的数据结构。Agentic AI 使用 `KeyStrategyFactory` 来定义状态键的行为。 +状态是在图中所有节点之间共享的数据结构。ARGI 使用 `KeyStrategyFactory` 来定义状态键的行为。 ```java -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.AppendStrategy; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; +import io.github.agentic.ai.graph.state.strategy.AppendStrategy; import java.util.Map; import java.util.HashMap; import java.util.List; @@ -99,7 +99,7 @@ public class SearchTool implements Function { ### 创建 Agent 节点 ```java -import io.github.agentic.spring.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.action.NodeAction; import org.springframework.ai.chat.client.ChatClient; import org.springframework.ai.model.function.FunctionCallback; import org.springframework.ai.model.function.FunctionCallbackWrapper; @@ -144,7 +144,7 @@ class AgentNode implements NodeAction { ### 定义路由逻辑 ```java -import io.github.agentic.spring.ai.graph.action.EdgeAction; +import io.github.agentic.ai.graph.action.EdgeAction; class RouteMessage implements EdgeAction { @@ -179,10 +179,10 @@ class RouteMessage implements EdgeAction { 首先,让我们看看不使用持久化时的行为: ```java -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.nodeasync; -import static io.github.agentic.spring.ai.graph.action.AsyncEdgeAction.edgeasync; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.CompiledGraph; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.nodeasync; +import static io.github.agentic.ai.graph.action.AsyncEdgeAction.edgeasync; // 配置 ChatClient ChatClient.Builder chatClientBuilder = ChatClient.builder(chatModel); @@ -239,9 +239,9 @@ Response: I don't have information about your name. Could you please tell me? 现在让我们添加 `MemorySaver` 来实现持久化: ```java -import io.github.agentic.spring.ai.graph.checkpoint.MemorySaver; -import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.checkpoint.MemorySaver; +import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.RunnableConfig; // 创建 Checkpointer var checkpointer = new MemorySaver(); @@ -347,7 +347,7 @@ log.info("Bob: {}", bobResult.data().get("messages")); ### 获取当前状态 ```java -import io.github.agentic.spring.ai.graph.StateSnapshot; +import io.github.agentic.ai.graph.StateSnapshot; // 获取当前状态快照 StateSnapshot snapshot = persistentGraph.getState(config); @@ -391,7 +391,7 @@ checkpointer.delete(checkpointId); ## 完整示例:带工具调用的持久化对话 ```java -import io.github.agentic.spring.ai.graph.*; +import io.github.agentic.ai.graph.*; import org.springframework.ai.chat.client.ChatClient; import org.springframework.ai.model.function.FunctionCallbackWrapper; diff --git a/docs/frameworks/graph-core/examples/plantuml.md b/docs/frameworks/graph-core/examples/plantuml.md index a136e9c5..6a4b4b7a 100644 --- a/docs/frameworks/graph-core/examples/plantuml.md +++ b/docs/frameworks/graph-core/examples/plantuml.md @@ -7,7 +7,7 @@ keywords: [PlantUML, plantUML 输出, 图表, 可视化, UML, 流程图, Graph # plantUML 输出 -Agentic AI Graph 支持将工作流导出为 PlantUML 格式,方便可视化和文档化。 +ARGI Graph 支持将工作流导出为 PlantUML 格式,方便可视化和文档化。 ## PlantUML 工具函数 @@ -18,7 +18,7 @@ Agentic AI Graph 支持将工作流导出为 PlantUML 格式,方便可视化 {`import net.sourceforge.plantuml.SourceStringReader; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormat; -import io.github.agentic.spring.ai.graph.GraphRepresentation; +import io.github.agentic.ai.graph.GraphRepresentation; import java.io.IOException; static java.awt.Image plantUML2PNG(String code) throws IOException { @@ -46,7 +46,7 @@ static void displayDiagram(GraphRepresentation representation) throws IOExceptio > {`var code = """ @startuml - title Agentic AI Graph + title ARGI Graph START --> NodeA NodeA --> NodeB NodeB --> END @@ -62,20 +62,20 @@ display(plantUML2PNG(code));`} language="java" title="从 Graph 生成 PlantUML" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.GraphRepresentation; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.exception.GraphStateException; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.GraphRepresentation; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.exception.GraphStateException; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; /** * 从 Graph 生成 PlantUML diff --git a/docs/frameworks/graph-core/examples/spring-ai-integration.md b/docs/frameworks/graph-core/examples/spring-ai-integration.md index 16683586..9b0c1070 100644 --- a/docs/frameworks/graph-core/examples/spring-ai-integration.md +++ b/docs/frameworks/graph-core/examples/spring-ai-integration.md @@ -10,7 +10,7 @@ keywords: [Spring AI, LLM Streaming, 流式输出, Graph, 智能体图] ## 使用流式 ChatClient -Agentic AI 支持通过 `ChatClient` 进行流式输出。 +ARGI 支持通过 `ChatClient` 进行流式输出。 -{`import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.action.NodeAction; +{`import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.action.NodeAction; import org.springframework.ai.chat.client.ChatClient; import reactor.core.publisher.Flux; @@ -109,9 +109,9 @@ public class StreamingAgentNode implements NodeAction { language="java" title="配置和运行流式 Graph" > -{`import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.CompiledGraph; +{`import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.CompiledGraph; import org.springframework.ai.chat.client.ChatClient; // 配置 Graph diff --git a/docs/frameworks/graph-core/examples/subgraph-as-compiled-graph.md b/docs/frameworks/graph-core/examples/subgraph-as-compiled-graph.md index a5e45b8f..ed6edda6 100644 --- a/docs/frameworks/graph-core/examples/subgraph-as-compiled-graph.md +++ b/docs/frameworks/graph-core/examples/subgraph-as-compiled-graph.md @@ -7,7 +7,7 @@ keywords: [子图, Subgraph, CompiledGraph, 编译, 性能优化, Graph复用] # 子图作为 CompiledGraph -在 Agentic AI 中,可以先编译 StateGraph 得到 CompiledGraph,然后在其他 Graph 中复用,这种方式性能更好且更灵活。 +在 ARGI 中,可以先编译 StateGraph 得到 CompiledGraph,然后在其他 Graph 中复用,这种方式性能更好且更灵活。 ## CompiledGraph vs StateGraph @@ -26,19 +26,19 @@ keywords: [子图, Subgraph, CompiledGraph, 编译, 性能优化, Graph复用] language="java" title="创建并编译子图" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.exception.GraphStateException; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.exception.GraphStateException; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; /** * 创建并编译子图 @@ -72,10 +72,10 @@ StateGraph subGraphDef = new StateGraph(subKeyFactory) language="java" title="在节点中使用 CompiledGraph" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.action.NodeAction; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.action.NodeAction; import java.util.Map; @@ -112,12 +112,12 @@ public static class CompiledSubGraphNode implements NodeAction { language="java" title="在父图中使用" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.StateGraph; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.StateGraph; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; /** * 在父图中使用 @@ -312,8 +312,8 @@ CompiledGraph 可以有自己独立的 checkpoint: language="java" title="带 Checkpoint 的子图" > -{`import io.github.agentic.spring.ai.graph.checkpoint.MemorySaver; -import io.github.agentic.spring.ai.graph.CompileConfig; +{`import io.github.agentic.ai.graph.checkpoint.MemorySaver; +import io.github.agentic.ai.graph.CompileConfig; // 子图使用独立的 checkpoint var subCheckpointer = new MemorySaver(); diff --git a/docs/frameworks/graph-core/examples/subgraph-as-node.md b/docs/frameworks/graph-core/examples/subgraph-as-node.md index b04cb4d2..6c8033ad 100644 --- a/docs/frameworks/graph-core/examples/subgraph-as-node.md +++ b/docs/frameworks/graph-core/examples/subgraph-as-node.md @@ -7,7 +7,7 @@ keywords: [子图, Subgraph, NodeAction, 子图作为节点, 模块化, 工作 # 子图作为节点 -在 Agentic AI Graph 中,可以将一个完整的 Graph 作为另一个 Graph 的节点,实现工作流的模块化设计。 +在 ARGI Graph 中,可以将一个完整的 Graph 作为另一个 Graph 的节点,实现工作流的模块化设计。 ## 概念 @@ -25,19 +25,19 @@ keywords: [子图, Subgraph, NodeAction, 子图作为节点, 模块化, 工作 language="java" title="定义子图" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.exception.GraphStateException; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.exception.GraphStateException; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; /** * 定义子图 @@ -66,10 +66,10 @@ public static CompiledGraph createSubGraph(KeyStrategyFactory keyStrategyFactory language="java" title="将子图包装为 NodeAction" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.action.NodeAction; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.action.NodeAction; import java.util.Map; import java.util.Optional; @@ -107,12 +107,12 @@ public static class SubGraphNode implements NodeAction { language="java" title="在父图中使用" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.StateGraph; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.StateGraph; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; /** * 在父图中使用 diff --git a/docs/frameworks/graph-core/examples/subgraphs.md b/docs/frameworks/graph-core/examples/subgraphs.md index 2f044573..5a0de4f6 100644 --- a/docs/frameworks/graph-core/examples/subgraphs.md +++ b/docs/frameworks/graph-core/examples/subgraphs.md @@ -7,7 +7,7 @@ keywords: [Subgraphs, 子图, 多智能体, Multi-agent, 组件复用, 模块化 # 子图 subgraphs -子图是在另一个图中用作节点的图,Agentic AI Graph 支持多种不同的模式来使用子图,不同的使用方式会决定图之间是否共享上下文、。 +子图是在另一个图中用作节点的图,ARGI Graph 支持多种不同的模式来使用子图,不同的使用方式会决定图之间是否共享上下文、。 ## 使用子图的原因 @@ -29,18 +29,18 @@ keywords: [Subgraphs, 子图, 多智能体, Multi-agent, 组件复用, 模块化 language="java" title="直接添加编译的子图作为节点" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; // 创建并编译子图 KeyStrategyFactory subKeyFactory = () -> { @@ -93,20 +93,20 @@ CompiledGraph compiledParent = parentGraph.compile();`} language="java" title="在节点操作中调用子图" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; // 定义子图 KeyStrategyFactory childKeyFactory = () -> { @@ -190,19 +190,19 @@ CompiledGraph compiledParent = parentGraph.compile();`} language="java" title="直接嵌入 StateGraph" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncEdgeAction.edge_async; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncEdgeAction.edge_async; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; // 定义子图(返回 StateGraph) KeyStrategyFactory keyFactory = () -> { @@ -277,18 +277,18 @@ CompiledGraph compiledParent = parentGraph.compile();`} language="java" title="共享状态的子图" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; // 定义共享状态策略 KeyStrategyFactory sharedKeyStrategyFactory = () -> { @@ -383,20 +383,20 @@ CompiledGraph compiledMain = mainGraph.compile();`} language="java" title="不同状态的子图" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; // 父图状态 KeyStrategyFactory parentKeyStrategyFactory = () -> { @@ -507,13 +507,13 @@ ConfigurableSubGraphNode configurableNode = new ConfigurableSubGraphNode( ## 可视化 -能够可视化图是很重要的,特别是当它们变得更加复杂时。Agentic AI Graph 提供了 `StateGraph.getGraph()` 方法来获取可视化格式(即图即代码表示,如 PlantUML): +能够可视化图是很重要的,特别是当它们变得更加复杂时。ARGI Graph 提供了 `StateGraph.getGraph()` 方法来获取可视化格式(即图即代码表示,如 PlantUML): -{`import io.github.agentic.spring.ai.graph.GraphRepresentation; +{`import io.github.agentic.ai.graph.GraphRepresentation; StateGraph stateGraph = new StateGraph(keyStrategyFactory) .addNode("node1", node1) @@ -539,7 +539,7 @@ System.out.println(representation.content());`} language="java" title="流式处理" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; +{`import io.github.agentic.ai.graph.CompiledGraph; import reactor.core.publisher.Flux; // 执行子图并获取流式输出 @@ -561,18 +561,18 @@ stream.subscribe( language="java" title="多智能体系统示例" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; // 定义智能体状态策略 KeyStrategyFactory agentKeyStrategyFactory = () -> { @@ -651,11 +651,11 @@ Map result = multiAgentSystem.invoke( language="java" title="状态隔离示例" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.exception.GraphStateException; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.exception.GraphStateException; import java.util.Map; import java.util.Optional; diff --git a/docs/frameworks/graph-core/observation.md b/docs/frameworks/graph-core/observation.md index f82d05cd..4d25fc19 100644 --- a/docs/frameworks/graph-core/observation.md +++ b/docs/frameworks/graph-core/observation.md @@ -22,8 +22,8 @@ Graph Core 在执行过程中提供两类观测入口:轻量生命周期监听 | `onComplete(nodeId, state, config)` | 节点成功完成时。 | ```java -import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.GraphLifecycleListener; +import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.GraphLifecycleListener; GraphLifecycleListener listener = new GraphLifecycleListener() { @Override @@ -54,8 +54,8 @@ CompiledGraph graph = stateGraph.compile( | `new GraphObservationLifecycleListener(observationRegistry, captureContent, maxContentLength)` | 可选择采集输入/输出内容,并限制内容长度。 | ```java -import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.observation.GraphObservationLifecycleListener; +import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.observation.GraphObservationLifecycleListener; import io.micrometer.observation.ObservationRegistry; ObservationRegistry registry = ObservationRegistry.create(); @@ -79,6 +79,6 @@ refactor 分支中可以确认以下 observation 扩展类型: | Graph | `GraphObservationContext`、`GraphObservationConvention`、`DefaultGraphObservationConvention`、`GraphObservationHandler`、`GraphObservationDocumentation` | | Node | `GraphNodeObservationContext`、`GraphNodeObservationConvention`、`DefaultGraphNodeObservationConvention`、`GraphNodeObservationHandler`、`GraphNodeObservationDocumentation` | | Edge | `GraphEdgeObservationContext`、`GraphEdgeObservationConvention`、`DefaultGraphEdgeObservationConvention`、`GraphEdgeObservationHandler`、`GraphEdgeObservationDocumentation` | -| 指标与清理 | `GraphMetricsGenerator`、`ObservationContentSanitizer`、`SpringAiAlibabaObservationMetricNames`、`SpringAiAlibabaObservationMetricAttributes` | +| 指标与清理 | `GraphMetricsGenerator`、`ObservationContentSanitizer`、`ArgiObservationMetricNames`、`ArgiObservationMetricAttributes` | -当前 metric 名称中仍保留 `spring.ai.alibaba.*` 兼容标识,这是 refactor 分支中的现状。不要在应用侧自行改名,否则可能与框架的 public 配置或观测约定不一致。 +当前 metric 名称使用 `argi.*`。应用侧应使用框架公开的配置与观测约定,避免自行拼接指标名。 diff --git a/docs/frameworks/graph-core/persistence.md b/docs/frameworks/graph-core/persistence.md index 27cb8f11..164b5f7b 100644 --- a/docs/frameworks/graph-core/persistence.md +++ b/docs/frameworks/graph-core/persistence.md @@ -7,7 +7,7 @@ keywords: [持久化支持, Checkpoint, 检查点, 持久化, 状态管理, 工 # 持久化支持 -Agentic AI Graph 具有内置的持久化层,通过检查点(Checkpointers)实现。当您使用检查点编译图时,检查点会在每个超级步骤(super-step)保存图状态的`检查点`。这些检查点保存到一个`会话`(thread)中,可以在图执行后访问。 +ARGI Graph 具有内置的持久化层,通过检查点(Checkpointers)实现。当您使用检查点编译图时,检查点会在每个超级步骤(super-step)保存图状态的`检查点`。这些检查点保存到一个`会话`(thread)中,可以在图执行后访问。 由于`会话`允许在执行后访问图的状态,因此几个强大的功能都成为可能,包括人在回路中(human-in-the-loop)、内存、时间旅行和容错能力。下面,我们将详细讨论这些概念。 @@ -61,25 +61,25 @@ refactor 分支当前可确认的 checkpoint saver 如下: language="java" title="检查点示例" > -{`import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.checkpoint.config.SaverConfig; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; -import io.github.agentic.spring.ai.graph.exception.GraphStateException; -import io.github.agentic.spring.ai.graph.state.strategy.AppendStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.checkpoint.config.SaverConfig; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.exception.GraphStateException; +import io.github.agentic.ai.graph.state.strategy.AppendStrategy; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.List; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; // 定义状态策略 KeyStrategyFactory keyStrategyFactory = () -> { @@ -146,9 +146,9 @@ graph.invoke(input, config);`} language="java" title="获取状态" > -{`import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.state.StateSnapshot; +{`import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.state.StateSnapshot; // 获取最新的状态快照 RunnableConfig config = RunnableConfig.builder() @@ -176,9 +176,9 @@ System.out.println("Specific checkpoint state: " + specificSnapshot.state());`} language="java" title="获取状态历史" > -{`import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.state.StateSnapshot; +{`import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.state.StateSnapshot; import java.util.List; @@ -210,8 +210,8 @@ for (int i = 0; i < history.size(); i++) { language="java" title="重放图执行" > -{`import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; +{`import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.CompiledGraph; // 获取最新的状态快照 RunnableConfig config = RunnableConfig.builder() @@ -228,7 +228,7 @@ graph.invoke(Map.of(), config); System.out.println("Replay executed");`} -重要的是,Agentic AI Graph 知道某个特定步骤是否之前已执行过。如果已执行,框架只是*重放*图中的该特定步骤,而不重新执行该步骤,但仅适用于提供的 `checkpoint_id` *之前*的步骤。`checkpoint_id` *之后*的所有步骤都将被执行(即新的分支),即使它们之前已被执行。 +重要的是,ARGI Graph 知道某个特定步骤是否之前已执行过。如果已执行,框架只是*重放*图中的该特定步骤,而不重新执行该步骤,但仅适用于提供的 `checkpoint_id` *之前*的步骤。`checkpoint_id` *之后*的所有步骤都将被执行(即新的分支),即使它们之前已被执行。 ### 获取状态 @@ -304,12 +304,12 @@ var updatedConfig = graph.updateState(config, Map.of("the_key_to", "newValue"), language="java" title="更新状态示例" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.state.strategy.AppendStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.state.strategy.AppendStrategy; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.HashMap; import java.util.List; @@ -344,7 +344,7 @@ System.out.println("State updated successfully");`} ## 检查点器实现 -Agentic AI 提供了多种检查点器实现: +ARGI 提供了多种检查点器实现: ### MemorySaver @@ -354,9 +354,9 @@ Agentic AI 提供了多种检查点器实现: language="java" title="MemorySaver 配置" > -{`import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; -import io.github.agentic.spring.ai.graph.checkpoint.config.SaverConfig; -import io.github.agentic.spring.ai.graph.checkpoint.constant.SaverConstant; +{`import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.checkpoint.config.SaverConfig; +import io.github.agentic.ai.graph.checkpoint.constant.SaverConstant; SaverConfig saverConfig = SaverConfig.builder() .register(SaverConstant.MEMORY, new MemorySaver()) diff --git a/docs/frameworks/graph-core/quick-start.md b/docs/frameworks/graph-core/quick-start.md index dc096603..489780b2 100644 --- a/docs/frameworks/graph-core/quick-start.md +++ b/docs/frameworks/graph-core/quick-start.md @@ -1,13 +1,13 @@ --- title: Graph Core 快速开始 sidebar_label: 快速开始 -description: 使用 Agentic AI Graph Core 创建、编译并执行一个状态图。 -keywords: [Graph Core, StateGraph, CompiledGraph, OverAllState, Agentic AI] +description: 使用 ARGI Graph Core 创建、编译并执行一个状态图。 +keywords: [Graph Core, StateGraph, CompiledGraph, OverAllState, ARGI] --- # Graph Core 快速开始 -Agentic AI Graph Core 是状态图工作流运行时。它将工作流建模为节点、边和共享状态:节点执行工作并返回状态更新,边决定下一步执行哪个节点,状态在图执行过程中持续合并和传递。 +ARGI Graph Core 是状态图工作流运行时。它将工作流建模为节点、边和共享状态:节点执行工作并返回状态更新,边决定下一步执行哪个节点,状态在图执行过程中持续合并和传递。 ## 添加依赖 @@ -16,7 +16,7 @@ Agentic AI Graph Core 是状态图工作流运行时。它将工作流建模为 ```xml io.github.agentic-ai - agentic-ai-graph-core + argi-graph-core ``` @@ -25,18 +25,18 @@ Agentic AI Graph Core 是状态图工作流运行时。它将工作流建模为 下面示例定义一个只有一个业务节点的图。图从 `START` 进入 `greet` 节点,节点读取输入状态并写入 `message`,最后流转到 `END`。 ```java -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; import java.util.Map; import java.util.Optional; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; KeyStrategyFactory strategies = () -> Map.of( "message", new ReplaceStrategy() @@ -52,7 +52,7 @@ StateGraph graph = new StateGraph(strategies) CompiledGraph compiledGraph = graph.compile(); -Optional result = compiledGraph.invoke(Map.of("name", "Agentic AI")); +Optional result = compiledGraph.invoke(Map.of("name", "ARGI")); String message = (String) result.orElseThrow().value("message").orElseThrow(); System.out.println(message); ``` diff --git a/docs/frameworks/graph-core/runtime-config.md b/docs/frameworks/graph-core/runtime-config.md index 45acdf45..4c6f2428 100644 --- a/docs/frameworks/graph-core/runtime-config.md +++ b/docs/frameworks/graph-core/runtime-config.md @@ -26,11 +26,11 @@ Graph Core 把配置分为两层:`CompileConfig` 作用于图编译后的执 | 长期 Store | `store(Store)` | 配置长期记忆 Store。Store 与 checkpoint saver 是两类不同组件。 | ```java -import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.GraphLifecycleListener; -import io.github.agentic.spring.ai.graph.checkpoint.config.SaverConfig; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; -import io.github.agentic.spring.ai.graph.store.stores.MemoryStore; +import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.GraphLifecycleListener; +import io.github.agentic.ai.graph.checkpoint.config.SaverConfig; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.store.stores.MemoryStore; SaverConfig saverConfig = SaverConfig.builder() .register(new MemorySaver()) @@ -67,9 +67,9 @@ CompiledGraph graph = stateGraph.compile(compileConfig); | 长期 Store | `store(Store)` | 为本次运行提供 Store,会覆盖或补充编译期配置。 | ```java -import io.github.agentic.spring.ai.graph.NodeAggregationStrategy; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.store.stores.MemoryStore; +import io.github.agentic.ai.graph.NodeAggregationStrategy; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.store.stores.MemoryStore; RunnableConfig config = RunnableConfig.builder() .threadId("user-123") diff --git a/docs/frameworks/graph-core/scheduling.md b/docs/frameworks/graph-core/scheduling.md index 28ab8381..ebe8638c 100644 --- a/docs/frameworks/graph-core/scheduling.md +++ b/docs/frameworks/graph-core/scheduling.md @@ -37,9 +37,9 @@ Graph Core 提供了本地定时执行图的基础类。`ScheduleConfig` 描述 ## 创建定时任务 ```java -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.scheduling.ScheduleConfig; -import io.github.agentic.spring.ai.graph.scheduling.ScheduledAgentTask; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.scheduling.ScheduleConfig; +import io.github.agentic.ai.graph.scheduling.ScheduledAgentTask; import java.time.Duration; import java.util.Map; @@ -83,8 +83,8 @@ ScheduleConfig config = ScheduleConfig.builder() ## 管理任务 ```java -import io.github.agentic.spring.ai.graph.scheduling.ScheduledAgentManager; -import io.github.agentic.spring.ai.graph.scheduling.ScheduledAgentManagerFactory; +import io.github.agentic.ai.graph.scheduling.ScheduledAgentManager; +import io.github.agentic.ai.graph.scheduling.ScheduledAgentManagerFactory; ScheduledAgentManager manager = ScheduledAgentManagerFactory.getInstance().getManager(); diff --git a/docs/frameworks/graph-core/store.md b/docs/frameworks/graph-core/store.md index 139c183e..a43e9bde 100644 --- a/docs/frameworks/graph-core/store.md +++ b/docs/frameworks/graph-core/store.md @@ -31,14 +31,14 @@ refactor 分支当前可确认的实现如下: | `FileSystemStore` | 将 `StoreItem` 作为 JSON 文件保存在本地目录中,适合单节点文件系统持久化。 | | `RedisStore` | Redis-like 内存实现,当前代码使用内存 Map 模拟 Redis 行为。生产 Redis 集成应替换为真实 Redis 客户端实现。 | | `MongoStore` | MongoDB-like 内存实现,当前代码使用内存 Map 模拟 MongoDB 行为。生产 MongoDB 集成应替换为真实 MongoDB 客户端实现。 | -| `DatabaseStore` | JDBC 实现,源码中已标记 `@Deprecated(since = "2.1.0", forRemoval = true)`,注释建议迁移到 `agentic-ai-graph-persistence-jdbc` 中的替代实现。 | +| `DatabaseStore` | JDBC 实现,源码中已标记 `@Deprecated(since = "2.1.0", forRemoval = true)`,注释建议迁移到 `argi-graph-persistence-jdbc` 中的替代实现。 | ## 写入与读取 ```java -import io.github.agentic.spring.ai.graph.store.Store; -import io.github.agentic.spring.ai.graph.store.StoreItem; -import io.github.agentic.spring.ai.graph.store.stores.MemoryStore; +import io.github.agentic.ai.graph.store.Store; +import io.github.agentic.ai.graph.store.StoreItem; +import io.github.agentic.ai.graph.store.stores.MemoryStore; import java.util.List; import java.util.Map; @@ -61,9 +61,9 @@ Optional item = store.getItem( ## 搜索与列出 namespace ```java -import io.github.agentic.spring.ai.graph.store.NamespaceListRequest; -import io.github.agentic.spring.ai.graph.store.StoreSearchRequest; -import io.github.agentic.spring.ai.graph.store.StoreSearchResult; +import io.github.agentic.ai.graph.store.NamespaceListRequest; +import io.github.agentic.ai.graph.store.StoreSearchRequest; +import io.github.agentic.ai.graph.store.StoreSearchResult; StoreSearchRequest searchRequest = StoreSearchRequest.builder() .namespace("users", "alice") @@ -86,9 +86,9 @@ List namespaces = store.listNamespaces( Store 可以在编译期配置,也可以在单次运行中通过 `RunnableConfig` 提供。 ```java -import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.store.stores.MemoryStore; +import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.store.stores.MemoryStore; MemoryStore store = new MemoryStore(); @@ -109,7 +109,7 @@ graph.invoke(Map.of("input", "remember my preference"), config); 如果节点需要读取 Store,可以使用带 `RunnableConfig` 的节点动作,并从 `config.store()` 取得当前 Store。 ```java -import static io.github.agentic.spring.ai.graph.action.AsyncNodeActionWithConfig.node_async; +import static io.github.agentic.ai.graph.action.AsyncNodeActionWithConfig.node_async; stateGraph.addNode("load_memory", node_async((state, config) -> { return config.store() diff --git a/docs/frameworks/graph-core/streaming.md b/docs/frameworks/graph-core/streaming.md index 25067502..36a61e29 100644 --- a/docs/frameworks/graph-core/streaming.md +++ b/docs/frameworks/graph-core/streaming.md @@ -7,7 +7,7 @@ keywords: [Graph, 流式输出, AsyncGenerator, Streaming, 节点流式] # 流式输出 -Agentic AI Graph 内置了对流式处理的原生支持,框架统一是使用 Flux 来在框架中定义和传递流,与 Spring 生态的流式处理保持一致。以下是从 Graph 运行中流式返回输出的不同方式。 +ARGI Graph 内置了对流式处理的原生支持,框架统一是使用 Flux 来在框架中定义和传递流,与 Spring 生态的流式处理保持一致。以下是从 Graph 运行中流式返回输出的不同方式。 ## 输出类型 @@ -38,7 +38,7 @@ Flux 支持多个流的合并、转换、组合等操作,具备非常强大的 ## 在节点操作中整合流式输出 -在 Agentic AI Graph 中,您可以在节点操作中直接返回 `Flux` 对象,框架会自动处理流式输出。 +在 ARGI Graph 中,您可以在节点操作中直接返回 `Flux` 对象,框架会自动处理流式输出。 ### 流式节点实现 @@ -46,8 +46,8 @@ Flux 支持多个流的合并、转换、组合等操作,具备非常强大的 language="java" title="流式节点实现" > -{`import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.action.NodeAction; +{`import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.action.NodeAction; import org.springframework.ai.chat.client.ChatClient; import org.springframework.ai.chat.model.ChatResponse; @@ -90,8 +90,8 @@ public static class StreamingNode implements NodeAction { language="java" title="处理流式输出的节点" > -{`import io.github.agentic.spring.ai.graph.OverAllState; -import io.github.agentic.spring.ai.graph.action.NodeAction; +{`import io.github.agentic.ai.graph.OverAllState; +import io.github.agentic.ai.graph.action.NodeAction; import java.util.Map; @@ -117,24 +117,24 @@ public static class ProcessStreamingNode implements NodeAction { language="java" title="使用流式输出的完整示例" > -{`import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.action.AsyncNodeAction; -import io.github.agentic.spring.ai.graph.exception.GraphStateException; -import io.github.agentic.spring.ai.graph.state.strategy.AppendStrategy; -import io.github.agentic.spring.ai.graph.streaming.StreamingOutput; +{`import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.action.AsyncNodeAction; +import io.github.agentic.ai.graph.exception.GraphStateException; +import io.github.agentic.ai.graph.state.strategy.AppendStrategy; +import io.github.agentic.ai.graph.streaming.StreamingOutput; import org.springframework.ai.chat.client.ChatClient; import java.util.HashMap; import java.util.Map; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; /** * 使用 StateGraph 实现流式输出的完整示例 @@ -246,7 +246,7 @@ chatResponseFlux.subscribe( ## 理解 Graph 中的流 -在 Agentic AI Graph 中,流式输出通过以下方式工作: +在 ARGI Graph 中,流式输出通过以下方式工作: ### 流式输出的层次结构 diff --git a/docs/frameworks/graph-core/workflow-orchestration.md b/docs/frameworks/graph-core/workflow-orchestration.md index c363386e..2d127d38 100644 --- a/docs/frameworks/graph-core/workflow-orchestration.md +++ b/docs/frameworks/graph-core/workflow-orchestration.md @@ -7,9 +7,9 @@ keywords: [Graph, 工作流, Workflow, StateGraph, 智能体编排, 多Agent系 # Workflow 编排指南 -学习如何通过将客服邮件处理流程分解为离散步骤来使用 Agentic AI Graph 构建智能工作流。 +学习如何通过将客服邮件处理流程分解为离散步骤来使用 ARGI Graph 构建智能工作流。 -Agentic AI Graph 可以改变您构建智能代理的思维方式。使用 Graph 构建代理时,您将首先把它分解为称为 **节点(nodes)** 的离散步骤。然后,描述每个节点的不同决策和转换。最后,通过一个共享的 **状态(state)** 将节点连接起来,每个节点都可以读取和写入该状态。在本教程中,我们将指导您完成使用 Agentic AI Graph 构建客服邮件处理代理的思维过程。 +ARGI Graph 可以改变您构建智能代理的思维方式。使用 Graph 构建代理时,您将首先把它分解为称为 **节点(nodes)** 的离散步骤。然后,描述每个节点的不同决策和转换。最后,通过一个共享的 **状态(state)** 将节点连接起来,每个节点都可以读取和写入该状态。在本教程中,我们将指导您完成使用 ARGI Graph 构建客服邮件处理代理的思维过程。 ## 当前核心能力 @@ -51,7 +51,7 @@ refactor 分支中的 Graph Core 已提供以下能力: 4. 功能请求:"能在移动应用中添加暗黑模式吗?" 5. 复杂技术问题:"我们的 API 集成间歇性失败,返回 504 错误" -要在 Agentic AI Graph 中实现代理,通常遵循以下五个步骤。 +要在 ARGI Graph 中实现代理,通常遵循以下五个步骤。 ## 步骤 1:将工作流映射为离散步骤 @@ -185,10 +185,10 @@ flowchart TD language="java" title="定义状态和状态键策略" > -{`import io.github.agentic.spring.ai.graph.KeyStrategy; -import io.github.agentic.spring.ai.graph.KeyStrategyFactory; -import io.github.agentic.spring.ai.graph.state.strategy.ReplaceStrategy; -import io.github.agentic.spring.ai.graph.state.strategy.AppendStrategy; +{`import io.github.agentic.ai.graph.KeyStrategy; +import io.github.agentic.ai.graph.KeyStrategyFactory; +import io.github.agentic.ai.graph.state.strategy.ReplaceStrategy; +import io.github.agentic.ai.graph.state.strategy.AppendStrategy; import java.util.Map; import java.util.HashMap; @@ -272,7 +272,7 @@ public static KeyStrategyFactory createKeyStrategyFactory() { ## 步骤 4:构建您的节点 -现在我们将每个步骤实现为一个函数。Agentic AI Graph 中的节点就是一个接受当前状态并返回更新的 Java 函数。 +现在我们将每个步骤实现为一个函数。ARGI Graph 中的节点就是一个接受当前状态并返回更新的 Java 函数。 ### 适当处理错误 @@ -296,8 +296,8 @@ public static KeyStrategyFactory createKeyStrategyFactory() { language="java" title="LLM可恢复错误处理示例" > -{`import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.OverAllState; +{`import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.OverAllState; import java.util.Map; // 示例:处理工具调用错误,让 LLM 可以重试 @@ -334,8 +334,8 @@ public class ExecuteToolNode implements NodeAction { language="java" title="用户可修复错误处理示例" > -{`import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.OverAllState; +{`import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.OverAllState; import java.util.Map; // 示例:处理缺少用户输入的情况 @@ -349,7 +349,7 @@ public class LookupCustomerHistory implements NodeAction { if (customerId == null) { // 暂停执行,等待用户输入 - // 注意:在 Agentic AI 中,使用 interruptBefore 配置 + // 注意:在 ARGI 中,使用 interruptBefore 配置 return Map.of( "status", "需要客户ID", "message", "请提供客户的账户ID以查找其订阅历史" @@ -380,8 +380,8 @@ public class LookupCustomerHistory implements NodeAction { language="java" title="意外错误处理示例" > -{`import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.OverAllState; +{`import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.OverAllState; import java.util.Map; // 示例:如果需要在发送前验证数据,可以这样做 @@ -411,8 +411,8 @@ public class SendReplyNodeExample implements NodeAction { language="java" title="读取和分类节点实现" > -{`import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.OverAllState; +{`import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.OverAllState; import org.springframework.ai.chat.client.ChatClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -562,8 +562,8 @@ public static class ClassifyIntentNode implements NodeAction { language="java" title="搜索和跟踪节点实现" > -{`import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.OverAllState; +{`import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.OverAllState; import java.util.Map; import java.util.List; @@ -630,8 +630,8 @@ public static class BugTrackingNode implements NodeAction { language="java" title="响应节点实现" > -{`import io.github.agentic.spring.ai.graph.action.NodeAction; -import io.github.agentic.spring.ai.graph.OverAllState; +{`import io.github.agentic.ai.graph.action.NodeAction; +import io.github.agentic.ai.graph.OverAllState; import org.springframework.ai.chat.client.ChatClient; import java.util.Map; import java.util.List; @@ -784,18 +784,18 @@ public static class SendReplyNode implements NodeAction { language="java" title="创建邮件处理 Graph" > -{`import io.github.agentic.spring.ai.graph.StateGraph; -import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.checkpoint.config.SaverConfig; -import io.github.agentic.spring.ai.graph.checkpoint.savers.MemorySaver; -import io.github.agentic.spring.ai.graph.CompileConfig; -import io.github.agentic.spring.ai.graph.exception.GraphStateException; +{`import io.github.agentic.ai.graph.StateGraph; +import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.checkpoint.config.SaverConfig; +import io.github.agentic.ai.graph.checkpoint.savers.MemorySaver; +import io.github.agentic.ai.graph.CompileConfig; +import io.github.agentic.ai.graph.exception.GraphStateException; import org.springframework.ai.chat.model.ChatModel; import org.springframework.ai.chat.client.ChatClient; -import static io.github.agentic.spring.ai.graph.StateGraph.END; -import static io.github.agentic.spring.ai.graph.StateGraph.START; -import static io.github.agentic.spring.ai.graph.action.AsyncEdgeAction.edge_async; -import static io.github.agentic.spring.ai.graph.action.AsyncNodeAction.node_async; +import static io.github.agentic.ai.graph.StateGraph.END; +import static io.github.agentic.ai.graph.StateGraph.START; +import static io.github.agentic.ai.graph.action.AsyncEdgeAction.edge_async; +import static io.github.agentic.ai.graph.action.AsyncNodeAction.node_async; import java.util.Map; /** @@ -884,9 +884,9 @@ public static CompiledGraph createEmailAgentGraph(ChatModel chatModel) throws Gr language="java" title="测试邮件代理" > -{`import io.github.agentic.spring.ai.graph.CompiledGraph; -import io.github.agentic.spring.ai.graph.RunnableConfig; -import io.github.agentic.spring.ai.graph.NodeOutput; +{`import io.github.agentic.ai.graph.CompiledGraph; +import io.github.agentic.ai.graph.RunnableConfig; +import io.github.agentic.ai.graph.NodeOutput; import reactor.core.publisher.Flux; import java.util.ArrayList; import java.util.Map; @@ -959,7 +959,7 @@ public static void testBillingIssue(CompiledGraph app) throws Exception { ### 关键见解 -构建这个邮件代理向我们展示了 Agentic AI Graph 的思维方式: +构建这个邮件代理向我们展示了 ARGI Graph 的思维方式: #### 1. 分解为离散步骤 每个节点做好一件事。这种分解使得可以: @@ -997,7 +997,7 @@ public static void testBillingIssue(CompiledGraph app) throws Exception { **韧性考虑**: -Agentic AI Graph 的持久执行在节点边界创建检查点。当工作流在中断或失败后恢复时,它从执行停止的节点开始处重新开始。较小的节点意味着更频繁的检查点,这意味着如果出问题则重新执行的工作更少。如果您将多个操作合并到一个大节点中,接近结尾的失败意味着从该节点的开始重新执行所有内容。 +ARGI Graph 的持久执行在节点边界创建检查点。当工作流在中断或失败后恢复时,它从执行停止的节点开始处重新开始。较小的节点意味着更频繁的检查点,这意味着如果出问题则重新执行的工作更少。如果您将多个操作合并到一个大节点中,接近结尾的失败意味着从该节点的开始重新执行所有内容。 我们为邮件代理选择这种分解的原因: @@ -1013,15 +1013,15 @@ Agentic AI Graph 的持久执行在节点边界创建检查点。当工作流在 **应用程序级关注点**: -步骤2中的缓存讨论(是否缓存搜索结果)是应用程序级决策,而不是Agentic AI Graph框架功能。您根据具体需求在节点函数中实现缓存 - Agentic AI Graph不规定这一点。 +步骤2中的缓存讨论(是否缓存搜索结果)是应用程序级决策,而不是ARGI Graph框架功能。您根据具体需求在节点函数中实现缓存 - ARGI Graph不规定这一点。 **性能考虑**: -更多节点并不意味着更慢的执行。Agentic AI Graph默认在后台写入检查点(异步持久性模式),因此您的图继续运行而无需等待检查点完成。这意味着您可以获得频繁的检查点而性能影响最小。 +更多节点并不意味着更慢的执行。ARGI Graph默认在后台写入检查点(异步持久性模式),因此您的图继续运行而无需等待检查点完成。这意味着您可以获得频繁的检查点而性能影响最小。 ### 下一步 -这是使用 Agentic AI Graph 构建代理的入门介绍。您可以使用以下内容扩展此基础: +这是使用 ARGI Graph 构建代理的入门介绍。您可以使用以下内容扩展此基础: #### 1. 人工介入模式 了解如何在执行前添加工具批准、批量批准和其他模式。参考: diff --git a/docs/frameworks/studio/quick-start.md b/docs/frameworks/studio/quick-start.md index 33827293..5c16efd1 100644 --- a/docs/frameworks/studio/quick-start.md +++ b/docs/frameworks/studio/quick-start.md @@ -1,11 +1,11 @@ --- title: Studio -description: Inspect Agentic AI agent and graph executions visually. +description: Inspect ARGI agent and graph executions visually. --- # Studio -Agentic AI Studio is an embedded debugging interface for agent conversations and graph workflows. +ARGI Studio is an embedded debugging interface for agent conversations and graph workflows. Studio helps developers inspect: diff --git a/docs/overview.md b/docs/overview.md index 8a8b1917..bafc6dd0 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -2,13 +2,13 @@ sidebar_position: 1 title: 项目架构概述 sidebar_label: 项目架构概述 -description: Agentic AI 是面向 Java 开发者的智能体运行时,支持 ReAct Agent、图编排、可持久化执行与人机协同。 -keywords: [Agentic AI, Agent Framework, ReactAgent, Graph Core, Java Agent, 架构概述, workflow orchestration] +description: ARGI 是面向 Java 开发者的智能体运行时,支持 ReAct Agent、图编排、可持久化执行与人机协同。 +keywords: [ARGI, Agent Framework, ReactAgent, Graph Core, Java Agent, 架构概述, workflow orchestration] --- # 项目架构概述 -Agentic AI 是面向 Java 开发者的智能体运行时与编排框架,用于构建 ReAct Agent、显式图工作流以及需要状态恢复能力的智能体应用。 +ARGI 是 **Agent Runtime and Graph Intelligence** 的缩写,读作 **“AR-jee”**(`/ˈɑːr.dʒiː/`)。它是面向 Java 开发者的智能体运行时与编排框架,用于构建 ReAct Agent、显式图工作流以及需要状态恢复能力的智能体应用。 项目聚焦于顶层智能体系统架构设计: @@ -16,13 +16,13 @@ Agentic AI 是面向 Java 开发者的智能体运行时与编排框架,用于 - **Graph Core**:提供 `StateGraph`、`CompiledGraph`、节点、边、共享状态、检查点、恢复、流式输出和人工介入等图运行时能力。 - **Studio**:提供嵌入式可视化调试界面,用于观测智能体对话流与图工作流执行过程。 -Agentic AI fork 自 Spring AI Alibaba。refactor 分支已经将核心 Maven 坐标迁移到 `io.github.agentic-ai`,模块名迁移到 `agentic-ai-*`,Java 包名迁移到 `io.github.agentic.spring.ai.*`。 +ARGI fork 自 Spring AI Alibaba。refactor 分支已经将核心 Maven 坐标迁移到 `io.github.agentic-ai`,模块名迁移到 `argi-*`,Java 包名迁移到 `io.github.agentic.ai.*`。 ## 架构设计与定位 -ReAct Agent 与 Graph 是 Agentic AI 当前文档需要优先对齐的两类核心能力: +ReAct Agent 与 Graph 是 ARGI 当前文档需要优先对齐的两类核心能力: 1. **Graph**:适用于需要显式控制分支、循环、并行、子图、检查点和恢复的工作流。图由 `StateGraph` 定义,编译为 `CompiledGraph` 后执行。 2. **ReAct Agent**:适用于模型需要在「推理、工具调用、观察结果、继续推理」之间循环的智能体应用。`ReactAgent` 构建在 Graph 运行时之上。 -在模型接入层面,Agentic AI 使用 Spring AI 的 `ChatModel`、`ToolCallback` 等抽象。Graph 编排、状态管理和恢复语义由 Agentic AI 自身提供。 +在模型接入层面,ARGI 使用 Spring AI 的 `ChatModel`、`ToolCallback` 等抽象。Graph 编排、状态管理和恢复语义由 ARGI 自身提供。 diff --git a/docs/quick-start.md b/docs/quick-start.md index 2f2007b6..af7361a2 100644 --- a/docs/quick-start.md +++ b/docs/quick-start.md @@ -1,12 +1,12 @@ --- title: Quick Start -description: Start building with Agentic AI. -keywords: [Agentic AI, Quick Start, ReAct Agent, Graph Core] +description: Start building with ARGI. +keywords: [ARGI, Quick Start, ReAct Agent, Graph Core] --- # Quick Start -Use this path when starting a new Agentic AI application: +Use this path when starting a new ARGI application: 1. Choose the runtime shape. - Use **Agent Framework** for ReAct Agent and multi-agent applications. @@ -23,4 +23,4 @@ Use this path when starting a new Agentic AI application: ## Repository -The source code is maintained at [github.com/agentic-spring-ai/agentic-spring-ai](https://github.com/agentic-spring-ai/agentic-spring-ai). +The source code is maintained at [github.com/agentic-ai-java/argi](https://github.com/agentic-ai-java/argi). diff --git a/docs/versions.md b/docs/versions.md index 1b3664da..4666c9f1 100644 --- a/docs/versions.md +++ b/docs/versions.md @@ -2,36 +2,38 @@ sidebar_position: 2 title: 项目版本说明 sidebar_label: 项目版本说明 -description: 了解 Agentic AI 核心框架与 Extensions 的版本口径、Spring Boot 与 Spring AI 版本对应关系。 -keywords: [版本, versions, releases, Agentic AI, Spring AI, Spring Boot, 依赖管理] +description: 了解 ARGI 核心框架与 Extensions 的版本口径、Spring Boot 与 Spring AI 版本对应关系。 +keywords: [版本, versions, releases, ARGI, Spring AI, Spring Boot, 依赖管理] --- # 项目版本说明 -本文说明 Agentic AI 核心框架与 Extensions 的版本口径、Spring Boot 与 Spring AI 适用版本,以及 Maven 依赖坐标。核心框架主要覆盖 `agentic-ai-agent-framework` 与 `agentic-ai-graph-core`;Extensions 覆盖 MCP、Nacos Prompt、Memory、RAG、Vector Store 与 Observation 等 starter。 +本文说明 ARGI 核心框架与 Extensions 的版本口径、Spring Boot 与 Spring AI 适用版本,以及 Maven 依赖坐标。核心框架主要覆盖 `argi-agent-framework` 与 `argi-graph-core`;Extensions 覆盖 MCP、Nacos Prompt、Memory、RAG、Vector Store 与 Observation 等 starter。 ## 版本口径 -Agentic AI fork 自 Spring AI Alibaba。已发布的 `1.x`、`2.0.x` 与 `2.x` 版本用于补齐 fork 之后 Spring AI Alibaba 未发布的版本。迁移版本主要变更 Maven 坐标与 Java package,功能语义和使用方式保持兼容。 +ARGI fork 自 Spring AI Alibaba。当前重构版本统一迁移 Maven 坐标、Java package、配置前缀和框架公共类名,功能语义和使用方式保持一致。 refactor 分支中的核心项目已经使用新的命名: - Maven `groupId`:`io.github.agentic-ai` -- BOM:`agentic-ai-bom` -- Agent Framework:`agentic-ai-agent-framework` -- Graph Core:`agentic-ai-graph-core` -- Java package:`io.github.agentic.spring.ai.*` +- BOM:`argi-bom` +- Agent Framework:`argi-agent-framework` +- Graph Core:`argi-graph-core` +- Java package:`io.github.agentic.ai.*` +- 配置前缀:`argi.*` Extensions 项目同样使用新的 Maven 坐标: - Maven `groupId`:`io.github.agentic-ai` -- BOM:`agentic-ai-extensions-bom` -- 模块名:`agentic-ai-*` -- Java package:`io.github.agentic.spring.ai.*` +- BOM:`argi-extensions-bom` +- 模块名:`argi-*` +- Java package:`io.github.agentic.ai.*` +- 配置前缀:`argi.*` ## 版本对应表 -| 项目 | Agentic AI 版本 | Spring AI | Spring Boot | 说明 | +| 项目 | ARGI 版本 | Spring AI | Spring Boot | 说明 | | --- | --- | --- | --- | --- | | Core | `2.1.0-dev` | `2.0.1` | `4.1.1` | refactor 分支当前开发版本。事实来源:Core `pom.xml`。 | | Extensions | `2.1.0-dev` | `2.0.0` | `4.1.0` | refactor 分支当前开发版本。事实来源:Extensions `pom.xml`。 | @@ -41,14 +43,14 @@ Extensions 项目同样使用新的 Maven 坐标: ## 依赖管理 -新项目建议通过 Agentic AI BOM 管理核心模块版本,并同时导入匹配的 Spring AI BOM。 +新项目建议通过 ARGI BOM 管理核心模块版本,并同时导入匹配的 Spring AI BOM。 ```xml io.github.agentic-ai - agentic-ai-bom + argi-bom 2.1.0-dev pom import @@ -66,25 +68,25 @@ Extensions 项目同样使用新的 Maven 坐标: io.github.agentic-ai - agentic-ai-agent-framework + argi-agent-framework io.github.agentic-ai - agentic-ai-graph-core + argi-graph-core ``` -如果使用已发布的 `1.x` 或 `2.0.x` 迁移版本,请将 `agentic-ai-bom` 与 `spring-ai-bom` 的版本调整为上表对应版本。 +如果使用已发布的 `1.x` 或 `2.0.x` 迁移版本,请将 `argi-bom` 与 `spring-ai-bom` 的版本调整为上表对应版本。 -Extensions starter 使用 `agentic-ai-extensions-bom` 管理版本。refactor 分支当前对应 Spring AI `2.0.0` 与 Spring Boot `4.1.0`。 +Extensions starter 使用 `argi-extensions-bom` 管理版本。refactor 分支当前对应 Spring AI `2.0.0` 与 Spring Boot `4.1.0`。 ```xml io.github.agentic-ai - agentic-ai-extensions-bom + argi-extensions-bom 2.1.0-dev pom import @@ -95,11 +97,11 @@ Extensions starter 使用 `agentic-ai-extensions-bom` 管理版本。refactor io.github.agentic-ai - agentic-ai-starter-mcp-distributed + argi-starter-mcp-distributed io.github.agentic-ai - agentic-ai-starter-nacos-prompt + argi-starter-nacos-prompt ``` @@ -108,8 +110,8 @@ Extensions starter 使用 `agentic-ai-extensions-bom` 管理版本。refactor | 模块 | artifactId | 说明 | | --- | --- | --- | -| Agent Framework | `agentic-ai-agent-framework` | 提供 `ReactAgent`、工具调用、Hook、Interceptor、结构化输出和多智能体编排基础。 | -| Graph Core | `agentic-ai-graph-core` | 提供 `StateGraph`、`CompiledGraph`、状态合并策略、检查点、恢复、流式输出和子图能力。 | +| Agent Framework | `argi-agent-framework` | 提供 `ReactAgent`、工具调用、Hook、Interceptor、结构化输出和多智能体编排基础。 | +| Graph Core | `argi-graph-core` | 提供 `StateGraph`、`CompiledGraph`、状态合并策略、检查点、恢复、流式输出和子图能力。 | ## Extensions 模块 @@ -117,19 +119,14 @@ refactor 分支已确认存在以下 starter: | 能力 | artifactId | | --- | --- | -| MCP 分布式发现 | `agentic-ai-starter-mcp-distributed` | -| MCP 注册 | `agentic-ai-starter-mcp-registry` | -| MCP 网关 | `agentic-ai-starter-mcp-gateway` | -| MCP 路由 | `agentic-ai-starter-mcp-router` | -| Nacos Prompt | `agentic-ai-starter-nacos-prompt` | -| RAG | `agentic-ai-starter-rag` | -| ARMS Observation | `agentic-ai-starter-arms-observation` | -| Chat Memory | `agentic-ai-starter-model-chat-memory` | -| Mem0 Chat Memory | `agentic-ai-starter-model-chat-memory-mem0` | -| Chat Memory Repository | `agentic-ai-starter-model-chat-memory-repository-redis`、`agentic-ai-starter-model-chat-memory-repository-jdbc`、`agentic-ai-starter-model-chat-memory-repository-mongodb`、`agentic-ai-starter-model-chat-memory-repository-elasticsearch`、`agentic-ai-starter-model-chat-memory-repository-memcached`、`agentic-ai-starter-model-chat-memory-repository-tablestore` | -| Vector Store | `agentic-ai-starter-vector-store-tair`、`agentic-ai-starter-vector-store-opensearch`、`agentic-ai-starter-vector-store-oceanbase`、`agentic-ai-starter-vector-store-tablestore`、`agentic-ai-starter-vector-store-analyticdb` | - -## 已知边界 - -- refactor 分支未确认到 `agentic-ai-starter-a2a-nacos`。A2A 文档只覆盖 Agent Framework 中已经存在的远程 Agent 封装能力。 -- Extensions 中部分配置前缀仍沿用 `spring.ai.alibaba.*`,这是当前代码事实;模块名和 Maven 坐标已经改为 `agentic-ai-*`。 +| MCP 分布式发现 | `argi-starter-mcp-distributed` | +| MCP 注册 | `argi-starter-mcp-registry` | +| MCP 网关 | `argi-starter-mcp-gateway` | +| MCP 路由 | `argi-starter-mcp-router` | +| Nacos Prompt | `argi-starter-nacos-prompt` | +| RAG | `argi-starter-rag` | +| ARMS Observation | `argi-starter-arms-observation` | +| Chat Memory | `argi-starter-model-chat-memory` | +| Mem0 Chat Memory | `argi-starter-model-chat-memory-mem0` | +| Chat Memory Repository | `argi-starter-model-chat-memory-repository-redis`、`argi-starter-model-chat-memory-repository-jdbc`、`argi-starter-model-chat-memory-repository-mongodb`、`argi-starter-model-chat-memory-repository-elasticsearch`、`argi-starter-model-chat-memory-repository-memcached`、`argi-starter-model-chat-memory-repository-tablestore` | +| Vector Store | `argi-starter-vector-store-tair`、`argi-starter-vector-store-opensearch`、`argi-starter-vector-store-oceanbase`、`argi-starter-vector-store-tablestore`、`argi-starter-vector-store-analyticdb` | diff --git a/docusaurus.config.ts b/docusaurus.config.ts index be35a519..abadcd1a 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -50,7 +50,7 @@ const config: Config = { tagName: 'meta', attributes: { name: 'keywords', - content: 'Agentic AI, Agent Framework, ReactAgent, Graph Core, Multi-Agent, Java AI, 智能体, 工作流编排, Context Engineering, AI Agent开发', + content: 'ARGI, Agent Framework, ReactAgent, Graph Core, Multi-Agent, Java AI, 智能体, 工作流编排, Context Engineering, AI Agent开发', }, }, // Open Graph / Facebook @@ -72,7 +72,7 @@ const config: Config = { tagName: 'meta', attributes: { property: 'og:title', - content: 'Agentic AI - Agentic AI Framework for Java Developers', + content: 'ARGI - ARGI Framework for Java Developers', }, }, { @@ -93,7 +93,7 @@ const config: Config = { tagName: 'meta', attributes: { property: 'og:site_name', - content: 'Agentic AI', + content: 'ARGI', }, }, { @@ -115,7 +115,7 @@ const config: Config = { tagName: 'meta', attributes: { name: 'twitter:title', - content: 'Agentic AI - Agentic AI Framework for Java Developers', + content: 'ARGI - ARGI Framework for Java Developers', }, }, { @@ -177,7 +177,7 @@ const config: Config = { innerHTML: JSON.stringify({ '@context': 'https://schema.org', '@type': 'Organization', - name: 'Agentic AI', + name: 'ARGI', url: siteUrl, logo: siteAssetUrl('img/logo.svg'), description: projectConfig.description, @@ -194,7 +194,7 @@ const config: Config = { innerHTML: JSON.stringify({ '@context': 'https://schema.org', '@type': 'WebSite', - name: 'Agentic AI', + name: 'ARGI', url: siteUrl, description: projectConfig.description, potentialAction: { @@ -286,7 +286,7 @@ const config: Config = { image: 'img/social-card.jpg', // Enhanced metadata for SEO metadata: [ - { name: 'keywords', content: 'Agentic AI, Agent Framework, ReactAgent, Graph Core, Multi-Agent, Java AI, 智能体, AI开发框架' }, + { name: 'keywords', content: 'ARGI, Agent Framework, ReactAgent, Graph Core, Multi-Agent, Java AI, 智能体, AI开发框架' }, { name: 'twitter:card', content: 'summary_large_image' }, { property: 'og:type', content: 'website' }, ], diff --git a/i18n/en/code.json b/i18n/en/code.json index 33d8dc00..314e4e94 100644 --- a/i18n/en/code.json +++ b/i18n/en/code.json @@ -243,7 +243,7 @@ "description": "Observability feature description" }, "ecosystem.title": { - "message": "Agentic AI Ecosystem" + "message": "ARGI Ecosystem" }, "ecosystem.subtitle": { "message": "A comprehensive ecosystem for building intelligent applications" @@ -255,7 +255,7 @@ "message": "Runtime modules for building agentic Java applications" }, "ecosystem.product.title": { - "message": "Built with Agentic AI" + "message": "Built with ARGI" }, "ecosystem.product.description": { "message": "Production-ready applications powered by our framework" @@ -267,7 +267,7 @@ "message": "View Docs" }, "ecosystem.framework.agent.name": { - "message": "Agentic AI ReAct Agent", + "message": "ARGI ReAct Agent", "description": "Agent framework name" }, "ecosystem.framework.agent.description": { @@ -275,7 +275,7 @@ "description": "Agent framework description" }, "ecosystem.framework.graph.name": { - "message": "Agentic AI Graph Core", + "message": "ARGI Graph Core", "description": "Graph framework name" }, "ecosystem.framework.graph.description": { @@ -283,7 +283,7 @@ "description": "Graph framework description" }, "ecosystem.framework.graphCommunity.name": { - "message": "Agentic AI Studio", + "message": "ARGI Studio", "description": "Graph Community name" }, "ecosystem.framework.graphCommunity.description": { @@ -291,7 +291,7 @@ "description": "Graph Community description" }, "ecosystem.framework.extensions.name": { - "message": "Agentic AI Extensions", + "message": "ARGI Extensions", "description": "Extensions framework name" }, "theme.SearchBar.label": { @@ -354,7 +354,7 @@ "description": "Code playground section subtitle" }, "announcement.message": { - "message": "Agentic AI Runtime now supports full ReAct loops, StateGraph orchestration, and real-time Studio trace debugging", + "message": "ARGI Runtime now supports full ReAct loops, StateGraph orchestration, and real-time Studio trace debugging", "description": "Announcement bar main message" }, "announcement.cta": { diff --git a/i18n/en/docusaurus-plugin-content-docs/current/community/policies.md b/i18n/en/docusaurus-plugin-content-docs/current/community/policies.md index 62571ab7..648c2959 100644 --- a/i18n/en/docusaurus-plugin-content-docs/current/community/policies.md +++ b/i18n/en/docusaurus-plugin-content-docs/current/community/policies.md @@ -1,19 +1,19 @@ --- title: Community Policies -description: Agentic AI community contribution, security, and conduct policies. -keywords: [Agentic AI, community, contribution, security, code of conduct] +description: ARGI community contribution, security, and conduct policies. +keywords: [ARGI, community, contribution, security, code of conduct] --- # Community Policies -Agentic AI was forked from Spring AI Alibaba. The project keeps some legacy Maven coordinates, package names, configuration prefixes, and class names for compatibility, and it follows the Spring AI Alibaba formatting and check rules. +ARGI was forked from Spring AI Alibaba. The refactor branch has migrated the core Maven group to `io.github.agentic-ai`, core artifact names to `argi-*`, and Java packages to `io.github.agentic.ai.*`. Use the POM files, source packages, and module directories in the current branch as the source of truth when contributing. ## Contribution Issues, Discussions, and Pull Requests are welcome. Before contributing, read the repository contribution guides: -- [CONTRIBUTING.md](https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/CONTRIBUTING.md) -- [CONTRIBUTING-zh.md](https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/CONTRIBUTING-zh.md) +- [CONTRIBUTING.md](https://github.com/agentic-ai-java/argi/blob/main/CONTRIBUTING.md) +- [CONTRIBUTING-zh.md](https://github.com/agentic-ai-java/argi/blob/main/CONTRIBUTING-zh.md) Run the required local checks before submitting code, including build, tests, formatting, Checkstyle, license checks, and spelling checks. Use the `type(scope): description` format for PR titles and commit messages, such as `docs(site): update community policies`. @@ -25,14 +25,14 @@ Maintainers will assess the impact and coordinate the fix, release, and disclosu See the full security policies: -- [SECURITY.md](https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/SECURITY.md) -- [SECURITY-zh.md](https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/SECURITY-zh.md) +- [SECURITY.md](https://github.com/agentic-ai-java/argi/blob/main/SECURITY.md) +- [SECURITY-zh.md](https://github.com/agentic-ai-java/argi/blob/main/SECURITY-zh.md) ## Code of Conduct -The Agentic AI community aims to provide an open, welcoming, respectful, and issue-focused collaboration environment. Use inclusive language, respect different viewpoints and experiences, accept constructive feedback, and protect the safety and privacy of community members and users. +The ARGI community aims to provide an open, welcoming, respectful, and issue-focused collaboration environment. Use inclusive language, respect different viewpoints and experiences, accept constructive feedback, and protect the safety and privacy of community members and users. See the full code of conduct: -- [CODE_OF_CONDUCT.md](https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/CODE_OF_CONDUCT.md) -- [CODE_OF_CONDUCT-zh.md](https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/CODE_OF_CONDUCT-zh.md) +- [CODE_OF_CONDUCT.md](https://github.com/agentic-ai-java/argi/blob/main/CODE_OF_CONDUCT.md) +- [CODE_OF_CONDUCT-zh.md](https://github.com/agentic-ai-java/argi/blob/main/CODE_OF_CONDUCT-zh.md) diff --git a/i18n/en/docusaurus-plugin-content-docs/current/frameworks/graph-core/quick-start.md b/i18n/en/docusaurus-plugin-content-docs/current/frameworks/graph-core/quick-start.md index 44066617..c37fc773 100644 --- a/i18n/en/docusaurus-plugin-content-docs/current/frameworks/graph-core/quick-start.md +++ b/i18n/en/docusaurus-plugin-content-docs/current/frameworks/graph-core/quick-start.md @@ -1,15 +1,15 @@ --- title: Graph Core -description: Build stateful graph workflows with Agentic AI Graph Core. +description: Build stateful graph workflows with ARGI Graph Core. --- # Graph Core -Agentic AI Graph Core is the workflow runtime for stateful agent applications. +ARGI Graph Core is the workflow runtime for stateful agent applications. -Graph and ReAct Agent are upper-layer designs in Agentic AI. Graph defines the orchestration model: nodes, edges, shared state, checkpointing, recovery, streaming, and human-in-the-loop execution. +Graph and ReAct Agent are upper-layer designs in ARGI. Graph defines the orchestration model: nodes, edges, shared state, checkpointing, recovery, streaming, and human-in-the-loop execution. -Graph can use Spring AI multi-model integration for model adaptation, while orchestration, state management, recovery, and collaboration semantics are defined by Agentic AI Graph itself. +Graph can use Spring AI multi-model integration for model adaptation, while orchestration, state management, recovery, and collaboration semantics are defined by ARGI Graph itself. ## Core Concepts diff --git a/i18n/en/docusaurus-plugin-content-docs/current/intro.md b/i18n/en/docusaurus-plugin-content-docs/current/intro.md index 2d78fb66..e264a433 100644 --- a/i18n/en/docusaurus-plugin-content-docs/current/intro.md +++ b/i18n/en/docusaurus-plugin-content-docs/current/intro.md @@ -2,9 +2,9 @@ sidebar_position: 1 --- -# Welcome to Agentic AI +# Welcome to ARGI -Agentic AI provides a Java framework for building stateful agents, graph workflows, and multi-agent applications. +ARGI stands for **Agent Runtime and Graph Intelligence** and is pronounced **"AR-jee"** (`/ˈɑːr.dʒiː/`). It provides a Java framework for building stateful agents, graph workflows, and multi-agent applications. ## Development Frameworks diff --git a/i18n/en/docusaurus-theme-classic/footer.json b/i18n/en/docusaurus-theme-classic/footer.json index a462b555..2b609ca6 100644 --- a/i18n/en/docusaurus-theme-classic/footer.json +++ b/i18n/en/docusaurus-theme-classic/footer.json @@ -21,15 +21,15 @@ }, "link.item.label.GitHub": { "message": "GitHub", - "description": "The label of footer link with label=GitHub linking to https://github.com/agentic-spring-ai/agentic-spring-ai" + "description": "The label of footer link with label=GitHub linking to https://github.com/agentic-ai-java/argi" }, "link.item.label.讨论": { "message": "Discussions", - "description": "The label of footer link with label=讨论 linking to https://github.com/agentic-spring-ai/agentic-spring-ai/discussions" + "description": "The label of footer link with label=讨论 linking to https://github.com/agentic-ai-java/argi/discussions" }, "link.item.label.许可证": { "message": "License", - "description": "The label of footer link with label=许可证 linking to https://github.com/agentic-spring-ai/agentic-spring-ai/blob/main/LICENSE" + "description": "The label of footer link with label=许可证 linking to https://github.com/agentic-ai-java/argi/blob/main/LICENSE" }, "link.item.label.ReAct Agent": { "message": "ReAct Agent", @@ -56,7 +56,7 @@ "description": "The label of footer link with label=安全策略" }, "copyright": { - "message": "© 2026 Agentic AI", + "message": "© 2026 ARGI", "description": "The footer copyright" } } diff --git a/i18n/zh-Hans/code.json b/i18n/zh-Hans/code.json index cafcd2cb..bdb00094 100644 --- a/i18n/zh-Hans/code.json +++ b/i18n/zh-Hans/code.json @@ -410,7 +410,7 @@ "description": "Observability feature description" }, "ecosystem.title": { - "message": "Agentic AI 生态系统", + "message": "ARGI 生态系统", "description": "Ecosystem section title" }, "ecosystem.subtitle": { @@ -426,7 +426,7 @@ "description": "Framework section description" }, "ecosystem.product.title": { - "message": "基于 Agentic AI 构建", + "message": "基于 ARGI 构建", "description": "Product section title" }, "ecosystem.product.description": { @@ -442,7 +442,7 @@ "description": "View documentation link text" }, "ecosystem.framework.agent.name": { - "message": "Agentic AI ReAct Agent", + "message": "ARGI ReAct Agent", "description": "Agent framework name" }, "ecosystem.framework.agent.description": { @@ -450,7 +450,7 @@ "description": "Agent framework description" }, "ecosystem.framework.graph.name": { - "message": "Agentic AI Graph Core", + "message": "ARGI Graph Core", "description": "Graph framework name" }, "ecosystem.framework.graph.description": { @@ -458,7 +458,7 @@ "description": "Graph framework description" }, "ecosystem.framework.graphCommunity.name": { - "message": "Agentic AI Studio", + "message": "ARGI Studio", "description": "Agent Chat UI" }, "ecosystem.framework.graphCommunity.description": { @@ -486,7 +486,7 @@ "description": "Code playground section subtitle" }, "announcement.message": { - "message": "Agentic AI 智能体运行时现已全面支持 ReAct 循环、Graph 状态编排与 Studio 实时观测", + "message": "ARGI 智能体运行时现已全面支持 ReAct 循环、Graph 状态编排与 Studio 实时观测", "description": "Announcement bar main message" }, "announcement.cta": { @@ -494,7 +494,7 @@ "description": "Announcement bar CTA link" }, "ecosystem.framework.extensions.name": { - "message": "Agentic AI Extensions", + "message": "ARGI Extensions", "description": "Extensions framework name" }, "ecosystem.framework.extensions.description": { diff --git a/i18n/zh-Hans/docusaurus-theme-classic/footer.json b/i18n/zh-Hans/docusaurus-theme-classic/footer.json index cb31b0c5..3e1690cd 100644 --- a/i18n/zh-Hans/docusaurus-theme-classic/footer.json +++ b/i18n/zh-Hans/docusaurus-theme-classic/footer.json @@ -56,7 +56,7 @@ "description": "The label of footer link with label=许可证 linking to https://github.com/your-username/your-repo-name/blob/main/LICENSE" }, "copyright": { - "message": "© 2026 Agentic AI", + "message": "© 2026 ARGI", "description": "The footer copyright" } } diff --git a/package-lock.json b/package-lock.json index 7ba80a3e..c6b332ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "agentic-ai-website", + "name": "argi-website", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "agentic-ai-website", + "name": "argi-website", "version": "1.0.0", "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 6b0ea251..c633e0ca 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "name": "agentic-ai-website", + "name": "argi-website", "version": "1.0.0", "private": true, - "description": "Agentic AI documentation website", - "author": "Agentic AI", + "description": "ARGI documentation website", + "author": "ARGI", "license": "Apache-2.0", "scripts": { "docusaurus": "docusaurus", diff --git a/project.config.ts b/project.config.ts index d03cbc2c..6aed1e14 100644 --- a/project.config.ts +++ b/project.config.ts @@ -40,32 +40,32 @@ export interface ProjectConfig { const projectConfig: ProjectConfig = { // Basic project information - title: 'Agentic AI', - tagline: 'Agentic AI Runtime for Java Developers. Build ReAct agents, graph workflows, and multi-agent applications with durable execution.', - description: 'Agentic AI 是面向 Java 开发者的智能体运行时与工作流框架,提供 ReAct Agent、Graph 编排、上下文工程、持久化执行和人机协同能力。', + title: 'ARGI', + tagline: 'Agent Runtime and Graph Intelligence for Java developers.', + description: 'ARGI(Agent Runtime and Graph Intelligence)是面向 Java 开发者的智能体运行时与工作流框架。', // Project owner information author: { - name: 'Agentic AI', - website: 'https://agentic-spring-ai.github.io/website/', + name: 'ARGI', + website: 'https://agentic-ai-java.github.io/argi-website/', }, // GitHub repository information (project code repo) github: { - username: 'agentic-spring-ai', - repoName: 'agentic-spring-ai', + username: 'agentic-ai-java', + repoName: 'argi', }, // Docs/website repository information docsGithub: { - username: 'agentic-spring-ai', - repoName: 'website', + username: 'agentic-ai-java', + repoName: 'argi-website', }, // Website deployment configuration deployment: { - url: 'https://agentic-spring-ai.github.io', - baseUrl: '/website/', // 项目站点部署在 GitHub Pages 的仓库子路径下 + url: 'https://agentic-ai-java.github.io', + baseUrl: '/argi-website/', // 项目站点部署在 GitHub Pages 的仓库子路径下 }, } diff --git a/src/components/AnnouncementBar/index.tsx b/src/components/AnnouncementBar/index.tsx index a02a9da9..ed186e92 100644 --- a/src/components/AnnouncementBar/index.tsx +++ b/src/components/AnnouncementBar/index.tsx @@ -65,7 +65,7 @@ export default function AnnouncementBar({ - Agentic AI 智能体运行时现已全面支持 ReAct 循环、Graph 状态编排与 Studio 实时观测 + ARGI 智能体运行时现已全面支持 ReAct 循环、Graph 状态编排与 Studio 实时观测 diff --git a/src/components/EcosystemShowcase/index.tsx b/src/components/EcosystemShowcase/index.tsx index 3b78f197..c20060ab 100644 --- a/src/components/EcosystemShowcase/index.tsx +++ b/src/components/EcosystemShowcase/index.tsx @@ -17,47 +17,47 @@ interface EcosystemItem { const frameworkItems: EcosystemItem[] = [ { - name: 'Agentic AI ReAct Agent', + name: 'ARGI ReAct Agent', nameId: 'ecosystem.framework.agent.name', layer: 'LAYER 01 // AGENT RUNTIME', description: 'Upper-layer framework for ReAct Agent, stateful agent loops, context engineering, and multi-agent coordination.', descriptionId: 'ecosystem.framework.agent.description', tags: ['ReAct Loop', 'Hooks & Guardrails', 'Context Compression', 'Multi-Agent'], iconType: 'agent', - repoUrl: 'https://github.com/agentic-spring-ai/agentic-spring-ai', + repoUrl: 'https://github.com/agentic-ai-java/argi', docUrl: '/docs/frameworks/agent-framework/agents-intro', }, { - name: 'Agentic AI Graph Core', + name: 'ARGI Graph Core', nameId: 'ecosystem.framework.graph.name', layer: 'LAYER 02 // STATEFUL GRAPH', description: 'Graph runtime for workflow orchestration, state checkpoints, time-travel recovery, and human-in-the-loop execution.', descriptionId: 'ecosystem.framework.graph.description', tags: ['StateGraph', 'Conditional Edges', 'Durable Checkpoints', 'HITL'], iconType: 'graph', - repoUrl: 'https://github.com/agentic-spring-ai/agentic-spring-ai', + repoUrl: 'https://github.com/agentic-ai-java/argi', docUrl: '/docs/frameworks/graph-core/workflow-orchestration', }, { - name: 'Agentic AI Studio', + name: 'ARGI Studio', nameId: 'ecosystem.framework.graphCommunity.name', layer: 'LAYER 03 // VISUAL DEBUGGER', description: 'Embedded visual debugging studio for agent conversations, live DAG execution traces, and state inspection.', descriptionId: 'ecosystem.framework.graphCommunity.description', tags: ['Visual DAG', 'Trace Replay', 'State Mutation', 'Token Telemetry'], iconType: 'studio', - repoUrl: 'https://github.com/agentic-spring-ai/agentic-spring-ai', + repoUrl: 'https://github.com/agentic-ai-java/argi', docUrl: '/docs/frameworks/studio/quick-start', }, { - name: 'Agentic AI Extensions', + name: 'ARGI Extensions', nameId: 'ecosystem.framework.extensions.name', layer: 'LAYER 04 // PROTOCOL & MESH', description: 'Pluggable ecosystem for model adapters, distributed persistence backends, A2A discovery, MCP registry, and sandboxed tools.', descriptionId: 'ecosystem.framework.extensions.description', tags: ['MCP Registry', 'A2A Protocol', 'Redis / Postgres Saver', 'Sandbox'], iconType: 'extensions', - repoUrl: 'https://github.com/agentic-spring-ai/agentic-spring-ai-extensions', + repoUrl: 'https://github.com/agentic-ai-java/argi-extensions', docUrl: '/docs/overview', }, ] @@ -175,7 +175,7 @@ export default function EcosystemShowcase(): React.JSX.Element { MODULAR STACK // 全栈智能体模块矩阵

- Agentic AI Ecosystem + ARGI Ecosystem

diff --git a/src/css/custom.css b/src/css/custom.css index 7807b9ff..d6d0e584 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -1,5 +1,5 @@ /* ========================================================================== - Agentic AI — Neural Telemetry & Graph Runtime Theme System + ARGI — Neural Telemetry & Graph Runtime Theme System Zero render-blocking font imports; GPU-friendly paint containment ========================================================================== */ diff --git a/src/pages/index.module.css b/src/pages/index.module.css index 3c7fe295..eafc968f 100644 --- a/src/pages/index.module.css +++ b/src/pages/index.module.css @@ -161,6 +161,32 @@ background-clip: text; } +.brandExpansion { + display: flex; + flex-direction: column; + gap: 0.35rem; + margin: 0; + color: #bae6fd; + font-size: 1.16rem; + font-weight: 700; + line-height: 1.45; +} + +[data-theme='light'] .brandExpansion { + color: #0c4a6e; +} + +.pronunciation { + color: rgba(226, 232, 240, 0.72); + font-family: var(--ifm-font-family-monospace); + font-size: 0.84rem; + font-weight: 600; +} + +[data-theme='light'] .pronunciation { + color: rgba(15, 23, 42, 0.68); +} + [data-theme='light'] .heroTitleAccent { background: linear-gradient(125deg, #0284c7 0%, #4f46e5 55%, #d97706 100%); -webkit-background-clip: text; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 19ee2ff7..703a50e3 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -297,7 +297,7 @@ durableGraph.invoke(null, resumedConfig);`, highlights: [ '零线程阻塞挂起:工作流状态落盘,进程重启后仍可跨实例恢复', '支持 updateState 动态注入人工修正参数或回退至任意历史快照', - '内嵌 Agentic AI Studio,实时可视化 DAG 节点耗时与 Token 流', + '内嵌 ARGI Studio,实时可视化 DAG 节点耗时与 Token 流', ], }, ] @@ -337,7 +337,7 @@ function HomepageHeader() { width="38" height="38" /> - Agentic AI + ARGI

- Agent Runtime - for Java Builders + ARGI

+

+ Agent Runtime and Graph Intelligence + Pronounced "AR-jee" · /ˈɑːr.dʒiː/ +

+

面向生产环境的智能体运行时。用 ReAct Agent、Graph 状态图编排、持久化检查点和上下文工程,构建可观测、可恢复、可协作的企业级 Java 智能体系统。 @@ -422,7 +426,7 @@ function HomepageHeader() { -

+