Skip to content

bryan31/liteFlow-react-agent-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LiteFlow ReAct Agent 示例

这个仓库包含一组可运行的 LiteFlow ReAct Agent Spring Boot 示例。每个模块都演示了一个模型平台入口、必需的 liteflow.agent.* 配置、基础的 LiteFlow EL chain,以及基于文件的 Agent 会话记忆。

模块

模块 入口类 凭证配置前缀
react-agent-openai-example OpenAI.of(modelName) liteflow.agent.openai
react-agent-openai-compatible-deepseek-example DeepSeek.of(modelName) liteflow.agent.openai-compatible.deepseek
react-agent-openai-compatible-glm-example GLM.of(modelName) liteflow.agent.openai-compatible.glm
react-agent-openai-compatible-minimax-example Minimax.of(modelName) liteflow.agent.openai-compatible.minimax
react-agent-openai-compatible-kimi-example Kimi.of(modelName) liteflow.agent.openai-compatible.kimi
react-agent-openai-compatible-custom-example OpenAICompatible.custom("gateway", modelName) liteflow.agent.openai-compatible.gateway
react-agent-openai-compatible-skill-stream-example OpenAICompatible.custom("gateway", modelName).stream(true) liteflow.agent.openai-compatible.gateway
react-agent-dashscope-example DashScope.of(modelName) liteflow.agent.dashscope
react-agent-gemini-example Gemini.of(modelName) liteflow.agent.gemini
react-agent-anthropic-example Anthropic.of(modelName) liteflow.agent.anthropic

前置条件

  • JDK 17
  • Maven 3.9+
  • 本地或远程 Maven 仓库中可用的 LiteFlow 2.16.0 构件
  • 用于真实模型调用的各服务商 API Key

如果你正在本地开发 LiteFlow,请先从 /Users/bryan31/openSource/LiteFlow-Jdk17 安装 LiteFlow 构件,再运行这些示例。

构建

mvn -DskipTests package

运行模块

先导出服务商 API Key,再运行其中一个模块:

export DEEPSEEK_API_KEY=your_api_key
mvn -pl react-agent-openai-compatible-deepseek-example spring-boot:run

也可以在 --args 后传入提示词:

mvn -pl react-agent-openai-compatible-deepseek-example spring-boot:run \
  -Dspring-boot.run.arguments="用两句话介绍 LiteFlow ReAct Agent。"

如果要验证 skill 加载和流式事件输出,可以运行:

export GATEWAY_API_KEY=your_api_key
export GATEWAY_BASE_URL=https://your-gateway.example.com/v1
export GATEWAY_MODEL=your-model
mvn -pl react-agent-openai-compatible-skill-stream-example spring-boot:run

会话记忆

所有模块都使用基于文件的 Agent 记忆:

liteflow:
  agent:
    session:
      memory:
        mode: local_file

每个模块都会把工作区和记忆文件写入:

target/agent-workspaces/
target/agent-workspaces/.agent-session/<sessionId>/

示例 Agent 组件保留了 LiteFlow ReAct Agent 默认的 resolveSessionId(slot) 行为,因此每次运行都会生成新的会话 ID。对于多轮对话场景,请重写 resolveSessionId(slot),并返回一个稳定的业务会话 ID。

安全说明

请把 API Key 保存在环境变量或密钥管理器中,不要把凭证提交到这个仓库。为了让基础示例保持相对保守,示例代码在组件中禁用了内置 shell 工具和工作区文件工具。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors