Build and demo Java AI agent systems with langchain4j-agentic: workflow patterns, supervisor, custom Planner strategies (incl. the flagship typed-verdict / CriticResult-style critic pattern), plus MCP tools, A2A remote agents, build setup, and conference-demo storylines. Pinned to 1.15.0 / 1.15.0-beta25.
84
89%
Does it follow best practices?
Impact
100%
4.76xAverage score across 2 eval scenarios
Passed
No known issues
Reference + demo-building context for the langchain4j-agentic module. Distilled from the official LangChain4j docs (langchain4j/docs/docs/tutorials/agents.md) and verified against maven-metadata.xml.
Experimental module. Builder names and coordinates drift between betas. Run
scripts/check_versions.shbefore relying on pins.
| Artifact | Version |
|---|---|
langchain4j-bom / langchain4j / -anthropic / -open-ai | 1.15.0 (GA) |
langchain4j-agentic / -agentic-a2a / -agentic-patterns / -mcp | 1.15.0-beta25 (pin explicitly — not in BOM) |
implementation(platform("dev.langchain4j:langchain4j-bom:1.15.0"))
implementation("dev.langchain4j:langchain4j")
implementation("dev.langchain4j:langchain4j-anthropic")
implementation("dev.langchain4j:langchain4j-agentic:1.15.0-beta25") // explicit
implementation("dev.langchain4j:langchain4j-agentic-a2a:1.15.0-beta25") // explicit
implementation("dev.langchain4j:langchain4j-mcp:1.15.0-beta25") // explicitPer Anthropic's "Building Effective Agents", agentic architectures split into:
Agents share data through an AgenticScope; any composed system is itself an agent, so patterns nest.
custom-strategy-critic-result.md — the flagship "money slide" pattern: a Custom Strategy with Domain Modeling where the verifier returns a typed result object (illustrated as CriticResult — your own type, not a framework one) carrying verdict + feedback + the typed payload, deterministically driving Identify→Fix→Verify→Adjust with feedback loop-back. This is the centerpiece of the demo.
| File | Contents |
|---|---|
| custom-strategy-critic-result.md | ⭐ Flagship: typed-verdict custom strategy, CriticResult-style (the money slide) |
| agents-and-scope.md | @Agent, agentBuilder, untyped/typed agents, AgenticScope |
| workflow-patterns.md | Sequential, loop, parallel, parallel-mapper, conditional, human-in-the-loop, planner+executor+critic |
| agent-configuration.md | Optional, async, streaming, dynamic model, error handling, observability & monitoring |
| declarative-api.md | Annotation API, supplier annotations, strongly typed keys |
| pure-agentic.md | Supervisor + custom Planner patterns: goal-oriented, peer-to-peer, voting |
| tools-memory-and-build.md | @Tool, maxSequentialToolsInvocations, memory, model selection, -parameters, BOM split, deps |
| mcp-and-a2a.md | MCP tool servers (toolProviders) and A2A remote agents (a2aBuilder) |
| demo-storylines.md | Four-act conference/workshop demo, centered on the flagship pattern |
| gotchas.md | Top-10 live-demo risks + API-correctness notes |
AgenticServices — the single factoryagentBuilder(Class) / agentBuilder() // single agent (typed / untyped)
sequenceBuilder / loopBuilder // ordered / iterative
parallelBuilder / parallelMapperBuilder // concurrent / fan-out-over-collection
conditionalBuilder // predicate routing
supervisorBuilder // LLM-planned
plannerBuilder // custom Planner (incl. the CriticResult strategy)
humanInTheLoopBuilder // pause for human input
a2aBuilder(url[, Class]) // remote agent over A2A
createAgenticSystem(Class, ChatModel) // build from a declarative interfaceassets/build.gradle.kts, assets/App.java — runnable starting pointscripts/check_versions.sh — refresh the version pins