Daniel Oh & Kevin Dubois

Create AI-Infused Java Apps with LangChain4j

What if you could connect an LLM to your database with a simple Java annotation? Learn to build powerful, autonomous AI agents, entirely in Java.

Create AI-Infused Java Apps with LangChain4j
#1about 2 minutes

Navigating the complex AI landscape for Java developers

The overwhelming Python-centric AI ecosystem doesn't require Java developers to switch languages, as powerful Java-native tools exist for AI integration.

#2about 2 minutes

Understanding LangChain4j for Java AI applications

LangChain4j, inspired by Python's LangChain, provides a Java-native framework for integrating AI models, with Quarkus offering simplified integration features.

#3about 5 minutes

Getting started with prompting and structured output

Begin by adding dependencies and using annotations like @AiService to define prompts, parameterize questions, and automatically map model responses to Java objects.

#4about 2 minutes

Implementing stateful conversations with chat memory

LangChain4j provides out-of-the-box chat memory to maintain conversational context, enabling follow-up questions and parallel conversations using a memory ID.

#5about 3 minutes

Connecting AI models to external Java services

Use function calling, also known as tools, to allow the AI model to invoke your existing Java methods and services by describing them with the @Tool annotation.

#6about 4 minutes

Building autonomous agents with the MCP protocol

The Multi-tool Calling Protocol (MCP) enables an AI model to autonomously decide which external tools to call in sequence to fulfill a user's request within a Java environment.

#7about 4 minutes

Implementing guardrails to secure AI interactions

Protect against misuse like prompt injection by using input and output guardrails to sanitize requests and responses, ensuring the model behaves as intended.

#8about 2 minutes

Adding custom knowledge with retrieval-augmented generation

Use Retrieval-Augmented Generation (RAG) to supplement the model's knowledge with your own documents by loading them into a vector store for relevant context retrieval.

#9about 5 minutes

Demo of an AI assistant using LangChain4j and Quarkus

A demonstration of a car rental chatbot showcases how to integrate a database, an external weather service via MCP, and custom documents via RAG to create a comprehensive AI assistant.

Related jobs
Jobs that call for the skills explored in this talk.

Featured Partners

Related Articles

View all articles
DC
Daniel Cranney
Stephan Gillich - Bringing AI Everywhere
In the ever-evolving world of technology, AI continues to be the frontier for innovation and transformation. Stephan Gillich, from the AI Center of Excellence at Intel, dove into the subject in a recent session titled "Bringing AI Everywhere," sheddi...
Stephan Gillich - Bringing AI Everywhere
CH
Chris Heilmann
With AIs wide open - WeAreDevelopers at All Things Open 2025
Last week our VP of Developer Relations, Chris Heilmann, flew to Raleigh, North Carolina to present at All Things Open . An excellent event he had spoken at a few times in the past and this being the “Lucky 13” edition, he didn’t hesitate to come and...
With AIs wide open - WeAreDevelopers at All Things Open 2025
DC
Daniel Cranney
What is Agentic Programming and Why Should Developers Care?
Since the release of tools like ChatGPT and GitHub Copilot, the way developers work has shifted dramatically. What began as simple autocomplete in the early versions of Copilot has quickly evolved into agentic programming, where AI agents can take on...
What is Agentic Programming and Why Should Developers Care?

From learning to earning

Jobs that call for the skills explored in this talk.