LnYo-Cly/ai4j
Java 8+ agentic SDK: unified LLM access (OpenAI/Anthropic/DashScope/Doubao/DeepSeek...), Tool Calling, MCP, RAG, Agent Runtime, and a built-in Coding Agent CLI/TUI/ACP.
What it solves
ai4j is a comprehensive SDK for Java developers (JDK 8+) to build AI-powered applications and intelligent agents. It bridges the gap between simple LLM API calls and complex agentic workflows by providing a unified interface for multiple model providers, built-in RAG capabilities, and a dedicated runtime for autonomous agents.
How it works
The project is organized as a multi-module SDK. The core ai4j module handles unified model access (Chat, Embedding, Rerank, etc.) across various platforms like OpenAI, Anthropic, DeepSeek, and Ollama. Higher-level modules like ai4j-agent and ai4j-coding provide the runtime logic for ReAct loops, sub-agents, and team collaboration. It also includes an IngestionPipeline for RAG, connecting document loaders, chunkers, and vector stores (such as Milvus or Qdrant) to enable semantic search.
Who it’s for
Java developers who need to integrate AI capabilities into existing applications, particularly those using older JDK versions (JDK 8+), or those looking to build complex AI agents and coding assistants within the Java ecosystem.
Highlights
- Broad Model Support: Unified access to a wide range of global and Chinese LLM providers.
- Agentic Runtime: Built-in support for ReAct, sub-agents, agent teams, and memory management.
- MCP Support: Integrated Model Context Protocol (MCP) gateway for dynamic data sources.
- Full RAG Stack: Complete pipeline from ingestion to hybrid retrieval (BM25 + semantic) and reranking.
- Coding Agent: Dedicated tools for local codebase interaction via CLI/TUI/ACP.
- Spring Boot Integration: First-class support via a dedicated Spring Boot starter.
- Workflow Integration: Ability to connect to external AgentFlow endpoints like Dify, Coze, and n8n.