feat: 归档 XL10 异步工具业务编译层

- 将 AgentDefinitionCompiler 升级为 AgentRuntimeCompiler

- 接入 Workflow 和 Plugin 的同步/异步工具编译与 Redis 任务态

- 增加异步执行配置开关、聊天时间线聚合和后端测试
This commit is contained in:
2026-06-04 15:23:56 +08:00
parent 1ea863cb2c
commit c316eff5be
26 changed files with 2859 additions and 62 deletions

View File

@@ -10,6 +10,7 @@ public class EasyFlowThreadPoolProperties {
private Pool sse = new Pool(4, 16, 2000, 30, true);
private Pool documentImport = new Pool(2, 4, 200, 60, true);
private Pool agentAsyncTool = new Pool(2, 8, 200, 60, true);
/**
* 获取 SSE 线程池配置。
@@ -47,6 +48,24 @@ public class EasyFlowThreadPoolProperties {
this.documentImport = documentImport;
}
/**
* 获取 Agent 异步工具后台执行线程池配置。
*
* @return Agent 异步工具线程池配置
*/
public Pool getAgentAsyncTool() {
return agentAsyncTool;
}
/**
* 设置 Agent 异步工具后台执行线程池配置。
*
* @param agentAsyncTool Agent 异步工具线程池配置
*/
public void setAgentAsyncTool(Pool agentAsyncTool) {
this.agentAsyncTool = agentAsyncTool;
}
/**
* 线程池配置项。
*/

View File

@@ -78,4 +78,30 @@ public class ThreadPoolConfig {
executor.initialize();
return executor;
}
/**
* 创建 Agent 异步工具后台执行线程池。
*
* @return Agent 异步工具执行线程池
*/
@Bean(name = "agentAsyncToolExecutor")
public ThreadPoolTaskExecutor agentAsyncToolExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
EasyFlowThreadPoolProperties.Pool pool = properties.getAgentAsyncTool();
executor.setCorePoolSize(pool.getCoreSize());
executor.setMaxPoolSize(pool.getMaxSize());
executor.setQueueCapacity(pool.getQueueCapacity());
executor.setKeepAliveSeconds(pool.getKeepAliveSeconds());
executor.setAllowCoreThreadTimeOut(pool.isAllowCoreThreadTimeout());
executor.setThreadNamePrefix("agent-async-tool-");
executor.setRejectedExecutionHandler((runnable, executorService) -> {
log.error("Agent异步工具线程池过载核心线程数{},最大线程数:{},队列任务数:{}",
executorService.getCorePoolSize(),
executorService.getMaximumPoolSize(),
executorService.getQueue().size());
throw new BusinessException("Agent 异步工具任务繁忙,请稍后重试");
});
executor.initialize();
return executor;
}
}