Skip to main content

Meet AgentForge

AgentForge is an open-source Agent Framework for Java developers. It starts from LLM protocols and model abstractions, then builds tool calling, conversation memory, middleware, reasoning loops, HITL interrupts, and the Agent Runtime layer by layer. Applications can turn model capabilities into executable tasks without binding themselves to a single model vendor.

Forge Intelligence into Action.

AgentForge = Agent + Forge: Agent represents an intelligent entity that understands goals, reasons, calls tools, and completes tasks. Forge emphasizes engineering, composition, and reinforcement that turn raw model intelligence into reliable application capabilities.

Latest dependency​

The current framework version is 1.0.0. The BOM is the recommended way to manage versions:

<dependencyManagement>
<dependencies>
<dependency>
<groupId>cloud.changlu.agentforge</groupId>
<artifactId>agentforge-ai-bom</artifactId>
<version>1.0.2-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Then add modules as needed, without repeating the version:

<dependency>
<groupId>cloud.changlu.agentforge</groupId>
<artifactId>agentforge-agent-core</artifactId>
</dependency>

To run a quick example, agentforge-agent-core alone is enough: it transitively brings agentforge-model-api and agentforge-model-core.

Why bottom-up​

Agent memory, tools, planning, and execution loops all eventually become model requests and responses. AgentForge stabilizes contracts such as ChatModel, StreamingChatModel, ChatMessage, and ChatResponse first, then composes Agent capabilities on top. Business code therefore does not depend tightly on any vendor SDK.

LLM Provider
↓ Message / Request / Response
↓ Context / Memory
↓ Tool / Skill / MCP
↓ Reasoning / Planning
↓ Agent Runtime
↓ Multi-Agent / Sandbox / Observability
Real Action

This layering brings four direct benefits:

  1. Provider-neutral: upper layers depend only on unified contracts; switching models does not require rewriting the main loop;
  2. Protocol adapters live low: OpenAI / Anthropic differences in fields, headers, SSE, and finish reasons stay inside Provider modules;
  3. Independently replaceable: models, transports, tools, memory, and middleware can all be replaced as needed;
  4. Ready to use: embed the SDK in a Java application, or start the complete workbench with AgentForge Service.

Project structure​

AgentForge
├── agentforge-ai-parent # Dependency and plugin version management
├── agentforge-ai-bom # Unified BOM
├── agentforge-model # Model layer
│ ├── agentforge-model-api # Provider-neutral model contracts
│ ├── agentforge-model-core # Default implementations, HTTP transport, Tool engine
│ ├── agentforge-model-openai # OpenAI / OpenAI-compatible Provider
│ ├── agentforge-model-anthropic# Anthropic Provider
│ └── agentforge-model-registry # Out-of-the-box ChatModel factory
├── agentforge-framework
│ ├── agentforge-agent-core # ReAct Agent runtime
│ └── agentforge-harness-agent # Harness runtime (initial local runtime)
├── agentforge-service # Vue frontend + Spring Boot backend
└── agentforge-examples # Reference examples

Core capabilities​

CapabilityDescriptionEntry
Unified model protocolOne ChatRequest / ChatResponse for OpenAI, Anthropic, and OpenAI-compatible servicesModel
ReAct AgentSynchronous and streaming share one think → act → memory loopAgent
Messages and eventsUnified messages, streaming callbacks, and tool execution eventsMessages & Events
MiddlewareAttach custom logic to model calls, tool execution, and loop lifecycleMiddleware
Tool extensionsLocal Java methods, HTTP plugins, and MCP services as Function CallsTool Extensions
Human-in-the-LoopPermission ALLOW / DENY / ASK, approval interrupts, AskUser and batch recoveryPermission Design & HITL
Harness AgentInitial local runtime: Workspace, LocalRuntime, engineering tools and resource lifecycleBuild a HarnessAgent
Service workbenchModel configuration, Agent debugging, versioning, sessions, and tracingService

HITL is now initially available: permission approval and AskUser share one interrupt kernel with frozen tool batches, SUSPENDED outcomes, and explicit recovery. Harness Agent provides an initial local runtime that binds a Workspace and LocalRuntime with file, search, and command tools. Remote sandboxes, cross-process recovery, and Harness-level permission policy selection are still evolving.

A minimal call​

ChatModel model = OpenAiChatModel.builder()
.apiKey(System.getenv("OPENAI_API_KEY"))
.modelName("gpt-4o-mini")
.build();

String answer = model.chat("Explain ReAct Agent in one sentence.");
System.out.println(answer);

Add ReActAgent when you need tools and multi-step reasoning:

ToolService toolService = new ToolService();
toolService.tools(new WeatherTools());

ReActAgent agent = ReActAgent.builder()
.agentName("weather-agent")
.systemPrompt("You are a weather assistant. Call tools when needed.")
.chatModel(chatModel)
.streamingChatModel(streamingChatModel)
.chatMemoryProvider(new MessageWindowChatMemoryProvider(50))
.toolService(toolService)
.build();

ChatResult result = agent.run(AgentRequest.builder()
.memoryId("user-1")
.question("What is the weather in Beijing today?")
.build());

Choose your path​

SDK documentation map​

The SDK section is organized as "use first, understand next, extend last":

Getting started
Meet AgentForge → Quick Start
Harness implementation
Build a HarnessAgent → Runtime design and implementation
Core components
Model → Agent → Permission Design & HITL → Messages & Events → Middleware → Tool → Memory
Memory extensions
Window memory
Agent Tool extensions
JavaLocalTool → HTTP → MCP
Middleware extensions
Logging → Trace → Append

Tool and Middleware topic pages follow a three-layer structure: design rationale first, then how to compose them with an Agent, and finally how to replace storage, executors, event adapters, or formatting strategies. This lets you copy a minimal example first and extend it as your project grows.

Service workbench​

AgentForge Service is an out-of-the-box workbench built on the framework. It covers the full path from model configuration to production release:

Model configuration → Agent configuration → Debug → Version → Publish → Chat and session history

It is a good fit for teams that want to experience AgentForge quickly without building a frontend and backend from scratch. See Service introduction.