Overview
This RFC proposes a native integration between the Naftiko Framework and LangChain4j. The goal is to provide Java developers with a "Clean Data Layer" for AI agents, allowing them to define tool capabilities in YAML via Naftiko and consume them as type-safe tools in LangChain4j without writing boilerplate integration code.
Problem Statement
Enterprise AI agents often need to interact with legacy systems (SOAP, gRPC, complex REST). Currently, LangChain4j developers must:
- Write manual @tool annotated methods for every API.
- Handle complex data transformation within the Java code.
- Manage "Data Sprawl," where LLMs receive too much irrelevant metadata, increasing token costs and reducing accuracy.
Proposed Solution: NaftikoToolProvider
We propose a bridge module that allows Naftiko to act as a Dynamic Tool Catalog for LangChain4j.
Key Components:
- Metadata Mapping: A converter that translates Naftiko’s YAML capability definitions into LangChain4j ToolSpecification objects.
- Context Engineering: Using Naftiko’s spec-driven transformation (JSONPath/Jolt) to ensure the LLM receives only the "right-sized" data needed for the task.
- Direct Execution: A ToolExecutor that routes LLM-generated arguments directly to the Naftiko engine for execution within the same JVM.
Benefits
- Low Code: Define enterprise integrations in YAML; use them in Java AI agents instantly.
- Governance: Centrally manage API keys, rate limits, and data masking in Naftiko.
- Efficiency: Reduce token usage by filtering API responses before they reach the LLM.
Next Steps
- Develop the naftiko-langchain4j bridge library.
- Contribute a "Legacy-to-AI" example to the langchain4j-examples repository.
- Engage with the community on Discord/GitHub for feedback.
Example
// Loading Naftiko-defined skills directly into an AI Service
NaftikoToolProvider naftikoProvider = new NaftikoToolProvider("classpath:/skills/");
Assistant assistant = AiServices.builder(Assistant.class)
.chatLanguageModel(model)
.toolProvider(naftikoProvider)
.build();
Overview
This RFC proposes a native integration between the Naftiko Framework and LangChain4j. The goal is to provide Java developers with a "Clean Data Layer" for AI agents, allowing them to define tool capabilities in YAML via Naftiko and consume them as type-safe tools in LangChain4j without writing boilerplate integration code.
Problem Statement
Enterprise AI agents often need to interact with legacy systems (SOAP, gRPC, complex REST). Currently, LangChain4j developers must:
Proposed Solution: NaftikoToolProvider
We propose a bridge module that allows Naftiko to act as a Dynamic Tool Catalog for LangChain4j.
Key Components:
Benefits
Next Steps
Example