{"id":6806,"date":"2025-09-19T01:34:18","date_gmt":"2025-09-19T01:34:18","guid":{"rendered":"https:\/\/techtrendfeed.com\/?p=6806"},"modified":"2025-09-19T01:34:19","modified_gmt":"2025-09-19T01:34:19","slug":"adk-for-java-opening-as-much-as-third-party-language-fashions-by-way-of-langchain4j-integration","status":"publish","type":"post","link":"https:\/\/techtrendfeed.com\/?p=6806","title":{"rendered":"ADK for Java opening as much as third-party language fashions by way of LangChain4j integration"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div>\n<p><img decoding=\"async\" class=\"banner-image\" src=\"https:\/\/storage.googleapis.com\/gweb-developer-goog-blog-assets\/images\/image_1600x476.original.png\" alt=\"adk-langchain4j-banner\"\/>  <\/p>\n<div class=\"inner-block-content rich-content\">\n<p data-block-key=\"rismb\">The current <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/github.com\/google\/adk-java\/releases\/tag\/v0.2.0\">0.2.0 launch<\/a> of Google\u2019s <b>Agent Growth Equipment<\/b> (<b>ADK) for Java<\/b> provides an integration with the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/docs.langchain4j.dev\/\">LangChain4j<\/a> LLM framework. This integration offers builders with a <b>big selection of Massive Language Fashions<\/b> (LLMs) supported by LangChain4j, for constructing AI brokers.<\/p>\n<p data-block-key=\"7ilja\">Along with ADK\u2019s built-in Google Gemini and Anthropic Claude integrations, builders can now use LangChain4j to entry different fashions from third-party suppliers (like OpenAI, Anthropic, GitHub, Mistral&#8230;) or native open-weight fashions, e.g. by way of <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/ollama.com\/\">Ollama<\/a> or <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/docs.docker.com\/ai\/model-runner\/\">Docker Mannequin Runner<\/a>.<\/p>\n<\/div>\n<div class=\"inner-block-content rich-content\">\n<h2 data-block-key=\"6qo4v\" id=\"langchain4j-integration-for-a-large-choice-of-models\">LangChain4j integration for a wide selection of fashions<\/h2>\n<p data-block-key=\"a56iu\">The LangChain4j LLM framework helps all kinds of fashions. You&#8217;ll be able to test the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/docs.langchain4j.dev\/category\/language-models\">checklist of supported fashions<\/a> within the LangChain4j documentation. Let\u2019s take a look at a pair concrete examples, utilizing Gemma with Docker Mannequin Runner, and Ollama with Qwen.<\/p>\n<p data-block-key=\"83lb9\">When declaring your ADK agent with the <code>LlmAgent<\/code> builder, you specify the LLM by way of the <code>mannequin()<\/code> builder methodology. You normally go a string representing the identify of the mannequin, like &#8220;<code>gemini-2.5-flash<\/code>&#8220;.<\/p>\n<p data-block-key=\"6s7to\">It\u2019s additionally potential to make use of an occasion of a category extending the <code>BaseLlm<\/code> summary class. That is precisely what the mixing with LangChain4j does, to create a bridge between each frameworks. It&#8217;s important to use a brand new <code>LangChain4j<\/code> class that extends this <code>BaseLlm<\/code> class.<\/p>\n<\/div>\n<div class=\"inner-block-content rich-content\">\n<h3 data-block-key=\"sce6e\" id=\"running-gemma-3-with-docker-model-runner\">Operating Gemma 3 with Docker Mannequin Runner<\/h3>\n<p data-block-key=\"5o997\">After having <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/docs.docker.com\/ai\/model-runner\/\">put in and enabled Docker Mannequin Runner<\/a> in your machine, you may pull the Gemma 3 mannequin simply by way of this command:<\/p>\n<\/div>\n<div class=\"inner-block-content code-block line-numbers\">\n<pre><code class=\"language-shell\">docker mannequin pull ai\/gemma3<\/code><\/pre>\n<p>\n        Shell\n    <\/p>\n<\/div>\n<div class=\"inner-block-content rich-content\">\n<p data-block-key=\"rismb\">As Docker Mannequin Runner fashions exposes an OpenAI suitable API floor, you need to use the LangChain4j module for OpenAI suitable fashions, by specifying the next dependencies in your Maven <code>pom.xml<\/code>:<\/p>\n<\/div>\n<div class=\"inner-block-content code-block line-numbers\">\n<pre><code class=\"language-xml\"><dependency>&#13;\n    <groupid>com.google.adk<\/groupid>&#13;\n    <artifactid>google-adk-contrib-langchain4j<\/artifactid>&#13;\n    <version>0.2.0<\/version>&#13;\n<\/dependency>&#13;\n<dependency>&#13;\n    <groupid>dev.langchain4j<\/groupid>&#13;\n    <artifactid>langchain4j-open-ai<\/artifactid>&#13;\n    <version>1.4.0<\/version>&#13;\n<\/dependency><\/code><\/pre>\n<p>\n        XML\n    <\/p>\n<\/div>\n<div class=\"inner-block-content rich-content\">\n<p data-block-key=\"rismb\">Then, create a LangChain4j chat mannequin, specifying the mannequin you need to use, and the native URL and port:<\/p>\n<\/div>\n<div class=\"inner-block-content code-block line-numbers\">\n<pre><code class=\"language-java\">OpenAiChatModel dmrChatModel = OpenAiChatModel.builder()&#13;\n    .baseUrl(\"http:\/\/localhost:12434\/engines\/llama.cpp\/v1\")&#13;\n    .modelName(\"ai\/gemma3n\")&#13;\n    .construct();<\/code><\/pre>\n<p>\n        Java\n    <\/p>\n<\/div>\n<div class=\"inner-block-content rich-content\">\n<p data-block-key=\"rismb\">Now, configure a chess coach agent utilizing that mannequin:<\/p>\n<\/div>\n<div class=\"inner-block-content code-block line-numbers\">\n<pre><code class=\"language-java\">LlmAgent chessCoachAgent = LlmAgent.builder()&#13;\n    .identify(\"chess-coach\")&#13;\n    .description(\"Chess coach agent\")&#13;\n    .mannequin(new LangChain4j(dmrChatModel))&#13;\n    .instruction(\"\"\"&#13;\n        You're a educated chess coach&#13;\n        who helps chess gamers practice and sharpen their chess abilities.&#13;\n        \"\"\")&#13;\n    .construct();<\/code><\/pre>\n<p>\n        Java\n    <\/p>\n<\/div>\n<div class=\"inner-block-content rich-content\">\n<p data-block-key=\"rismb\">Discover how the bridge between the 2 frameworks is completed by way of the <code>mannequin(new LangChain4j(dmrChatModel))<\/code> instruction. And right here you go, your AI agent is powered by an area mannequin!<\/p>\n<\/div>\n<div class=\"inner-block-content rich-content\">\n<h3 data-block-key=\"5y8o5\" id=\"running-qwen-3-with-ollama\">Operating Qwen 3 with Ollama<\/h3>\n<p data-block-key=\"a1npq\">If as a substitute you need to construct a pleasant science instructor agent with the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/qwenlm.github.io\/blog\/qwen3\/\">Qwen 3<\/a> mannequin working regionally in your machine by way of <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/ollama.com\/\">Ollama<\/a>, first, outline our dependencies inside a Maven pom.xml construct file:<\/p>\n<\/div>\n<div class=\"inner-block-content code-block line-numbers\">\n<pre><code class=\"language-xml\">&#13;\n<dependency>&#13;\n    <groupid>com.google.adk<\/groupid>&#13;\n    <artifactid>google-adk<\/artifactid>&#13;\n    <version>0.2.0<\/version>&#13;\n<\/dependency>&#13;\n&#13;\n<dependency>&#13;\n    <groupid>com.google.adk<\/groupid>&#13;\n    <artifactid>google-adk-contrib-langchain4j<\/artifactid>&#13;\n    <version>0.2.0<\/version>&#13;\n<\/dependency>&#13;\n&#13;\n<dependency>&#13;\n    <groupid>dev.langchain4j<\/groupid>&#13;\n    <artifactid>langchain4j-ollama<\/artifactid>&#13;\n    <version>1.4.0<\/version>&#13;\n<\/dependency><\/code><\/pre>\n<p>\n        XML\n    <\/p>\n<\/div>\n<div class=\"inner-block-content rich-content\">\n<p data-block-key=\"rismb\">Let\u2019s assume you\u2019ve already <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/github.com\/ollama\/ollama\/blob\/main\/README.md#quickstart\">put in Ollama<\/a> in your machine, you pulled the Qwen 3 mannequin, and received it working on port <code>11434<\/code>. With LangChain4j, in Java, you instantiate the Ollama mannequin supplier as follows:<\/p>\n<\/div>\n<div class=\"inner-block-content code-block line-numbers\">\n<pre><code class=\"language-java\">OllamaChatModel ollamaChatModel = OllamaChatModel.builder()&#13;\n    .modelName(\"qwen3:1.7b\")&#13;\n    .baseUrl(\"http:\/\/127.0.0.1:11434\")&#13;\n    .construct();<\/code><\/pre>\n<p>\n        Java\n    <\/p>\n<\/div>\n<div class=\"inner-block-content rich-content\">\n<p data-block-key=\"rismb\">Now let\u2019s wire this mannequin right into a easy science instructor agent:<\/p>\n<\/div>\n<div class=\"inner-block-content code-block line-numbers\">\n<pre><code class=\"language-java\">LlmAgent scienceTeacherAgent = LlmAgent.builder()&#13;\n    .identify(\"science-app\")&#13;\n    .description(\"Science instructor agent\")&#13;\n    .mannequin(new LangChain4j(ollamaChatModel))&#13;\n    .instruction(\"\"\"&#13;\n        You're a useful science instructor&#13;\n        who explains science ideas to youngsters and youngsters.&#13;\n        \"\"\")&#13;\n    .construct();<\/code><\/pre>\n<p>\n        Java\n    <\/p>\n<\/div>\n<div class=\"inner-block-content rich-content\">\n<p data-block-key=\"rismb\">If the mannequin helps perform calling, you may give your agent entry to instruments as properly. For instance, give it entry to MCP servers, or your native code pushed features. You&#8217;ll be able to discover the assorted instruments at your disposal on this <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/glaforge.dev\/posts\/2025\/06\/15\/expanding-ai-agent-capabilities-with-tools\/\">article diving into ADK instruments<\/a>, or by wanting on the ADK <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/google.github.io\/adk-docs\/tools\/\">documentation<\/a>.<\/p>\n<\/div>\n<div class=\"inner-block-content rich-content\">\n<h2 data-block-key=\"ckdbq\" id=\"new-features-in-this-release\">New Options on this Launch<\/h2>\n<p data-block-key=\"9d7h9\">Past the headline LangChain4j integration, model 0.2.0 brings a number of different highly effective enhancements to the agent growth workflow:<\/p>\n<ul>\n<li data-block-key=\"167vo\"><b>Expanded Tooling Capabilities<\/b>: We have considerably improved the way you create and handle instruments.\n<ul>\n<li data-block-key=\"b1e9g\"><b>Occasion-based<\/b> <b><code>FunctionTools<\/code><\/b>: Now you can create <code>FunctionTools<\/code> from object cases, not simply static strategies, providing better flexibility in your agent&#8217;s structure.<\/li>\n<li data-block-key=\"ancoo\"><b>Improved Async Help<\/b>: <code>FunctionTools<\/code> now help strategies that return a <code>Single<\/code>. This improves asynchronous operation help and makes brokers extra responsive.<\/li>\n<li data-block-key=\"dd8mh\"><b>Higher Loop Management<\/b>: The brand new <code>endInvocation<\/code> subject in Occasion Actions permits programmatic interruption or stopping of the agent loop after a device name. This offers finer management over agent execution.<\/li>\n<\/ul>\n<\/li>\n<li data-block-key=\"ff38l\"><b>Superior Agent Logic and Reminiscence<\/b>:\n<ul>\n<li data-block-key=\"dh4b9\"><b>Chained Callbacks<\/b>: We have added help for chained callbacks for <code>earlier than\/after<\/code> occasions on mannequin, agent, and power execution. This allows extra advanced and fine-grained logic inside your agent&#8217;s lifecycle.<\/li>\n<li data-block-key=\"2vbie\"><b>New Reminiscence and Retrieval<\/b>: This model introduces an <code>InMemoryMemoryService<\/code> for easy, quick reminiscence administration and implements <code>VertexAiRagRetrieval<\/code> utilizing AI Platform APIs for extra superior RAG patterns.<\/li>\n<\/ul>\n<\/li>\n<li data-block-key=\"an0uk\">Different key enhancements embody a mother or father POM and the Maven Wrapper (<code>.\/mvnw<\/code>), making certain a constant and simple construct course of for all contributors.<\/li>\n<\/ul>\n<\/div>\n<div class=\"inner-block-content rich-content\">\n<h2 data-block-key=\"mzdkp\" id=\"let's-put-those-ai-agents-to-work\">Let\u2019s put these AI brokers to work<\/h2>\n<p data-block-key=\"a9h1k\">We&#8217;re thrilled to get this new model into your palms. The mixing with LangChain4j marks a significant step ahead in making ADK for Java a extra open and versatile framework for constructing highly effective AI brokers.<\/p>\n<p data-block-key=\"98hd8\">To be taught extra about this new model of ADK for Java, learn the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/github.com\/google\/adk-java\/releases\/tag\/v0.2.0\">GitHub launch notes<\/a>. New to growing brokers in Java with ADK? Take a look at the ADK for Java <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/google.github.io\/adk-docs\/get-started\/\">documentation<\/a>, this <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/glaforge.dev\/posts\/2025\/05\/20\/writing-java-ai-agents-with-adk-for-java-getting-started\/\">getting began information<\/a> (and video), or <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/glaforge.dev\/posts\/2025\/05\/27\/adk-java-github-template\/\">fork this GitHub template undertaking<\/a> to start shortly.<\/p>\n<p data-block-key=\"1vb7m\">My colleague Michael Vorburger and myself have been pleased to work on this LangChain4j integration, in collaboration with Dmytro Liubarskyi who created <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/docs.langchain4j.dev\/\">LangChain4j<\/a>. So in case you\u2019re constructing AI brokers in Java with ADK, don\u2019t hesitate to drop us a message to <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/x.com\/glaforge\">@glaforge<\/a> on Twitter\/X or <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/bsky.app\/profile\/glaforge.dev\">@glaforge.dev<\/a> on Bluesky. We\u2019re wanting ahead to listening to about your nice use instances.<\/p>\n<\/div><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>The current 0.2.0 launch of Google\u2019s Agent Growth Equipment (ADK) for Java provides an integration with the LangChain4j LLM framework. This integration offers builders with a big selection of Massive Language Fashions (LLMs) supported by LangChain4j, for constructing AI brokers. Along with ADK\u2019s built-in Google Gemini and Anthropic Claude integrations, builders can now use LangChain4j [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":6808,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[5425,1330,2314,5426,634,266,2672,3077],"class_list":["post-6806","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-adk","tag-integration","tag-java","tag-langchain4j","tag-language","tag-models","tag-opening","tag-thirdparty"],"_links":{"self":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/6806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6806"}],"version-history":[{"count":1,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/6806\/revisions"}],"predecessor-version":[{"id":6807,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/6806\/revisions\/6807"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/media\/6808"}],"wp:attachment":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- This website is optimized by Airlift. Learn more: https://airlift.net. Template:. Learn more: https://airlift.net. Template: 69d9690a190636c2e0989534. Config Timestamp: 2026-04-10 21:18:02 UTC, Cached Timestamp: 2026-08-05 02:50:51 UTC -->