Practical overview
When it fits
Use Agents-Flex when a Java application needs a shared chat-model interface and a documented path from direct model calls to streaming, memory or broader agent and retrieval modules.
Who it is for
- Java developers adding chat-model calls to an application.
- Teams building multi-turn assistants that need to manage conversation history.
- Developers extending Java applications with agents, tools or document retrieval.
Documented uses
- Send synchronous prompts to an OpenAI or compatible chat service.
- Stream generated text incrementally to an interface.
- Preserve conversation messages across multiple model calls.
- Extend an application toward tool use, agents or retrieval workflows.
Requirements & limits
The documented chat quick start requires a model-service API key. The primary framework is described as supporting JDK 8 or later; MCP modules require JDK 17 or later.
- The documented Maven quick start uses agents-flex-chat-openai version 2.3.2; the documentation also provides a Gradle dependency example.
- OpenAI-compatible providers can use the same chat interface when their request protocol matches; differences in fields or streaming behavior may require another module or custom integration.
- MemoryPrompt stores messages in JVM memory by default and includes the most recent 100 messages; applications need to manage reply insertion and any persistence or trimming strategy.
- The documentation says chat logging is enabled by default and can be disabled with logEnabled(false).
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Make a first Java chat call
Set up a Maven project that sends a prompt through Agents-Flex to an OpenAI or compatible chat service.
Before you start
- JDK 8 or later
- Maven 3.6 or later
- A model-service API key and a model name supported by that service
- For a compatible provider, its endpoint and required request path
Steps
Create a standard Maven project and add the agents-flex-chat-openai dependency at version 2.3.2.
Provide the API key through AI_API_KEY; set AI_MODEL and, for a compatible provider, AI_ENDPOINT as needed.
Build a ChatModel with OpenAIChatConfig, setting the endpoint, request path, key and model.
Call chat() with a prompt to receive a complete response; use chatStream() when the application needs incremental output.
Expected outcome
A Java program can make a synchronous chat request, with streaming available through the documented listener interface.
Guide limitations
- This guide covers chat integration, not deployment or configuration of a model service.
- A provider with a different request format or streaming protocol may require its dedicated module or custom integration.
- MCP modules require JDK 17 or later.
Compare options for Retrieval-augmented applications
These projects document a common task and share a project role. This is a source-based comparison, not an execution benchmark or a guarantee of interchangeability.
| Project | Documented purpose | Platform | Access and requirements |
|---|---|---|---|
| agentsflex.com | Send synchronous prompts to an OpenAI or compatible chat service. | Linux, Windows, macOS | The documented chat quick start requires a model-service API key. The primary framework is described as supporting JDK 8 or later; MCP modules require JDK 17 or later. |
| BabyAgent | Trace how a model request becomes a tool call, tool result and next reasoning step. | CLI, Linux, macOS, Windows | The repository is public and lists the Apache-2.0 license. Model-calling chapters require an LLM provider API key; chapter 12 uses a mock LLM and needs no API key. |
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 4 November 2026
- Original website title
- Agents-Flex - Agents-Flex 官方网站 · Official homepage title · retained in its source language

