v3.4.0 Now Available · MIT License · Java 21+

Orchestrate
teams of AI agents
that work together.

A Java framework for building multi-agent systems that write code, collaborate across ensemble boundaries, and accomplish complex tasks. Built on LangChain4j, works with OpenAI, Anthropic, Ollama, and more.

Java 21 Required
MIT License
7+ LLM Providers
Network Ready
var model = OpenAiChatModel.builder()
    .apiKey(System.getenv("OPENAI_API_KEY"))
    .modelName("gpt-4o")
    .build();

// v3: agents that write, compile, and test real code
EnsembleOutput result = Ensemble.builder()
    .model(model)
    .workspace(Workspace.isolated())
    .task(CodingTask.of("Implement a thread-safe LRU cache in Java 21"))
    .task(CodingTask.of("Write JUnit 5 tests covering all edge cases"))
    .task(CodingTask.of("Optimize the eviction hot path"))
    .build()
    .run();

System.out.printf("Generated %d files, %d/%d tests passing%n",
    result.getWorkspaceFiles().size(),
    result.getTestsPassed(), result.getTestsTotal());
v3.4.0 Released

What's new in
AgentEnsemble 3.x

Capabilities added across the 3.x release series: coding agents, ensemble networking, advanced observability, external API control, and direct workflow engine integration.

New in 3.0

Coding Agents

Agents that write, compile, run tests, and iterate on real code. Each ensemble gets an isolated workspace so agents can safely invoke the compiler, run JUnit suites, and refine their output until tests pass.

  • Isolated workspace per ensemble run
  • Compilation and test-execution tools built in
  • Iterative refinement loop until tests pass
  • MCP bridge for editor and tool integration
New in 3.0

Ensemble Network

Run ensembles as long-lived services that expose tasks and tools to other ensembles on the network. Cross-ensemble delegation, capability discovery catalogs, federation across namespaces, and a network operations dashboard.

  • Ensembles start as persistent services
  • NetworkTask and NetworkTool for cross-ensemble delegation
  • Discovery catalogs for capability advertisement
  • Federation across organizational namespaces
New in 3.0

TOON Context Format

A structured, token-optimized context serialization format for multi-agent conversations. TOON encodes agent history, tool calls, and shared memory in a compact representation that reduces LLM context overhead on long-running workflows.

  • Compact encoding of agent conversation history
  • Structured tool call and result representation
  • Configurable verbosity levels
  • Drop-in replacement for raw message lists
New in 3.1

Viz Observability

Deep visibility into what agents and tools are actually doing at runtime. Inspect every tool call input and output, step through individual LLM iterations, and replay conversation threads from any point in a run.

  • Tool call detail panel with full I/O inspection
  • Agent conversation thread view per task
  • LLM iteration data persisted for late-join replay
  • Live and post-run inspection modes
New in 3.3+

Ensemble Control API

A REST and WebSocket API for submitting, monitoring, and controlling ensemble runs from external systems. Manage parameterized runs, filter subscriptions, and inject human review decisions without embedding the framework directly.

  • REST endpoints for run submission and lifecycle management
  • WebSocket channels for real-time run events
  • SSE support for server-sent event streams
  • Level 2/3 parameterization for runtime task customization
New in 3.3

Executor Integration

Direct in-process invocation of ensembles from Temporal, AWS Step Functions, and other workflow engines. EnsembleExecutor removes the HTTP layer when you are already inside an orchestrated workflow and want ensemble results as typed values.

  • agentensemble-executor module for in-process invocation
  • Synchronous and async execution modes
  • Typed output binding for workflow engine compatibility
  • No separate HTTP server required
Why AgentEnsemble?

The right choice for
Java multi-agent work

Existing solutions are either Python-first, require you to build orchestration yourself on top of raw LangChain4j primitives, or both. AgentEnsemble is the missing production-ready layer for Java teams.

Hand-rolled vs Framework

AgentEnsemble vs hand-rolled LangChain4j orchestration

LangChain4j gives you excellent building blocks. But stitching multiple agents together yourself means writing the same boilerplate every time: prompt assembly, context threading, error recovery, retry logic, and delegation plumbing. AgentEnsemble is that layer, already built and battle-tested.

  • Three lines instead of hundredsA working multi-agent pipeline runs with a single Ensemble.run(model, task1, task2, task3) call. Sequential, hierarchical, parallel, and MapReduce strategies come built-in.
  • Workflow strategies that composeSEQUENTIAL, HIERARCHICAL (manager delegates to workers), PARALLEL (DAG-based concurrent execution via virtual threads), and MapReduce for large-context workloads. Switching between them is one enum value.
  • Production concerns handled for youMemory across runs, review gates for human-in-the-loop approval, input/output guardrails, structured output with automatic retry, delegation guards and lifecycle events — none of this has to be invented from scratch.
  • Full observability out of the boxEvery run produces token counts, LLM latency, tool timing, and a complete execution trace. Export to JSON, stream to a live browser dashboard, or push to Micrometer. Zero configuration required.
Built for Java

Why JVM teams need a production-minded agent framework

Python agent frameworks are not designed for Java engineering constraints. AgentEnsemble is written in Java 21, distributed as standard Maven/Gradle artifacts, and fits directly into the toolchains, testing practices, and deployment pipelines that JVM teams already use.

  • Idiomatic Java 21Fluent builders, records for structured output, sealed interfaces, and Java virtual threads for concurrent execution. No reflection tricks, no annotation processors, no runtime surprises.
  • Gradle and Maven with a BOMAdd the BOM and pull the modules you need. Versions align automatically. The same dependency management your team uses for every other library.
  • Plugs into your existing stackMicrometer metrics integrate with Prometheus and Grafana. SLF4J logging works with Logback and Log4j2. The live dashboard is a plain embedded WebSocket server — no Docker, no npm, no sidecar process.
  • Type-safe from input to outputDeclare outputType(MyRecord.class) on a task and receive a fully typed, schema-validated Java object. Parse failures trigger automatic correction prompts before any exception is thrown.
JVM vs Python runtime

Why AgentEnsemble instead of Python-first agent frameworks

Frameworks like LangChain and CrewAI are excellent in their ecosystem. Bringing them into a Java service means a Python runtime, an HTTP sidecar or subprocess, serialization overhead, and two languages to test and deploy. AgentEnsemble runs on the same JVM as your service.

  • No Python runtime or interop taxDeploy as a library JAR. No subprocess management, no inter-process serialization, no latency from crossing a process boundary on every agent call.
  • LLM-agnostic via LangChain4jOpenAI, Anthropic, Ollama, Azure OpenAI, Amazon Bedrock, Google Vertex AI — and any provider LangChain4j adds in the future. Switching providers is a one-line change.
  • Feature parity with Python frameworksSequential, hierarchical, and parallel workflows. MapReduce for large workloads. Multi-level memory. Tool pipelines. Human-in-the-loop review gates. Delegation with guards. Structured typed output. All in Java.
  • One language to test and deployUnit tests with JUnit, integration tests with your existing test containers, CI with the same Gradle tasks. No Python virtualenv to maintain, no separate test suite to keep in sync.
Capabilities

Everything you need to build
production-grade AI systems

From simple two-agent pipelines to coding agents, federated ensemble networks, and complex hierarchical workflows with memory, observability, and human-in-the-loop review.

  • New in 3.0

    Coding Agents

    Agents that write, compile, run tests, and iterate on real code. Workspace isolation keeps each run sandboxed. Agents refine output until tests pass.

  • New in 3.0

    Ensemble Network

    Run ensembles as long-lived services. Delegate tasks and tools across ensemble boundaries with NetworkTask and NetworkTool. Discovery catalogs and federation included.

  • New in 3.0

    TOON Context Format

    Token-optimized context serialization for multi-agent conversations. Compact encoding of agent history, tool calls, and shared memory reduces LLM overhead on long workflows.

  • New in 3.0

    Typed Tool Inputs

    Declare tool parameters as Java records. The framework generates JSON schemas, validates inputs, and surfaces clear errors before any agent call is made.

  • Zero-Setup Agent Synthesis

    Run a multi-agent ensemble in three lines. No agent declarations required — personas and roles are synthesized automatically from task descriptions.

  • Flexible Workflow Patterns

    Sequential, hierarchical, parallel, and MapReduce execution strategies. Build manager-led teams, fan-out pipelines, and phase-grouped workflows.

  • LLM Agnostic

    Works with any ChatModel from LangChain4j — OpenAI, Anthropic, Ollama, Azure OpenAI, Amazon Bedrock, Google Vertex, and Mistral. Mix models per task.

  • Production Observability

    Real-time WebSocket dashboard, Micrometer metrics, OpenTelemetry traces, and full execution audit trails. Export to Prometheus, Datadog, or any compatible backend.

API

A simple, expressive
Java-native API

From zero-ceremony ensembles to coding agents and federated ensemble networks, the API scales with your needs without boilerplate.

Simple Ensemble

Run multiple agents in sequence with zero configuration. Personas and roles are automatically synthesized from task descriptions.

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

EnsembleOutput output = Ensemble.run(model,
    Task.of("Research the latest trends in distributed systems"),
    Task.of("Write a 500-word technical summary of the findings"),
    Task.of("Generate three actionable recommendations"));

// All task outputs in order
output.getTaskOutputs().forEach(t ->
    System.out.printf("[%s] %s%n",
        t.getAgentRole(),
        t.getRaw().substring(0, 100)));

System.out.printf("Total duration: %s%n", output.getTotalDuration());

Hierarchical Team

A manager agent dynamically creates and delegates to specialist worker agents based on the task at hand.

Agents guide
var manager = Agent.builder()
    .role("Engineering Manager")
    .goal("Coordinate a team to deliver high-quality software solutions")
    .background("10 years leading cross-functional engineering teams.")
    .llm(model)
    .build();

EnsembleOutput output = Ensemble.builder()
    .manager(manager)
    .maxDelegations(8)
    .task(Task.builder()
        .description("Design and document a REST API for a task management app")
        .expectedOutput("OpenAPI 3.0 spec and implementation guide")
        .build())
    .workflow(Workflow.HIERARCHICAL)
    .build()
    .run();

System.out.println(output.getRaw());

Coding Agent

New in 3.0: Agents write, compile, run tests, and iterate on real code in an isolated workspace until all tests pass.

Coding Agents guide
var model = OpenAiChatModel.builder()
    .apiKey(System.getenv("OPENAI_API_KEY"))
    .modelName("gpt-4o")
    .build();

// Agents iterate until compilation succeeds and tests pass
EnsembleOutput result = Ensemble.builder()
    .model(model)
    .workspace(Workspace.isolated())
    .task(CodingTask.of("Implement a binary search tree with insert, search, and delete"))
    .task(CodingTask.of("Write JUnit 5 tests achieving 100% method coverage"))
    .task(CodingTask.of("Add Javadoc and optimize recursive traversal"))
    .build()
    .run();

System.out.printf("Files generated: %d%n",
    result.getWorkspaceFiles().size());
System.out.printf("Tests: %d/%d passing%n",
    result.getTestsPassed(), result.getTestsTotal());

Ensemble Network

New in 3.0: Ensembles run as long-lived services. Other ensembles delegate tasks and share tools across the network.

Ensemble Network guide
// Start a specialist ensemble as a long-running service
var researchService = Ensemble.builder()
    .name("research-service")
    .model(model)
    .shareTask("Research any technical topic in depth", "research")
    .task(Task.of("Research the topic and produce a detailed report"))
    .build()
    .start(8080);  // exposes tasks on the network

// Delegate cross-ensemble from a writer ensemble
EnsembleOutput output = Ensemble.builder()
    .model(model)
    .task(Task.builder()
        .description("Write a blog post on distributed consensus algorithms")
        .tool(NetworkTask.of("localhost", 8080))
        .build())
    .task(Task.of("Add code examples and polish the post"))
    .build()
    .run();

System.out.println(output.getRaw());
How It Works

From idea to running agents
in minutes

Define Tasks

Describe what each agent should do and what output you expect. Tasks can depend on each other, carry tools, and use different LLM models.

Task.of("...") or Task.builder()...

Configure the Ensemble

Choose a workflow pattern: sequential, hierarchical, parallel, or MapReduce. Attach memory, review gates, callbacks, and guardrails as needed.

Workflow.SEQUENTIAL | HIERARCHICAL | PARALLEL

Run & Observe

Call .run() and collect structured results. Stream events to the live dashboard, export execution traces for visualization, and collect metrics.

EnsembleOutput output = ensemble.run();
Agent
Task
Ensemble
LLM
Output
Get Started

Add one dependency.
Start building.

AgentEnsemble is available on Maven Central. Import the BOM to keep all module versions in sync, then add only the modules you need.

  • agentensemble-core Framework core — always required
  • agentensemble-memory Persistent memory stores
  • agentensemble-review Human-in-the-loop review gates
  • agentensemble-web Live execution dashboard
  • agentensemble-tools-* 10+ built-in tools
dependencies {
    implementation(platform("net.agentensemble:agentensemble-bom:3.3.0"))
    implementation("net.agentensemble:agentensemble-core")
    implementation("dev.langchain4j:langchain4j-open-ai:1.11.0")
}

Latest version: check Maven Central