# ai4j

A Java 8+ agentic development toolkit that unifies access to more than a dozen large-language-model platforms behind one API, with built-in tool calling, RAG, MCP client and server support, and a long-running agent harness.

ai4j provides one factory for chat, responses and messages-style protocols across OpenAI, Anthropic, DeepSeek, Zhipu, Doubao, Ollama and other platforms, with function calling and native streaming, plus embedding, reranking and media-generation service interfaces. Switching providers only requires changing a platform type and its configuration. Its agent layer supports ReAct, CodeAct and Deep Research execution modes with graph-based orchestration for conditional branches and loops, subagent delegation and multi-agent teams.

Its harness component turns a normally one-shot agent call into a pausable, resumable and auditable long-running task: state persists to file or JDBC storage, multiple workers claim tasks safely by lease, and a submitted result must pass a review and acceptance gate before it counts as complete, with accepted decisions able to be promoted into runtime rules. Built-in RAG covers document loading, chunking, eight vector-store backends, hybrid retrieval, reranking and citation, and it installs as a Spring Boot starter or a plain Maven or Gradle dependency.

Website: https://lnyo-cly.github.io/ai4j/
