Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Create Agentic AI workflows and orchestration u...

Create Agentic AI workflows and orchestration using LangChain4J-CDI

Java developers are now familiar with AI, and with the introduction of Anthropic’s Agentic patterns, it’s now simpler to build AI agents and orchestrate AI workflows using LangChain4J (a now popular, widely accepted AI library in Java). Now, with LangChain4J-CDI, a sub-project of LangChain4J – powered by CDI, it introduces LangChain4J Agentic. Developers can build AI Agents, and orchestrate Agentic workflows by just annotating their AI services, just the same way you would an existing AI service. All developers have to do is just inject it on their existing business service. In this talk, we’ll walk through all the Agentic patterns that LangChain4J provides, how to declaratively build your AI agents and workflows and let LangChain4J build your agents and orchestrations automatically.

Avatar for Buhake Sindi

Buhake Sindi

November 03, 2026

More Decks by Buhake Sindi

Other Decks in Technology

Transcript

  1. IO.println(“I’m Buhake Sindi”); • Enterprise solutions architect, consultant. • 20

    years of solid Java / Enterprise Java development experience. • Founded Devoxx4Kids South Africa (NPO) – introducing kids to coding, robotics, AI, etc., in a fun way. • Jozi JUG Organiser (monthly Java User Group Meetup in Johannesburg) • JakartaEE / Microprofile Working Group member. • Jakarta EE Ambassador. • Member of the JCP • Tech speaker • Blogger / Content writer • Active Contributor to Langchain4J CDI. F ou n de r o f S i nd i T ec h no l og i es (P t y) Lt d & D e vo x x4 K id s S o ut h A fr i ca Tuesday, November 3, 2026 Who am I? 2
  2. Where to find me? X: @EliteGentleman Other socials: @buhake.sindi :

    [email protected] https://linktr.ee/theEliteGentleman F ou n de r o f S i nd i T ec h no l og i es (P t y) Lt d & D e vo x x4 K id s S o ut h A fr i ca Tuesday, November 3, 2026 Say hi! 3
  3. Since AI became mainstream • Generative AI (November 2022) •

    A model that generates content (text, audio, images, code, etc.) in response to a human prompt or question (prompt engineering) • AI agent (March 2023) • An automated model that uses memory and tool calling in order perform actions and generate responses based on user input. • Agentic AI workflows (December 2024) • An orchestrated system where one or more AI agents plan, remember context, make decisions and collaborates to autonomously execute complex, multiple-step goals. • Decision model (September 2026) • Tuesday, November 3, 2026 A lightweight, typesafe model that evaluates state against a predefined set of choices, score, yes/no options and returns a structured probabilities rather than generating texts. Create Agentic AI workflows and orchestration using LangChain4J-CDI 4
  4. Java AI integration with LangChain4J • Generative AI • A

    unified API for LLM integration. Using AiServices factory, developers can create AI services and define its behaviour using Java interface. • AI agent • Single agent interaction: With comprehensive toolbox such as RAG, tool integration, memory, etc., an AI service is endowed with autonomy, reasoning, and tool-access capabilities. • Agentic AI workflows • • Using langchain4j-agentic developers can orchestrate and build multi-agent workflows. Sequential, parallel, loop and conditional workflow. • Decision model • • Tuesday, November 3, 2026 A specialised model interface, DecisionModel, that evaluates an input against named, typed questions and returns structured answers with probabilities instead of free-form generated text. Decision Services provide a high-level, declarative, interface-driven wrapper around Decision Models. , specifically optimised for classification, gating, routing, and grading tasks. Create Agentic AI workflows and orchestration using LangChain4J-CDI 5
  5. Single agent interaction: using AiServices Tuesday, November 3, 2026 Create

    Agentic AI workflows and orchestration using LangChain4J-CDI 6
  6. Example code... • Create an interface without implementation. • Register

    your interface, along with LangChain4J components using AiServices factory. • Agent response is based on human prompt. Tuesday, November 3, 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 7
  7. LangChain4J CDI AiServices Tuesday, 03 November 2026 Create Agentic AI

    workflows and orchestration using LangChain4J-CDI 8
  8. LangChain4J Agentic • LangChain4J Agentic, a module for developers to

    build and orchestrate multi-agent AI systems. • Provides a set of abstractions and utilities to help you build agentic workflows and pure agentic AI applications, culminating in GOAP (Goal Oriented Action Planning) agentic system. • Features: − AgenticScope, a shared memory and context page where AI agents can write outputs, read required information and track invocation logs. − Support for agentic workflow patterns: sequential, parallel, loops, conditional − Agentic and non-AI patterns: Supervisor, Human-In-The-Loop • Docs: https://docs.langchain4j.dev/tutorials/agents/ Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 9
  9. LangChain4J Agent classifications • LangChain4J Agents in an agentic system

    are categorized by how they process logic, use models, or integrate human input inside the shared. − AI Agent: An agent powered by a Large Language Model (LLM) or chat model that reasons about tasks, calls tools/APIs, and generates text or multi-step action sequences. − Non-AI Agent: An agent whose execution logic is not driven by a generative LLM. Instead, it runs a deterministic Java function, code routine, or a wrapped MCP (Model Context Protocol) tool directly against the AgenticScope. − Human-In-The-Loop: A specialized variant that pauses the automated workflow to request validation, input, or approval from a human user before proceeding. Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 10
  10. Example: Agentic AI Tuesday, November 3, 2026 Create Agentic AI

    workflows and orchestration using LangChain4J-CDI 11
  11. LangChain4J CDI Agentic • Langchain4J Agentic, with the power of

    CDI. • Declarative over imperative: compose multi-agent systems with annotation on interfaces instead of hand-written builder/orchestration code, registering agents as CDI beans using dedicated annotations, dependency injection and CDI-managed configuration. • Portable across runtimes − Tested across the same application servers. Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 12
  12. 12 agent topologies: One annotation per agentic topology SIMPLE SEQUENCE

    PARALLEL PARALLEL_MAPPER @RegisterSimpleAgent @RegisterSequenceAgent @RegisterParallelAgent @RegisterParallelMapperAgent CONDITIONAL LOOP SUPERVISOR PLANNER @RegisterConditionalAgent @RegisterLoopAgent @RegisterSupervisorAgent @RegisterPlannerAgent HUMAN IN THE LOOP A2A MCP CLIENT DECISION @RegisterHumanInTheLoopAgent @RegisterA2AAgent @RegisterMcpClientAgent @RegisterDecisionAgent Each agentic topology has a dedicated CDI stereotype annotation - pick the pattern, annotate the interface, and LangChain4j CDI generates the implementation. Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 13
  13. Orchestrate your agentic workflows the Jakarta EE way using LangChain4JCDI

    Agentic. - Liberty Workflow Example Tuesday, November 3, 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 14
  14. A single agent: @RegisterSimpleAgent • The simplest building block: a

    single @RegisterSimpleAgent that takes car details and feedback and returns a cleaning recommendation. Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 15
  15. Sequential workflow: @RegisterSequenceAgent • A @RegisterSequenceAgent orchestrates two simple agents

    in a fixed order. The output of the first agent feeds into the second, and the final result is assembled by an @Output method. Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 16
  16. Conditional workflow: @RegisterConditionalAgent • This pattern uses @RegisterConditionalAgent to route

    the workflow to one or more sub-agents based on declarative activation conditions (@ActivationCondition). It acts as a smart router, ensuring only the relevant agents are executed. Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 17
  17. Loop workflow: @RegisterLoopAgent • This pattern is used for iterative

    refinement. A single agent or a subworkflow is executed repeatedly until a specific exit condition is met, or a maximum number of iterations is reached, preventing infinite loops. Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 18
  18. A supervisor agent: @RegisterSupervisorAgent • Instead of hardcoded routing, an

    AI supervisor autonomously decides which sub-agents to invoke — and in what order — based on runtime context. • The FleetSupervisorAgent (@RegisterSupervisorAgent) dynamically orchestrates four action agents based on a @SupervisorRequest prompt. A parallel FeedbackAnalysisWorkflow precedes it. Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 19
  19. Human-In-The-Loop agent: @RegisterHumanInTheLoopAgent • A @RegisterHumanInTheLoopAgent pauses the workflow and

    waits for a human decision (with a 5-minute timeout) before resuming. • Any vehicle worth more than $15,000 must be reviewed by a human before disposition. The agent method itself pauses execution until a decision is made. Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 20
  20. More enterprise features please! - What about resiliency? - Can

    we add observability to our AI agent? Tuesday, November 3, 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 22
  21. Configuration: Microprofile Config • No code – Just properties. •

    It’s 2026! Tuesday, November 3, 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 23
  22. Resiliency with MicroProfile Fault Tolerance • Apply any MP Fault

    Tolerance interceptor annotations (e.g., @Retry, @Fallback, @Timeout, etc.), the same way you would to existing CDI bean. Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 24
  23. Applying Observability with MicroProfile Telemetry • Can register either Span,

    Metrics, or both. • Each *ModelListener can be assigned via MP Config. • “lookup:@all” allows CDI to seek all Telemetry beans and register it to the *Model. • Alternatively, specify the full-qualified classname of either GenAI Span*ModelListener, GenAI Metrics*ModelListener, separated by a comma. • OpenTelemetry Semantic Convention for Generative AI Spans. • OpenTelemetry Semantic Convention for Generative AI Metrics. Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 25
  24. And many more! Now, includes MCP Server declaration. AI Agent

    with @RegisterAIService + McpToolProvider @RegisterA2AAgent, for Agent2Agent agent discovery. Tuesday, November 3, 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 26
  25. Finally... • Tuesday, 03 November 2026 Just @Inject your agent

    in your business logic or resource. Create Agentic AI workflows and orchestration using LangChain4J-CDI 27
  26. Getting started • Prod ready version: 1.5.1 • From Maven

    Central: • • Either langchain4j-cdi-portable-ext or langchain4j-cdi-build-compatible-ext • MicroProfile integrated modules: • • • • Tuesday, 03 November 2026 GroupId: dev.langchain4j.cdi GroupId: dev.langchain4j.cdi.mp Configurability: langchain4j-cdiconfig Resiliency: langchain4j-cdi-faulttolerance Observability: langchain4j-cditelemetry Create Agentic AI workflows and orchestration using LangChain4J-CDI 28
  27. Finally… • Jakarta Agentic Artificial Intelligence: • Still under development,

    under the Eclipse Foundation. • The project provides a set of vendor-neutral APIs that make it easy, consistent, and reliable to build, deploy, and run AI agents on Jakarta EE runtimes. • Anybody can contribute to the development of the Jakara Agentic AI specifications. • More info: https://jakarta.ee/specifications/agenticai/ Tuesday, 03 November 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 29
  28. Resources • LangChain4J-CDI: • Official documentation: https://langchain4j.github.io/langchain4j-cdi/ • • •

    GitHub: https://github.com/langchain4j/langchain4j-cdi Example: https://github.com/langchain4j/langchain4jcdi/tree/main/examples LangChain4J: • Documentation: https://docs.langchain4j.dev/ ▪ • Tuesday, 03 November 2026 Agent and Agentic AI: https://docs.langchain4j.dev/tutorials/agents/ GitHub: https://github.com/langchain4j/langchain4j • Liberty LangChain4J Workshop: https://openliberty.io/blog/2026/07/10/libertylangchain4j-workshop.html • Bring AI and build AI agents into your Jakarta EE Apps with LangChain4J-CDI (XtremeJ Conference 2025): https://www.slideshare.net/slideshow/bring-ai-andbuild-ai-agents-into-your-jakarta-ee-apps-with-langchain4j-cdi-pdf/284294258 Create Agentic AI workflows and orchestration using LangChain4J-CDI 30
  29. Questions? "Will AI replace Java developers?" No, but a Java

    developer with AI Will replace the one without. And with CDI, AI is just another @Inject. Tuesday, November 3, 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 31
  30. THANK YOU Any Questions? Buhake Sindi x: @EliteGentleman Other socials:

    @buhake.sindi https://linktr.ee/theEliteGentleman Tuesday, November 3, 2026 Create Agentic AI workflows and orchestration using LangChain4J-CDI 32