agentsflex.com
Pricing plans
Detailed pricing plans are not available yet for this tool.
Detailed overview
Skip to contentAgents-Flex一个轻量的 AI 智能体开发框架Java 生态首选 | 支持 MCP、AI Skills 与智能问数快速开始帮助文档MCP (Model Context Protocol)原生支持 Model Context Protocol,标准化连接外部数据与工具,打破模型孤岛,实现更广泛的上下文交互。AI Skills将复杂能力封装为可复用的 AI Skills,简化 Agent 构建流程,支持技能的快速编排与动态加载。智能问数 (Text2SQL)内置自然语言查询数据库能力,支持 Text2SQL 与数据分析,让业务人员通过对话即可获取数据洞察。LLMs (大语言模型)支持市场主流大模型及 Ollama 本地部署,内置 HTTP、SSE、WS 等多种网络协议,轻松对接私有化模型。Tool内置灵活的 Tool Calls 组件,支持本地方法定义、解析与回调执行,几行代码即可实现工具调用。RAG 知识库提供 Loader、Parser、Splitter 完整链路,支持多种数据源加载与切片,轻松构建企业级知识库应用。Vector & Embedding内置多种向量数据库与 Embedding 实现,支持自定义扩展接口,为语义检索提供高效、灵活的底层支持。Prompt 工程提供丰富的 Prompt Framework 支持(FEW-SHOT、CRISPE 等),支持模板自定义,优化模型输出质量。Memory 管理提供 MessageMemory 和 ContextMemory,灵活管理多轮对话历史与会话状态,支持自定义扩展以满足复杂场景。
---
Skip to contentMenu当前页导航Agents-Flex 轻量 · 高性能 · 跨厂商的 Java AI 智能体开发框架。Agents-Flex 简介 Agents-Flex 是一个由 Java 编写的、轻量且高性能的 AI 智能体开发框架,用于统一封装各大 LLM 厂商(OpenAI、Qwen、DeepSeek、Moonshot、Ollama 等)的 API,极大简化构建 AI 应用的开发成本。框架的灵感来源于 LangChain、LlamaIndex,并结合作者在实际企业级 AI 应用中的工程经验,提供:统一的模型调用 API标准化的工具(Function Calling)能力跨服务商的可移植性高扩展性与可观测性与任何 Java 技术栈无耦合适用于 聊天对话、图像生成、Embedding、Function Calling、RAG 等多种 AI 场景。Agents-Flex 的核心特性 1. 简单易用(开箱即用) 无需复杂配置,几行代码即可完成一次完整的 AI 对话:java@Test
public void testChat() {
String output = OpenAIChatConfig.builder()
.endpoint("https://ai.gitee.com")
.provider("GiteeAI")
.model("Qwen3-32B")
.apiKey("PXW1****D12")
.buildModel()
.chat("你叫什么名字");
System.out.println(output);
}零框架绑定:可在 Spring、Quarkus、Micronaut、Servlet 甚至裸 Java 环境中直接使用。2. 高性能(轻量架构 + 高效实现) Agents-Flex 的核心结构极其轻量,无多余依赖,不强制引入 ORM、Web 框架或大型中间件。性能优势包括:最小依赖设计:核心仅依赖少量基础组件,JAR 小、无臃肿高效 I/O 调用链:支持高性能 HTTP Client(如 OkHttp、Apache HttpClient、Vert.x)流式(SSE)性能优化:流式响应开销极低按需加载机制:仅加载使用到的模型厂商,不浪费资源零 GC 压力的拦截器链:责任链设计极简,减少中间对象创建适合高并发场景,例如 Chat 服务、智能客服、AgentHub、高流量 API 服务等。3. 生产级可观测性(零侵入) 内置 OpenTelemetry,对 LLM 调用与工具(Tool)提供端到端监控:自动埋点:请求次数、延迟、错误率链路追踪:每次调用自动生成 Span同步 / 流式 统一监控按 provider、model、operation、tool 维度打标动态关闭和排除特定工具监控自动脱敏密码/token 字段默认 logging 导出,可切换 OTLP 对接 Jaeger、Tempo、Grafana、Datadog 等无需写一行监控代码即可直接上生产。4. 责任链架构(超强扩展性) 通过责任链模式(Chain of Responsibility)管理所有拦截逻辑:LLM 调用链工具(Function Calling)调用链你可以在任意阶段插入:重试鉴权日志限流A/B 测试自定义路由无需修改核心逻辑,开发体验极其灵活。5. 协议与实现彻底解耦(多厂商接入超容易) 两个抽象层:ChatClient:负责 HTTP/gRPC/WebSocket 通信ChatRequestSpecBuilder:负责不同厂商的请求格式构建要接入一个新的 LLM 厂商,只需:✔ 实现 ChatClient✔ 实现 ChatRequestSpecBuilder不需改动 Agent-Flex 核心框架。6. 流式与同步统一 API 无论是:chat() (同步)chatStream()(流式)两者共享:拦截器链上下文结构可观测逻辑错误处理方式让实时聊天、后台批处理、长连接推流等场景都能保持 一致的代码结构与可维护性。示例代码 javaChatModel model = OpenAIChatConfig.builder()
.endpoint("https://ai.gitee.com")
.provider("GiteeAI")
.model("Qwen3-32B")
.apiKey("PXW1****D12")
.buildModel();同步接口 javaString output = model.chat("介绍一下你自己");流式接口 javamodel.chatStream("解释一下 Java Stream 机制", delta -> {
System.out.print(delta);
});生态项目 作者还开源了多项 AI 相关项目,与 Agents-Flex 可以完美搭配:Tinyflow – https://tinyflow.cn轻量、高性能的 AI 工作流编排引擎(可与 Agents-Flex 深度集成,也支持 SpringAI、LangChain4j 等产品)AIFlowy – https://aiflowy.tech基于 Java 的企业级开源 AI 应用平台,对标 Dify、Coze、腾讯元器等产品AiEditor – https://aieditor.com.cn面向 AI 创作与公文写作的下一代富文本编辑器安装依赖 Maven:xml
com.agentsflex
agents-flex-bom
最新版本
Gradle:gradleimplementation("com.agentsflex:agents-flex-bom:最新版本")参与贡献 欢迎一起完善 Agents-Flex! 无论是 Issue、PR 还是新模型厂商的接入都非常欢迎。https://gitee.com/agents-flex/agents-flexLicense Agents-Flex 使用 Apache-2.0 协议开源。
---
Skip to contentMenu当前页导航Agents-Flex ChangeLog v2.0.6 20260325 fix(chat): handle null metadata in ChatOptions builderrefactor(core): replace addMetadata with putMetadata in document operationsfeat(chat): add metadata support to ChatOptionsrefactor(config): update package structure and configuration importsrefactor(model): move chat model classes from llm package to model.chat packagerefactor(chat): extend ChatOptions from Metadata classv2.0.5 20260318 test(milvus): update test collection name and add document metadatatest(file2text): add test case for http xlsx to text conversionfeat(extractor): add Excel file extraction supportrefactor(core): change vector data type from double to float and update setVector methodrefactor(store): change score type from Double to Float across vector storesrefactor(store): optimize Milvus vector store connection managementfeat(demo): enhance skills demo with logging and output improvementstest(openai): add Bailian Qwen model integration testfeat(store): add Milvus vector store implementationfix(store): improve error handling in vector store operationsfeat(store): add Milvus vector store implementationrefactor(store): change visibility of vector and score fields in VectorDatarefactor(store): update StoreResult to use message and exception instead of failReasonfeat(store): add partition names support to SearchWrapperrefactor(document): remove score field and update metadata handlingv2.0.4 20260312 feat(text2sql): optimize table building logic for JDBC data sourcesrefactor(core): optimize OpenAI chat message serializer parameter handlingfeat(openai): add location-based weather tool functionalityfeat(tools): enhance method tool parameter handling with JSON Schema mappingfeat(tool): enhance MethodTool with proper JSON Schema type mappingfixed: es search bug, by nottyjay 2026/3/10 13:52fixed: chromadb bug, by nottyjay 2026/3/10 11:57v2.0.3 20260306 feat: Search engines support element data filteringfeat(parser): Support latest vllm output format with multiple possible reasoning field namesv2.0.2 20260304 feat(file2text): add encoding detection utility for file extractionfix(template): update ChartConfigTool markdown template formatfeat(text2sql): add chart configuration tool for data visualizationrefactor(text2sql): enhance tool descriptions and parameter validation for SQL query toolsrefactor(core): simplify tool calls check in AiMessageResponsev2.0.1 20260302 docs(nav): update Text2SQL menu item text in Chinese documentationrefactor(text2sql-demo): remove unused table name configurationdocs(chat): update text2sql development documentationfeat(text2sql): enhance SQL validation with structured resultschore(build): update maven configuration and exclude demo modules from publishrefactor(text2sql): replace filter functions with collection-based table and column filteringdocs(chat): update text2sql documentation referencesfeat(text2sql): add SQL validation and rewriting components with entity refactoringchore(project): rename data module to text2sqlv2.0.0 20260301 docs(readme): update documentation with comprehensive framework overviewdocs(intro): update framework description from application to agent developmentdocs(homepage): update homepage content to reflect new framework featuresdocs(chat): update MCP documentation with configuration structure and protocol detailsdocs(chat): update skills documentation titledocs(nav): add Text2SQL documentation to navigation menufix(config): update model configuration to use Qwen3.5-35B-A3Bperf(prompt): increase max attached message count limitfix(demo): update model configuration and improve stream output handlingrefactor(SseClient): reorder method execution sequencefix(chat): add stack trace printing in stream response failure handlingchore(i18n): translate Chinese comments and strings to English in DataToolsfeat(mcp): add streamable transport support to MCP clientfeat(data): initialize JDBC data source tables during tool buildingstyle(data-demo): comment out unused datasource description and user querychore(project): update copyright and add data modulefeat(demos): add data demo module with JDBC integrationfeat(data): add agents-flex-text2sql modulestyle(skills): remove excessive indentation from tool description templatefeat(util): add high-performance type converter utilityfeat(util): add numeric string validation methodfeat(tool): enhance method parameter type handling with generic supportrefactor(convert): remove converter implementations and servicedocs(chat): add comprehensive skills documentation for AgentsFlex frameworkdocs(readme): add skills capability to documentationfix(skills): update demo to handle PDF generation and improve response handlingfeat(message): add hasToolCalls method to AiMessagechore(deps): update dependency versions to use revision propertyfeat(skills): add AI tutor skill with YouTube transcript capabilityfeat(project): add demos module with helloworld examplefeat(skill): add skills modulefeat(tool): replace shell module with commons module for enhanced toolingrefactor(prompt): simplify message imports and enhance MemoryPrompt APIfix(tool): set default type to string for Parameter classrefactor(memory): update addMessages method signature to use wildcard typechore(samples): remove hello world sample project and related filesfeat(tool): enhance MethodTool to automatically extract enum values from parameter typesv2.0.0-rc.9 20260225 refactor(mcp): replace hardcoded "stdio" with DEFAULT_TRANSPORT_TYPE constantfeat(mcp): add SSE transport supportv2.0.0-rc.8 20260225 refactor(client): update reflection field access in HttpStreamTransportFactoryfeat(client): add environment variables support to stdio transport factoryfeat(client): add http transport factory supportrefactor(client): remove hardcoded request timeout in McpClientDescriptorrefactor(client): simplify StdioTransportFactory implementationfeat(client): enhance HTTP SSE transport with header customization and URL trimmingchore(build): ignore .env files in version controlchore(build): update MCP version and remove unused dependencytest(client): add unit tests for MDLMcpClientManagerrefactor(mcp): update JSON mapper and enhance transport configurationdocs(agent): update ReAct agent prompt template documentationv2.0.0-rc.7 20260213 feat: Alibaba Cloud vector failure returns reason for failurefix: ElasticSearch retrieval failure issuev2.0.0-rc.6 20260127 fix(core): update message retrieval and context handling in streaming componentsfeat(http): add proxy authentication support to OkHttpClientUtilfeat(github): add issue templates for bug reports and documentation feedbackv2.0.0-rc.5 20260127 feat(core): add JSON error message detection and enhance embedding model error handlingfeat(test): add ChatOptions support and enhance stream testing utilitiesrefactor(chat): rename extra field to extraBody in ChatOptionsfix(stream): handle failure flag properly in stream client listenerrefactor(core): remove unused string utility and simplify thinking protocol logicrefactor(chat): rename variable for clarity in OpenAI request builderrefactor(chat): rename extra field to extraBody in ChatOptionsrefactor(chat): remove default thinking protocol handling and add dynamic protocol detectionfeat(chat): add thinking protocol support for chat configurationsv2.0.0-rc.4 20260123 fix: Optimizing Alibaba Cloud vector database vector failure promptfeat(embedding): add dimensions and user support to embedding optionsfeat(document): add MarkdownHeaderSplitter for hierarchical document splittingfeat(chat): add reasoning content support for tool messages in chat configurationv2.0.0-rc.3 20260112 feat(readme): add MCP capabilities to the list of featuresfix(openai): remove unsupported top_k parameter from openai requestfix(openai): handle JSON parsing errors in OpenAI chat clientrefactor(ollama): update configuration defaults and parameter namingchore(ollama): clean up request spec builder coderefactor(qwen): remove response format option from QwenChatOptionsfeat(chat): add response format support to chat optionschore(build): remove mvn17.sh scriptfeat(mcp): add methods to access client descriptor and health checkerv2.0.0-rc.2 20260108 fix(deps): update POI dependencies and remove slf4j-simplefix(http): add null check for request headers in HttpClientv2.0.0-rc.1 20260106 fix(OpenAIChatMessageSerializer): Added null check for parameters array to prevent NPEv2.0.0-beta.9 20260105 refactor(stream): remove content check in stream client listenerfix(mcp): handle duplicate client registration properly prevent resource leaks when client is re-registeredrefactor(message): rename shouldNewCall method to isNewCall for clarityrefactor(message): optimize tool call comparison logic in AiMessagetest(openai): update OpenAI chat model test with tool call supportv2.0.0-beta.8 20260104 fix(observability): correct OpenTelemetry propagator detection logicfix(observability): improve OpenTelemetry SDK registration checkfeat(observability): add OpenTelemetry SDK reuse checkv2.0.0-beta.7 20260104 refactor(docs): update MCP client method name in documentationdocs(chat): update MCP documentation with JDK version requirementschore(build): set maven compiler properties to Java 8docs(chat): add comprehensive MCP client integration guiderefactor(client): rename getClient to getMcpClient for clarityrefactor(mcp): move client-related classes to dedicated packagetest(mcp): add comprehensive unit tests for McpClientManagerfeat(config): add MCP server configuration file and Added mcp-servers.json with everything server configuration for testrefactor(mcp): replace McpRootConfig with McpConfig for server specificationsfeat(mcp): add exception handling for MCP tool callsfix(mcp): handle null and single text content in tool invocationfeat(mcp): add MCP tool retrieval functionalityfeat(mcp): add McpTool implementation for MCP tool integrationfeat(tool): add defaultValue property to Parameter classchore(license): Updated copyright year from 2025 to 2026(mcp):feat add Model Context Protocol client management modulev2.0.0-beta.6 20251230 refactor(core): Replace clearFullMessage with finalizeFullMessage to properly handle contentfix(stream): clear full message content on stream completiontest(openai): update OpenAI chat model test configuration and weather functionrefactor(OpenAIChatMessageSerializer): update tool message handling and serializationfeat(chat): add tool message support with compatibility for models that don't support native formatrefactor(chat): update ChatConfig tool support methods and remove unused fieldtest(utils): add ChatModelTestUtils for stream testingrefactor(stream): simplify message handling and stop logic in BaseStreamClientListenerrefactor(message): update AiMessage delta completion logicv2.0.0-beta.5 20251219 test(openai): remove unnecessary thread sleep in chat model testsfeat(chat): add includeUsage option for streaming responsesfeat(openai): add stream chat test for bailian modelfeat(core): add stopped flag and improve stream listener logicfix(stream): handle final delta correctly in stream client listener and Wrapped final message notification in try-finally blockfeat(openai): add support for extra options in chat requestdocs(models): update embedding model translationv2.0.0-beta.4 20251210 fix(core):优化AI消息增量更新的空值判断fix(core):修复工具调用合并逻辑chore(deps): 移除嵌入模型相关依赖配置fix(message):优化 ToolCall 参数解析逻辑feat(core):优化聊天模型和客户端实现fix: embedding module packagingfeat(bom): 添加嵌入模型依赖项v2.0.0-beta.2 20251202 修复:修复 Maven 依赖异常,更新版本号,感谢 @jievenv2.0.0-beta.1 20251126 移除 Chain 模块,合并到 Tinyflow移除 documentParser 模块移除 DocumentLoader 模块新增 file2text 模块新增 observability 模块新增 RAG 执行 AI 对文档进行拆分修改 LLM 为 ChatModel修改 LLMClient 为 StreamClient修改 LLMClientListener 为 StreamClientListener修改 LLMConfig 为 ChatConfig修改 Function 为 Tool重命名 PromptFormat 为 MessageFormat重命名 TextPromptTemplate 为 PromptTemplate重命名 TextPrompt 为 SimplePrompt重命名 HistoriesPrompt 为 MemoryPrompt重命名 HumanMessage 等合并为 UserMessagev1.4.2 20251117 新增:新增本地 Token 计算的相关内容,方便在某些情况下无法获取外部 token 时使用新增: 新增 file2text 模块新增: Chain 支持主动去 暂停执行 或 恢复执行新增:feat: 新增可观测的相关能力优化:重构移动 ReAct 的包到 agents 目录下优化:优化 Chain.addEdge 自动为没有 id 的 edge 添加 id优化:Chain.addNode 自动为 node 添加 inwardEdges 和 outwardEdges优化:优化 ChainHolder 的属性类型定义,方便准确序列化优化:ChainEdge 移除无用的定义v1.4.1 20251023 新增:prompt 格式化新增 default 取值语法优化:优化 chain.get 方法获取数据的性能优化:移除 gitee 旧的 api 支持(官方已下架)v1.4.0 20251020 修复: computeCost 可能等于 null 而出现 NPE 的问题v1.3.9 20251019 新增: 添加 Chain 关于算力消耗配置的功能新增: Chain 添加 loopNodeExecutionLimit 配置,保护由于用户配置不当可能造成死循环执行的问题新增: 优化监听器,当多个监听器发生时,有监听器发生错误不影响其他监听器执行新增: Node 支持配置积分消耗的计算逻辑和表达式新增: Chain 的取值支持三目运算修复:避免截断后添加 systemMessage 时导致 memory 中的 systemMessage 越来越多v1.3.8 20251010 新增:图片消息添加多张图片的支持新增:大模型节点添加图片识别的能力新增:大模型节点支持多种 json 格式输出优化:优化 okHttpclient 的请求机制,更轻量化优化:优化 OkHttpClientUtil 的配置支持环境变量优化:ImageUtil 支持自动添加 base64 url 前缀v1.3.7 20250929 新增:支持 Chroma 向量数据库(1.1.10),目前只支持单租户,单数据库(有默认且可配置),感谢 @joe.wen新增:TextPromptTemplate.formatToString 添加 escapeJson 参数配置的支持v1.3.6 20250924 修复:ConfirmNode 必须勾选必填才能正确进行数据确认的问题v1.3.5 20250917 新增: 新增 ChainNodeValidator 用于给 Node 自定义其验证器新增: 新增 ChainNode.validate 方法,用于校验其数据是否完善新增: 工作流执行新增节点算力消耗的定义新增: getParameterValues 通过 LinkedHashMap 返回属性,支持参数顺序优化:优化 HumanMessage 类的函数处理逻辑优化: 重构 Chain 的验证逻辑修复: 修复 Parameter 为非必填,但是也必须输入参数的问题修复: 在 js 执行节点可能出现 java.lang.NoClassDefFoundError: com/ibm/icu/number/Notation 错误的问题修复:正则表达式 Action Input: (\{.?}) 在匹配时会漏掉最后一个 "}" 的问题,感谢 @狂野流星v1.3.4 20250817 新增:Parameter 新增 formPlaceholder 属性v1.3.3 20250806 优化:优化合并 ConfirmParameter 到 Parameter,以支持更多的场景v1.3.2 20250731 优化:优化 AiMessageResponse.getFunctionCallers 方法修复:多轮 tool call 时,获取最后一条 HumanMessage 错误的问题修复:Chain 的 Parameter 类型为 Array 时,内容固定值无法解析的问题v1.3.1 20250722 新增:ChatOptions 新增 extra 配置,用于自定义大模型的参数内容修复:节点异步执行的情况下,可能出现 check 不正确的问题修复:jsExecNode 无法转换结果为 JsonObject 的问题优化:优化 getNodeContext 方法,只需要传入 id 值优化:移除 Moonshot ,使用 openai 替代v1.2.9 20250718 优化:优化 parent 和 children 的过度设计,使之逻辑更加简洁修复:修复 Node 包含子的 chain 时,会导致 json 解析错误的问题v1.2.8 20250715 新增: ReActAgent 添加 ChatOptions 的设置能力新增: ConfirmParameter 添加更多的配置参数支持优化: 优化 getParameterValues 的错误信息优化: 移除 chain 非必要的 error 日志优化: 优化 Chain.getParameterValuesv1.2.7 20250713 新增:代码执行节点添加 “_context” 对象新增:新增 Chain.toJSON() 和 Chain.fromJSON() 方法新增:新增 ConfirmNode 用于支持用户手动确认的场景优化:优化 Chain.getParameterValues 方法优化:移动 Chain 监听器的相关类到 listener 包里去v1.2.6 20250709 新增: Chain 新增 getNodeExecuteResult 方法优化:优化重构 EdgeCondition 和 NodeCondition 方法v1.2.5 20250707 新增:新增 Audio 多模态的支持新增:新增 ReActMessageBuilder,允许用户构建自定义的消息优化:feat: 修改 TextAndImageMessage 和 TextAndAudioMessage 为 HumanImageMessage 和 HumanAudioMessage修复:DeepseekLlm 无法自动注入,配置 factories 文件v1.2.4 20250701 新增:在节点执行出错时,添加必要的错误日志输出新增:大模型 Parameter 添加子 Parameter 的配置支持新增:ReActAgent 添加 continueOnActionJsonParseError 和 continueOnActionInvokeError 配置修复:修复 EmbeddingModel.dimensions() 错误信息不友好的问题修复:tool call第二次请求模型时缺少了tools信息 close #ICG584v1.2.3 20250626 新增:节点添加循环执行的配置能力新增:新增 starter 中 deepseek 的配置支持,openai 可以指定 chatpath 属性新增:OpenAILlm 支持自定义 HttpClient优化:优化 bom 模块依赖冲突 close #ICG2TD优化:优化 ReActAgent 代码,新增更多的监听支持优化:优化 OkHttpClientUtil 的默认参数优化:重命名 JavascriptStringCondition 为 JsCodeCondition修复:修复 Gitee 生成图片错误的问题文档:更新 chain 的相关文档文档:更新优化 LLM 示例代码文档:优化 prompt 示例代码文档:节点循环示例代码v1.2.2 20250618 新增:新增 es 和 lucene 搜索引擎v1.2.0 20250614 新增:新增 "default" rerank 模型,用于对接多个不同的 rerank 服务新增:新增 ReAct Agent优化:挂起-恢复执行逻辑优化,每次执行节点移除挂起节点列表中该节点v1.1.8 20250605 新增:阿里云增加余弦相似度得分回显修复: 修正 Milvus 下 COSINE 相似度计算方法v1.1.7 20250604 修复:使用 qwen-plus 调用 function_call 没有正确拼接大模型返回的参数问题修复: 修复 DeepseekLlmUtil 类型转换错误修复: HistoriesPrompt 的 toMessages 可能多次添加 systemMessage 的问题v1.1.5 20250603 修复:修复 CodeNode 的 js 无法通过 "." 调用 map 数据的问题v1.1.4 20250530 新增: 为 ChainStartEvent 和 ChainResumeEvent 添加获取初始化参数的功能优化: 优化 JsExecNode 在每次执行脚本时新建一个独立 Context优化: 优化 Event 的 toString修复: node 的状态在执行时未自动变化的问题v1.1.3 20250527 修复:修复阿里云百炼 text-embedding-v3 向量化使用 milvus 使用默认向量模型导致两次维度不一致问题修复:qwen3 非流式返回设置 enable_thinking 为 falsev1.1.2 20250524 新增: StreamResponseListener 添加 onMatchedFunction 方法新增: 添加 openai 兼容 api 的其他第三方 api 测试优化: 添加 FunctionPrompt 的 toString 方法优化: 优化 ImagePrompt 的方法优化: 优化 ToolPrompt 支持多个方法调用优化: 优化 Stream 模型下的 Function Call优化: 优化 SseClient 的 tryToStop 方法优化: 优化 FunctionCall 以及添加 toString 方法优化: 优化 OpenAILlm.javav1.1.1 20250522 新增:新增 NodeErrorListener 用于监听 node 的错误情况优化:重构 ChainErrorListener 的参数顺序优化:优化 getParameterValues 的默认值获取v1.1.0 20250516 优化:增强 LLM 的 markdown 包裹优化优化:重命名 StringUtil.obtainFirstHasText 方法名称为 getFirstWithText修复:修复大模型节点,返回 json 内容时不正确的问题修复:修复 EndNode 在输出固定值时出现 NPE 的问题v1.0.9 20250513 新增: Chain 添加 reset 方法,使之调用后可以执行多次优化:不允许设置默认 EmbeddingOptions 配置的 encodingFormat优化:修改模型思考过程的设置,让 content 和 reasoningContent 输出内容一致,感谢 @Alexv1.0.8 20250511 优化:优化 elasticSearch 用户自定义集合名称就用用户自定义集合,没有传就用默认集合名称优化:从命名 TextPromptTemplate.create 方法名称为 TextPromptTemplate.of,更加符合 “缓存” 的特征修复:修复 openSearch 存储报错问题文档:添加提示词相关文档文档:添加 “模板缓存” 的相关文档测试:添加 milvus 向量存储用法示例测试类,感谢 @lygv1.0.7 20250508 新增: 添加 Milvus 的相识度返回新增: Chain.getParameterValues 添加对固定数据格式填充的能力优化: Parameter 添加 dataType 默认数据优化: TextPromptTemplate.create 添加缓存以提高性能v1.0.6 20250507 新增: 增加 qdrant 向量数据库支持优化: 重构 TextPromptTemplate,使其支持更多的语法优化: 优化 pom 管理v1.0.5 20250430 新增: 允许通过 ChatOptions 在运行时动态替换模型名称新增:增加是否开启思考模式参数,适用于 Qwen3 模型新增:Document 增加文档标题新增:增强知识库查询条件新增:优化 Chain 的 get 逻辑,支持获取对象的属性内容测试:添加通过 OpenAI 的 API 调用 Gitee 进行图片识别测试:添加 chain 的数据获取测试v1.0.4 20250427 新增: 为 VectorData 添加 score 属性,统一文档 score 字段优化:重构 Chain 的异步执行逻辑v1.0.3 20250425 新增: deepseek-r1 推理过程增量输出改为完整输出和内容的输出保持一致,感谢 @liutf新增: 增加 QwenChatOptions,让通义千问支持更多的参数,感谢 @liutf新增:新增 ChainHolder,用于序列化 ChainNode,以支持分布式执行优化:优化 Chain,在暂停时抛出异常v1.0.2 20250412 feat: add JavascriptStringConditionrefactor: move "description" property to ChainNodetest: add ChainConditionStringTest新增:添加 JavascriptStringCondition 条件重构:移动 "description" 属性到 ChainNode测试:添加 ChainConditionStringTest 测试v1.0.1 20250411 fix: LlmNode can not return the correct result if outType is textfix: TextPromptTemplate can not parse 修复:修复 LlmNode 当配置 outType 时,不能返回正确结果的问题修复:TextPromptTemplate 无法可以解析 的问题v1.0.0 20250407 fix: fixed NodeContext.isUpstreamFullyExecuted() methodfeat: add "concurrencyLimitSleepMillis" config for SparkLlmfeat: openai add chatPath config and embed path configfeat: HistoriesPrompt add temporaryMessages config修复:NodeContext.isUpstreamFullyExecuted() 方法判断错误的问题新增: SparkLlm 添加 concurrencyLimitSleepMillis 配置新增: openai 添加 chatPath 配置和 embed path 配置新增: HistoriesPrompt 添加 temporaryMessages 配置v1.0.0-rc.9 20250331 feat: Added support for vector database Pgvector, thanks @daxian1218feat: Chain added "SUSPEND" state and ChainSuspendListener listenerfeat: Chain's RefType added "fixed" type.feat: Chain's Parameter added "defaultValue"feat: Chain added ChainResumeEvent eventfeat: ChainNode added "awaitAsyncResult" property configurationrefactor: Return the complete response and answer information of coze chat to obtain complete information such as conversation_id, thanks @knowpigxiarefactor: Optimize the implementation details of RedisVectorStorerefactor: Chain removed OnErrorEvent and added ChainErrorListener insteadrefactor: Rename BaseNode's "getParameters" method to "getParameterValues"refactor: Rename Chain's event and remove the On prefix新增:新增向量数据库 Pgvector 的支持,感谢 @daxian1218新增:Chain 新增 "SUSPEND" 状态以及 ChainSuspendListener 监听新增:Chain 的 RefType 新增 "fixed" 类型。新增:Chain 的 Parameter 新增 "defaultValue"新增:Chain 新增 ChainResumeEvent 事件新增:ChainNode 新增 "awaitAsyncResult" 属性配置优化:返回 coze chat 完整的 response、answer 信息,以便获取 conversation_id 等完整信息,感谢 @knowpigxia优化:优化 RedisVectorStore 的实现细节优化:Chain 移除 OnErrorEvent 并新增 ChainErrorListener 代替优化:重命名 BaseNode 的 "getParameters" 方法为 "getParameterValues"优化:重命名 Chain 的事件,移除 On 前缀v1.0.0-rc.8 20250318 feat: Added LLM support for siliconflow, thanks @daxian1218feat: Chain's dynamic code node supports running Javascript scripts, thanks @hhongdafeat: Removed deepseek's invalid dependency on openai module, thanks @daxian1218feat: Optimized EmbeddingModel and added direct embedding of String新增:新增 LLM 对 siliconflow(硅基流动)的支持,感谢 @daxian1218新增:Chain 的动态代码节点支持运行 Javascript 脚本,感谢 @hhongda优化:移除 deepseek 无效的依赖 openai 模块,感谢 @daxian1218优化:优化 EmbeddingModel,添加直接对 String 的 embedv1.0.0-rc.7 20250312 feat: Added the tool of adding reasoning content to the return message, supporting deepseek's reasoning return, thanks @rirchfeat: Added support for vectorexdb embedded version, no need to deploy database separately, thanks @javpowerfeat: Added support for accessing Tencent's large model language, Wensheng graph model and vectorization interface, thanks @sunchanghuilinqingfeat: Support for docking Doubao doubao-1-5-vision-pro-32k multimodal model and Wensheng graph, thanks @wang110wyyfeat: Added Wensheng graph model of Alibaba Bailian platform, thanks @sunchanghuilinqingfeat: Added VLLM-based large model access, thanks @sunchanghuilinqingfeat: Added LogUtil for log outputfeat: Optimized the relevant code logic of DnjsonClientfix: The problem of too long uid of Spark large model, thanks @wu-zhihaofix: ChatStream of Ollama Llm An error occurred when actively closing the streamfix: Fixed an issue where the endpoint configuration of OllamaProperties was incorrect by default新增:添加在在返回消息中增加推理内容的功能,支持 deepseek 的推理返回,感谢 @rirch新增:添加 vectorexdb 内嵌版本支持,无需额外部署数据库,感谢 @javpower新增:添加接入腾讯大模型语言、文生图模型与向量化接口的支持,感谢 @sunchanghuilinqing新增:对接豆包 doubao-1-5-vision-pro-32k 多模态模型以及文生图的支持,感谢 @wang110wyy新增:新增阿里百炼平台的文生图模型,感谢 @sunchanghuilinqing新增:新增基于 VLLM 部署大模型接入,感谢 @sunchanghuilinqing新增:新增 LogUtil 用于输出日志优化:优化 DnjsonClient 的相关代码逻辑修复:星火大模型的 uid 太长的问题,感谢 @wu-zhihao修复:Ollama Llm 的 chatStream 主动关闭流时发生错误的问题修复:修复默认情况下 OllamaProperties 的 endpoint 配置错误的问题v1.0.0-rc.6 20250220 feat: Springboot's automatic configuration class for Ollamafeat: Added ToolPrompt tool to facilitate the use with Function Callrefactor: Change openAi to openAIrefactor: Optimize LlmNode and TextPromptTemplaterefactor: Upgrade related dependencies to the latest versionrefactor: Optimize the empty user prompt words defined during the LlmNode runtimerefactor: Move the package name of tools to the directory chatModel (destructive update!!!)refactor: Refactor InputParameter and OutputKey to merge into Parameter (destructive update!!!)fix: Use the openai interface to connect to the local ollama to build a large model, and multiple tool definitions are called abnormallyfix: Fix the problem that agents-flex-bom cannot pull group code新增:Springboot 对 Ollama 的自动配置类新增:新增 ToolPrompt 功能,方便配合 Function Call 的使用优化:修改 openAi 为 openAI优化:优化 LlmNode 和 TextPromptTemplate优化:升级相关依赖到最新版本优化:优化 LlmNode 运行期定义空的用户提示词优化:移动 tools 的包名到目录 chatModel(破坏性更新 !!!)优化:重构 InputParameter 和 OutputKey 合并到 Parameter(破坏性更新 !!!)修复:使用 openai 接口对接本地 ollama 搭建大模型,多个函数定义调用异常修复:修复 agents-flex-bom 无法拉群代码的问题v1.0.0-rc.5 20250210 feat: Added support for VectoRex vector databasefeat: Added support for DeepSeek large modelsfeat: ImagePrompt adds support for local files, Stream and Base64 configurationsrefactor: agents-flex-bom facilitates one-click import of all modules新增:添加 VectoRex 向量数据库的支持新增:增加 DeepSeek 大模型的支持新增:ImagePrompt 添加本地文件、Stream 和 Base64 配置的支持优化:agents-flex-bom 方便一键导入所有模块v1.0.0-rc.4 20241230 refactor: Use pom to build and only manage versionsrefactor: Optimize the relevant code of RedisVectorStorerefactor: BaseNode.getChainParameters() methodrefactor: Optimize Chain.executeForResult method优化: 采用 pom方式构建并只做版本统一管理优化: 优化 RedisVectorStore 的相关代码优化: BaseNode.getChainParameters() 方法优化: 优化 Chain.executeForResult 方法v1.0.0-rc.3 20241126 refactor: optimize Chain.executeForResult() methodrefactor: optimize Chain eventsfix: fixed Spark payload build errorfix: fixed qwen model unable to embed优化: 优化 Chain.executeForResult() 方法优化: 优化 Chain 的相关 event 事件修复: 修复星火大模型 payload 构建错误修复: 修复 qwen 大模型无法使用 Embedding 的问题v1.0.0-rc.2 20241118 feat: Gitee AI adds support for Function Callingfeat: HumanMessage adds support for toolChoice configurationrefactor: Optimize editing node BaseNode and Maps tool classes新增: Gitee AI 添加对 Function Calling 的支持新增: HumanMessage 添加 toolChoice 配置的支持优化: 优化编辑节点 BaseNode 和 Maps 工具类v1.0.0-rc.1 20241106 refactor: add BaseFunction.javafix: spark LLM can not support v4.0fix: fix code node can not get the parameters优化:新增 BaseFunction 类修复:修复星火大模型不支持 v4.0 的问题修复:修复代码节点无法获取参数的问题v1.0.0-rc.0 20241104 refactor: refactor chatModel apisrefactor: refactor chain and nodesrefactor: optimize agents-flex-solon-plugin @noear_admin优化:重构 chatModel api优化:重构 chain 链路 及其相关节点优化:优化 agents-flex-solon-plugin @noear_adminv1.0.0-beta.13 20241026 feat: add plugin for solon frameworkrefactor: optimize VectorStore delete methodsrefactor: optimize RedisVectorStore for sort by descrefactor: optimize SparkLLM embedding新增:添加 solon 添加新的插件支持优化: 重构 VectorStore 的 delete 方法优化: 优化 RedisVectorStore 的搜索排序优化: 星火大模型新增秒级并发超过授权路数限制进行重试v1.0.0-beta.12 20241025 refactor:add DocumentStoreConfigrefactor:optimize HistoriesPrompt.javarefactor: update pom.xml in agents-flex-bomrefactor: upgrade jedis version to "5.2.0"refactor: optimize RedisVectorStorefix: NoClassDefFoundError in jdk17: javax/xml/bind/DatatypeConverter 感谢 @songyinyin #I9AELG优化:添加 DocumentStoreConfig,向量数据库的配置都实现 DocumentStoreConfig优化:重构优化 HistoriesPrompt,使其支持更多的属性配置优化:更新 agents-flex-bom 的 pom.xml优化:升级 jedis 版本为 "5.2.0"优化:重构 RedisVectorStore 的错误信息,使之错误信息更加友好修复:修复 jdk17 下出现 NoSuchMethodError 问题,感谢 @songyinyin #I9AELGv1.0.0-beta.11 20240918 feat: GenerateImageRequest add negativePrompt propertyfeat: Maps Util add putOrDefault methodfeat: add siliconFlow image modelsfeat: ChatOptions add "seed" propertyfeat: Maps can put a child map by keyfeat: Ollama add options configfeat: Ollama tool calling supportfeat: add StringUtil.isJsonObject methodrefactor: BaseImageRequest add extend options propertyrefactor: make ImagePrompt to extends HumanMessagerefactor: ImageResponse add error flag and errorMessage propertiesrefactor: rename Image.writeBytesToFile to writeToFilerefactor: rename "giteesd3" to "gitee"refactor: optimize VectorData.toString新增:GenerateImageRequest 添加反向提示词相关属性新增:Maps 工具类添加 putOrDefault 方法新增:添加 siliconFlow 的图片模型的支持新增: ChatOptions 添加 "seed" 属性新增:Maps 可以 put 一个子 map 的功能新增:新增 Ollama 的函数调用(Function Calling)的支持新增:添加 StringUtil.isJsonObject 方法优化:重构 BaseImageRequest 类,添加 options 属性优化:重构 ImagePrompt 使之继承于 HumanMessage优化:重构 ImageResponse 类,添加 error 和 errorMessage 属性优化:修改 Image.writeBytesToFile 方法为 writeToFile优化:重命名 "giteesd3" 为 "gitee"优化:重构 VectorData.toString 方法v1.0.0-beta.10 20240909 feat: Added support for RedisStore vector storage, thanks to @giteeClassfeat: Added support for large model dialogues for Coze Bot, thanks to @yulongshengfeat: Automatic configuration of Springboot for ElasticSearch Store, thanks to @songyinyinfeat: Added support for Embedding of Tongyi Qianwen, thanks to @sssllgfeat: Added support for all text generation models of Gitee AI's serverlessfeat: Added support for all image generation models of Gitee AI's serverlessdocs: Corrected sample code errors in the documentation新增:添加 RedisStore 的向量存储支持,感谢 @giteeClass新增:新增 Coze Bot 的大模型对话支持,感谢 @yulongsheng新增: ElasticSearch Store 对 Springboot 的自动配置功能,感谢@songyinyin新增:新增通义千问的 Embedding 支持,感谢 @sssllg新增:新增对 Gitee AI 的 serverless 所有文本生成模型的支持新增:新增对 Gitee AI 的 serverless 所有图片生成模型的支持文档:修正文档的示例代码错误v1.0.0-beta.9 20240813 feat: add custom request header in openaiLLM https://github.com/agents-flex/agents-flex/issues/5feat: add https.proxyHost config for the http client, close https://github.com/agents-flex/agents-flex/issues/1feat: add SpringBoot3 auto config support @songyinyinfeat: add openSearch store support @songyinyinfix: fix config error in QwenAutoConfiguration @songyinyinfix: NPE in OpenAILLmUtil.promptToEmbeddingsPayloadfix: fix FunctionMessageResponse error in BaseLlmClientListener, @imayourefactor: update bom modulerefactor: optimize SparkLlm.java新增: 添加自定义 openaiLLM 请求 api 的支持 https://github.com/agents-flex/agents-flex/issues/5新增: 添加 https.proxyHost 配置的支持 https://github.com/agents-flex/agents-flex/issues/1新增: 添加对 SpringBoot3 自动配置的支持 @songyinyin新增: 添加使用 openSearch 用于向量数据存储的支持 @songyinyin修复: 修复 QwenAutoConfiguration 配置错误的问题 @songyinyin修复: 修复 OpenAILLmUtil.promptToEmbeddingsPayload 空指针异常的问题修复: 修复 FunctionMessageResponse 在某些情况下出错的问题, @imayou优化: 更新重构 bom 模块优化: 优化 SparkLlm.java 的相关代码v1.0.0-beta.8 20240714 feat: add "async" flag for the ChainNodefeat: add Ollama LLMfeat: add DnjsonClient for OllamaLlmrefactor: refactor ChainCondition.javarefactor: add throw LlmException if LLMs has errorrefactor: refactor DocumentParserrefactor: refactor chain modulerefactor: rename GroovyExecNode.java and QLExpressExecNode.javarefactor: add children property in Parameterrefactor: remove unused code AsyncHttpClient.javarefactor: use LlmException to replace LLMClientException fix: Milvus type mismatch for filed 'id'test: add LoopChain testtest: add ollama test use openai instancedocs: add Japanese README新增:为 ChainNode 添加 "async" 属性标识的设置新增:添加基于 Ollama 大语言模型的对接,非 openai 适配模式新增:新增 DnjsonClient 用于和 Ollama 的 stream 模型对接优化:重构 ChainCondition优化:chat 时当大语言模型发生错误时抛出异常,之前返回 null优化:重构 DocumentParser优化:Parameter 支持子参数的配置能力修复:Milvus 向量数据库当传入 number 类型是出错的问题测试:添加对 LoopChain 的测试测试:添加文使用 openai 兼容 api 对 Ollama 对接的测试v1.0.0-beta.7 20240705 feat: add image models supportfeat: add SimpleTokenizeSplitterfeat: add OmniParseDocumentParserfeat: add openai,stability AI and gitee-sd3 AI supportfeat: add moonshot supportfeat: add chain dsl supportrefactor: optimize chatModel clientsrefactor: optimize SparkLLMrefactor: optimize slf4j dependenciesrefactor: optimize Agent definerefactor: optimize chaintest: add .pdf and .doc parse testtest: add SimpleDocumentSplitterTest.java新增:新增图片模型的支持新增:新增 SimpleTokenizeSplitter 分割器新增:新增 OmniParseDocumentParser 文档解析器新增:新增 openai、stability ai 以及 gitee ai 对图片生成的支持新增:新增月之暗面的支持优化:优化 chatModel 客户端的细节优化:优化星火大模型的细节优化:优化 slf4j 依赖的细节优化:优化 Agent 和 Chain 的定义细节测试:添加 .pdf 和 .doc 的解析测试测试:添加文档分割器的测试测试:添加 token 文档分割器的测试v1.0.0-beta.5 20240617 feat: add ImagePrompt to send image to LLMfeat: chatOptions add topP/topK and stop configrefactor: rename TextMessage.java to AbstractTextMessage.javarefactor: refactor chatModel methodsrefactor: refactor FunctionMessageResponse.javarefactor: optimize HttpClient.java And SseClient.javafix: fix tool calling error in QwenLLMtest: add chat with image test新增:新增 ImagePrompt 用于发送图片对话的场景新增:对话模型下的 ChatOptions 添加 topK 和 topP 配置的支持优化:重命名 TextMessage 为 AbstractTextMessage优化:重构 LLM 的方法定义,使之更加简单易用优化:优化 HttpClient.java 和 SseClient.java 的相关代码修复:通义千问 QwenLLM 在 tool calling 下无法正常调用的问题测试:添加发送图片相关的测试内容v1.0.0-beta.4 20240531 feat: OpenAILlm support embedding model configfeat: add get dimensions method in EmbeddingModelfeat: SparkLlm support embeddingfeat: optimize MilvusVectorStorefeat: MilvusVectorStore add username and password configrefactor: optimize HttpClient.javarefactor: optimize AliyunVectorStorerefactor: update StoreOptions to extends Metadatarefactor: optimize StoreResult and Metadatafix: fix AIMessage tokens parse新增:OpenAILlm 添加自定义 embedding 模型的支持新增:EmbeddingModel 添加获取向量维度的支持新增:SparkLlm 星火大模型添加对 embedding 的支持新增:添加 Milvus 向量数据库的支持优化:优化 HttpClient 的代码优化:优化 AliyunVectorStore 的代码优化:优化 StoreOptions 和 Metadata 的代码修复:AIMessage 的 tokens 消耗解析不正确的问题v1.0.0-beta.3 20240516 feat:add "description" to agent for automatic arrangement by LLMfeat: StoreResult can return ids if document store successfeat: StoreOptions support set multi partitionNamesfeat: add DocumentIdGenerator for Document and Storefeat: add ChainException for Chain.executeForResultrefactor: rename "SimplePrompt" to "TextPrompt"新增:为 Agent 添加 description 属性,方便用于 AI 自动编排的场景新增:Agent 添加对 outputDefs 的定义支持新增:添加 DocumentIdGenerator 用于在对文档存储时自动生成 id 的功能新增:StoreOptions 添加多个 partitionName 配置的支持新增:当 Document 保存成功时,自动返回保存的 id优化:Chain.executeForResult 会抛出异常 ChainException修复:ChatGLM 的 Chat JSON 解析错误的问题测试:优化 SparkLlmTest 的测试代码文档:完善基础文档
---
Skip to contentMenuReturn to top快速开始 前言 在开始之前,我们假定您已经:熟悉 Java 环境配置及其开发熟悉 Java 构建工具,比如 Maven注意:需要确定您当前的环境必须是 Java 8 或者更高版本。Hello World 第 1 步:创建 Java 项目,并添加 Maven 依赖以下的 xml maven 依赖示例中,可能并非最新的 Agents-Flex 版本,请自行查看最新版本,并修改版本号。最新版本查看地址:https://search.maven.org/artifact/com.agentsflex/parentxml
com.agentsflex
agents-flex-bom
2.0.4
或者使用 Gradle:javaimplementation 'com.agentsflex:agents-flex-bom:2.0.4'2. 创建模型配置(以 OpenAI 为例) javaOpenAIChatConfig config = new OpenAIChatConfig();
config.setApiKey("your-api-key");
config.setModel("gpt-4o");3. 实例化 ChatModel javaChatModel chatModel = new OpenAIChatModel(config);4. 同步调用(简单文本) javaString response = chatModel.chat("你好,今天过得怎么样?");
System.out.println(response); // 输出完整回复5. 流式调用(实时逐片段接收) javachatModel.chatStream("请用 Java 写一个单例模式", new StreamResponseListener() {
@Override
public void onMessage(StreamContext context, AiMessageResponse response) {
// 使用 fullContent 获取当前已接收的完整内容
String fullText = response.getMessage().getFullContent();
String delta = response.getMessage().getContent(); // 仅本次增量
System.out.print(delta); // 实时输出增量(更流畅)
// 或 System.out.println(fullText); // 每次输出完整内容(覆盖式)
}
@Override
public void onStart(StreamContext context) {
System.out.println("[流式开始]");
}
@Override
public void onStop(StreamContext context) {
System.out.println("\n[流式正常结束]");
}
@Override
public void onFailure(StreamContext context, Throwable throwable) {
System.err.println("流式调用失败: " + throwable.getMessage());
}
});
Same category tools



