Untitled conversation
- User
[BUG] Duplicate
activate_skilltool definition error when usingAgenticServices.createAgenticSystem()Describe the bug When creating an agentic system withAgenticServices.createAgenticSystem(), even with a single agent, the application throws anIllegalConfigurationException: Duplicated definition for tool: activate_skillduring execution, caused by multiple registrations of non-dynamicToolProviderinstances.Log and Stack trace
codeCaused by: dev.langchain4j.service.IllegalConfigurationException: Duplicated definition for tool: activate_skill at dev.langchain4j.service.tool.ToolService.addTools(ToolService.java:398) at dev.langchain4j.service.tool.ToolService.lambda$createContextFromStaticToolsAndProviders$0(ToolService.java:378) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at dev.langchain4j.service.tool.ToolService.createContextFromStaticToolsAndProviders(ToolService.java:371) at dev.langchain4j.service.tool.ToolService.createContext(ToolService.java:338) at dev.langchain4j.service.DefaultAiServices$1.invoke(DefaultAiServices.java:260) at dev.langchain4j.service.DefaultAiServices$1.invoke(DefaultAiServices.java:154) at jdk.proxy2/jdk.proxy2.$Proxy5.test(Unknown Source) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ... 5 moreTo Reproduce
java - Assistant
I’ll trace how
createAgenticSystemcollects and applies tool providers, compare it with the single-agent builder path, then add a focused regression test and run the relevant agentic tests. - Assistant
rgisn’t installed in this workspace, so I’m usingfind/grepfor the repository inspection. - Assistant
The duplication is confirmed: constructing
AgentBuilderalready applies declarative suppliers, andcreateAgenticSystemapplies them a second time while injecting the default model/configurator. Since tool providers are accumulated in a list, the exact same non-dynamic provider is registered twice. I’m narrowing the fix so declarative configuration still happens once and configurator/model behavior remains unchanged. - Assistant
I’m implementing the narrow lifecycle fix: the builder’s constructor remains responsible for all declarative suppliers, while the system-level pass now only supplies a fallback chat model and runs the configurator. This also fixes duplicate supplier side effects beyond tools without weakening duplicate-name validation for genuinely distinct providers.
- Assistant
The regression test reproduces the reported shape (
activate_skill, declarative model, configurator overload) and also verifies each supplier/configurator runs once. The targeted Maven test is compiling now. - Assistant
The direct module test can’t resolve this snapshot’s local artifacts in offline mode. I’m switching to a reactor build (
-am) so the required LangChain4j modules are built from this checkout and no network is used. - Assistant
Production and test sources compile successfully across the offline reactor. Test execution is blocked only because Maven’s Surefire JUnit provider artifact is absent from the local cache; I’m checking for an already-cached local JUnit launcher and will also run formatting/diff checks.
- Assistant
The regression now passes through a local reflective JUnit invocation: the agent returns normally,
activate_skillis registered once, and both the provider supplier and configurator are called exactly once. I’m doing the final source/style and working-tree review now.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.