Go to file
everywhere.z a37df41628 feat(agent): Hook→Middleware(Logging/ChatUsage/SkillTracking)+ 恢复 ctx.getChatUsage()/usedSkills() + 旧 Hook 经 builder.hooks() 桥接
Task 5.1:用 v2 RC3 的 MiddlewareBase 重建 Task 0 删除的三个 1.0 Hook 能力。

新增 middleware 包(com.yomahub.liteflow.agent.middleware):
- LoggingMiddleware:onReasoning/onActing 打印 reason/act/error 日志(替代
  ReActLoggingHook,格式对齐 1.0),由 cmp.enableReActLogging() 控制。
- ChatUsageMiddleware:onModelCall 订阅 ModelCallEndEvent.getUsage() 累加(替代
  ChatUsageTrackingHook)。per-invocation ThreadLocal 累加器,process() 入口 bind、
  出口 unbind;snapshot() 静态读累计值。
- SkillTrackingMiddleware:onActing 跟踪 load_skill_through_path 工具调用(替代
  SkillTrackingHook)。构造期从注入的 AgentSkillRepository 建 skillId→name 映射,
  per-invocation ThreadLocal 集合,usedSkills() 静态读。

探针结论(findings R-skill-track,已追加):"技能被使用"的最干净可观测信号是
onActing 的 ActingInput.toolCalls()——load_skill_through_path 工具名固定、
input.skillId 即 AgentSkill.getSkillId()。未降级,usedSkills() 真实落地。

接入与恢复:
- ReActAgentComponent:process() 入口 ChatUsageMiddleware.bind() +
  SkillTrackingMiddleware.bind(),出口 finally unbind;新增 protected
  middlewares()(默认空);hooks() 标 @Deprecated(since=2.16.0, forRemoval=true),
  指引改用 middlewares();新增 protected final usedSkills()。
- ReActAgentContext:getChatUsage() 恢复为 ChatUsageMiddleware.snapshot();
  删除 stub setChatUsageTrackingHook;class javadoc 从"迁移期"改为"v2(RC3)"。
- ReactAgentFactory.build:组装 [LoggingMiddleware(if enabled), ChatUsageMiddleware,
  SkillTrackingMiddleware(repo), ...cmp.middlewares()] 逐个 builder.middleware(),
  再 builder.hooks(cmp.hooks()) 直接桥接旧 Hook(RC3 Hook 软弃用但 builder.hooks
  仍存在,无需 adapter)。
- SkillRepositoryResolver.configure 签名 void→AgentSkillRepository(返回注册的
  repo 供 SkillTrackingMiddleware 建映射)。

un-stub:SkillsAgentCmp.handleReply 的 USED_SKILLS_SNAPSHOT 从 List.of() stub
改回 usedSkills();ChatUsageAgentCmp/HookAgentCmp 无需改源(随核心恢复自动生效)。

校验:core compile + test-compile SUCCESS;
-Dtest=ChatUsageMiddlewareTest,ProcessIntegrationTest,ShellPermissionBehaviorTest,
SkillLoadingTest → 14 用例全绿;ReactAgentFactoryTest 2 用例无回归。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-20 11:07:45 +08:00
.run_test 添加 release 脚本 2026-06-02 23:53:52 +08:00
docs feat(agent): Hook→Middleware(Logging/ChatUsage/SkillTracking)+ 恢复 ctx.getChatUsage()/usedSkills() + 旧 Hook 经 builder.hooks() 桥接 2026-06-20 11:07:45 +08:00
liteflow-benchmark 更新benchmark 2026-01-22 11:12:23 +08:00
liteflow-core chore: update LiteFlow build after logging improvements 2026-05-16 23:51:33 +08:00
liteflow-el-builder 适配新的中央仓库发布方式,更改maven的整体结构 2025-08-30 23:32:05 +08:00
liteflow-react-agent feat(agent): Hook→Middleware(Logging/ChatUsage/SkillTracking)+ 恢复 ctx.getChatUsage()/usedSkills() + 旧 Hook 经 builder.hooks() 桥接 2026-06-20 11:07:45 +08:00
liteflow-rule-plugin enhancement #ID8XF9 对QLExpress4的支持 2025-11-28 19:40:05 +08:00
liteflow-script-plugin build(graaljs): 通过 profile 适配 JDK 17+ 的 GraalJS 25.x 2026-04-30 14:27:58 +08:00
liteflow-solon-plugin feat(solon): bind agent config into LiteflowConfig 2026-04-19 19:16:54 +08:00
liteflow-spring bug #ICZ1M1 解决在2.15.0中,获取Annotation缺失了缓存导致的性能微小损失问题 2025-09-22 00:06:02 +08:00
liteflow-spring-boot-starter chore: update LiteFlow build after logging improvements 2026-05-16 23:51:33 +08:00
liteflow-spring-boot4-starter build(starter): expose liteflow.agent.skills config hints 2026-05-14 19:13:39 +08:00
liteflow-testcase-el feat(agent): Hook→Middleware(Logging/ChatUsage/SkillTracking)+ 恢复 ctx.getChatUsage()/usedSkills() + 旧 Hook 经 builder.hooks() 桥接 2026-06-20 11:07:45 +08:00
static/img 更新广告图片 2025-02-19 17:56:28 +08:00
.gitignore chore: gitignore .superpowers/ scratch 并取消跟踪 2026-06-20 00:27:24 +08:00
.springjavaformatconfig 加入格式化代码插件,并提交格式化后的代码 2023-03-20 11:50:40 +08:00
AGENTS.md feat(react-agent): add session factory infrastructure, memory storage config, and integration tests 2026-04-29 19:12:29 +08:00
CLAUDE.md docs: 更新并翻译 CLAUDE.md 为简体中文 2026-05-31 21:43:18 +08:00
LICENSE Initial commit 2017-08-07 14:39:23 +08:00
README.md docs: 根据 2.16.0 文档更新中英文 README 2026-06-03 00:51:46 +08:00
README.zh-CN.md docs: 根据 2.16.0 文档更新中英文 README 2026-06-03 00:51:46 +08:00
pom.xml refactor(agent): v2 绿编译基底(删 v2-broken 源码 + stub process)+ API 探针发现笔记 2026-06-19 22:35:31 +08:00

README.md

logo

中文

Your star is my motivation to keep going. If you like LiteFlow, please help me with a star in the upper right corner.

Overview

LiteFlow is a powerful, modern rules engine framework that combines the best of orchestration and rules engines. It can be used in the field of complex componentized business orchestration. DSL rules drive the whole complex business, and can achieve smooth refresh hot deployment, supporting the embedding of multiple scripting language rules. Help the system become more silky and flexible.

LiteFlow was officially open-sourced in 2020 and has since become an indispensable presence in the field of open-source rule engines in China. What's more, the most crucial aspect is that LiteFlow is an open-source project that continues to iterate at a high speed.

Starting from v2.16.0, LiteFlow even turns an AI Agent into a first-class citizen that can be orchestrated directly into your rules, standing shoulder to shoulder with your existing business nodes.

LiteFlow is a community-driven project with a strong emphasis on its large and active user community. We welcome you to raise any issues or suggestions you may have within the community.

You can find out how to join the community on the official website!

Website url: Click here to access the official website

Documents url: Click here to enter the documentation to learn

Feature

  • Component definition unified: All logic is a component, for all logic to provide a unified component implementation, small size, large energy.
  • Rules lightweight: based on the rules file to arrange the process, learning the rules entry only takes 5 minutes, a read both understand.
  • Rule diversification: rules support XML, JSON, YML three rule file writing methods, which you like to use.
  • Arbitrary arrangement: Synchronous asynchronous mixing, no matter how complex the logic process, using LiteFlow rules, are easy to do, see the rules file to see how the logic works.
  • Rules can be loaded from anywhere: The framework natively supports storing rules in a structured database, Nacos, Etcd, Zookeeper, Apollo and Redis. It also provides an extension interface that allows you to store rules anywhere.
  • Elegant hot refresh mechanism: Rule changes, instant change of application rules without restarting your application. High concurrency does not cause any errors in executing rules due to refreshing rules.
  • Wide support: LiteFlow works regardless of whether your project is built on Spring Boot, Spring, or any other Java framework.
  • JDK support: From JDK8 to JDK25. Don't worry about JDK versions. Virtual threads are supported on JDK21 and above.
  • Full Spring Boot support: Supports Spring Boot 2.X, 3.X, and now the latest Spring Boot 4.X.
  • Scripting language support: You can define script language nodes that support Groovy, Java, Kotlin, JavaScript, QLExpress, Python, Lua and Aviator. More script languages will be supported in the future.
  • Scripts fully connected with Java: All scripting languages can call Java methods, reference any instance, and even make RPC calls inside scripts.
  • AI Agent orchestration: Wraps a full ReAct Agent into a standard LiteFlow component, so AI can be orchestrated directly into your business rules.
  • Rule nesting support: You can use simple expressions to create multiple nested complex logic layouts if you want.
  • Component retry support: Components can support retry, and each component can customize the retry configuration and specify exceptions.
  • Context isolation mechanism: Reliable context isolation mechanism, you do not have to worry about high concurrency data flow.
  • Declarative component support: You can make any of your classes become components in seconds.
  • Detailed step information: How your link performs, how much time each component takes, what errors are reported at a glance.
  • Stable and reliable: has been iterating for more than 2 years, running stably on the core systems of major companies.
  • Excellent performance: the framework itself consumes little extra performance, depending on the efficiency of your component execution.
  • Built-in simple monitoring: Built-in a command line monitoring framework, you can know the running time ranking of each component.

What scenarios apply

LiteFlow is a choreographed rules engine that is best at decoupling your systems. If you have a complex system with bloated code, the LiteFlow framework is a great solution.

LiteFlow uses regular expressions to drive the engine that you define. Have you ever thought about how to write multithreaded process choreography like the following?

These processes can be easily solved with LiteFlow! The framework has a very low threshold to learn the expression language, but it can accomplish extremely high complexity of the choreography.

LiteFlow has an extremely detailed and easy-to-understand documentation it can help you solve more than 95% of your problems when using the framework.

LiteFlow has 2000 test cases and more. Complete documentation and comprehensive test case coverage guarantee the stability of LiteFlow framework!

Looking forward to your use

AI Agent Orchestration (New in v2.16.0)

Starting from v2.16.0, LiteFlow ships its own AI Agent module, liteflow-react-agent.

It is not a simple "LLM component". Instead, it wraps a full ReAct (Reasoning + Acting) Agent into a standard LiteFlow component — one component is one Agent. You only declare a component and implement a few simple methods; talking to LLM providers, multi-turn conversation memory, and the Skills system are all handled for you by the module.

Once an Agent becomes a LiteFlow component, it automatically inherits the full orchestration power of LiteFlow. You write rules exactly the way you always have — except one of the nodes is now a thinking AI:

// Sequential orchestration, the AI node naturally sits between business nodes
THEN(prepare, deepseekAgent, recordReply);

// Let two different LLMs analyze the same question in parallel
WHEN(deepseekAgent, qwenAgent);

// Route to different Agents based on a condition
IF(isMath, mathAgent, deepseekAgent);

// Multi-Agent collaboration: parallel analysis + aggregated decision
THEN(prepare, WHEN(analyzerAgent, riskAgent), summaryAgent, notify);

None of THEN, WHEN, IF, SWITCH or FOR here is newly invented for AI — they are the same orchestration operators LiteFlow has used for years. If you can orchestrate LiteFlow, you can orchestrate AI.

The module connects to mainstream LLM platforms — OpenAI, Claude, Gemini, DeepSeek, Qwen (DashScope), Kimi, GLM and more — and provides multi-turn conversation memory, the Skills system, workspace file tools, streaming output, and so on. Switching models is basically a one-line change to model().

Note: The AI Agent module is built on agentscope-java and requires JDK 21+ at runtime. See the official documentation for the full usage guide.

Sponsors

驰骋工作流引擎

FastBee物联网平台

速众 AI 低代码开发平台

Easysearch

DISCORD LINK

Discord Link: https://discord.gg/MpdBSBnFTu

WECHAT OFFICIAL ACCOUNT

Since the community group is over 200 people, you need to be invited to join the group. Follow the WECHAT OFFICIAL ACCOUNT and click Personal WeChat to add me, I can invite you into the group

official-wx

Open source is not easy, please sponsor LiteFlow if you support it

support