ADK for Java opening up to third-party language models via LangChain4j integration

The recent 0.2.0 release of Google’s Agent Development Kit (ADK) for Java adds an integration with t...

Guillaume Laforge
5 min readintermediate
--
View Original

Overview

The article discusses the integration of Google’s Agent Development Kit (ADK) for Java with the LangChain4j LLM framework, enabling developers to utilize a variety of Large Language Models (LLMs) for building AI agents. It highlights the new features in version 0.2.0, including expanded tooling capabilities and advanced agent logic.

What You'll Learn

1

How to integrate LangChain4j with ADK for Java

2

How to run Gemma 3 using Docker Model Runner

3

How to set up a science teacher agent using Qwen 3 with Ollama

Prerequisites & Requirements

  • Basic understanding of AI agents and language models
  • Familiarity with Docker and Maven

Key Questions Answered

What is the significance of the LangChain4j integration with ADK for Java?
The integration allows developers to access a wide range of Large Language Models (LLMs) beyond the built-in Google Gemini and Anthropic Claude, facilitating the creation of more versatile AI agents. This opens up opportunities to leverage models from various third-party providers and local open-weight models.
How can developers run Gemma 3 using Docker Model Runner?
Developers can run Gemma 3 by installing Docker Model Runner and using the command 'docker model pull ai/gemma3'. This command pulls the model, making it available for use in AI agent development.
What are the new features introduced in ADK for Java version 0.2.0?
Version 0.2.0 introduces expanded tooling capabilities, improved async support, better loop control, advanced agent logic with chained callbacks, and a new InMemoryMemoryService for efficient memory management, enhancing the overall agent development workflow.
How do you set up a science teacher agent using Qwen 3?
To set up a science teacher agent, you instantiate the OllamaChatModel with the model name and base URL, then create an LlmAgent with a description and instruction for the agent's role. This enables the agent to assist users in understanding science concepts.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Framework
Agent Development Kit
Used for building AI agents in Java.
Framework
Langchain4j
Provides access to various Large Language Models for integration with ADK.
Tool
Docker
Used for running models like Gemma 3 and managing environments.

Key Actionable Insights

1
Leverage the LangChain4j integration to access diverse LLMs for your AI agents.
This integration allows developers to enhance their AI agents' capabilities by utilizing models from various providers, thus improving the versatility and performance of applications.
2
Utilize Docker Model Runner for easy deployment of language models like Gemma 3.
By using Docker, developers can streamline the setup process for AI models, making it easier to manage dependencies and environments.
3
Implement advanced agent logic using the new features in ADK for Java.
The new version supports more complex interactions and memory management, allowing for the development of smarter and more responsive AI agents.

Common Pitfalls

1
Failing to properly configure the Docker Model Runner can lead to issues when trying to pull and run models.
Ensure that Docker is correctly installed and configured on your machine to avoid runtime errors when deploying models.
2
Not specifying the correct model name or base URL can result in failed agent instantiation.
Double-check the model names and URLs used in your code to ensure that your agents can connect to the intended models.

Related Concepts

AI Agents
Large Language Models
Docker
Maven