Building Local AI Agents in Java with Tools4AI and Ollama: An Insurance Claims Use Case Tools4AI, a 100% Java agentic AI framework, can be combined with Ollama's local LLM server to build fully offline AI agents that never send data to third-party APIs. In a tutorial, a developer demonstrates an insurance claims triage agent that reads free-text incident reports, routes actions, extracts structured data, gates high-value payouts behind human approval, and records an audit trail. Tools4AI https://github.com/vishalmysore/Tools4AI is a 100% Java agentic AI framework that turns any annotated Java method into an AI-callable action. Ollama https://ollama.com runs open models like Llama 3.1 and Phi-4 locally and exposes an OpenAI-compatible API. Point Tools4AI at http://localhost:11434/v1 and you get a fully offline, on-premise AI agent — no data ever leaves your network. In this tutorial we build an insurance claims triage agent that reads a claimant's free-text incident report, routes it to the right business action, extracts structured data, gates high-value payouts behind a human approval, and records a compliance audit trail. Who is this for?Java developers, solution architects, and engineering leaders in regulated industries insurance, banking, healthcare who want agentic AIwithout sending sensitive data to a third-party API. Insurance runs on personally identifiable information PII : names, addresses, policy numbers, medical details, vehicle data, and loss descriptions. Sending that data to a hosted LLM API creates regulatory, contractual, and reputational risk. At the same time, claims teams are drowning in unstructured text — First Notice of Loss FNOL reports, adjuster notes, emails, and call transcripts. A local AI agent solves both problems at once: That combination — private inference plus governed execution — is exactly what Tools4AI + Ollama gives you. Tools4AI https://github.com/vishalmysore/Tools4AI io.github.vishalmysore:tools4ai on Maven Central is a lightweight, pure-Java agentic AI framework and ADK. Its core idea is simple and powerful: Annotate a Java class with @Agent and its methods with @Action . Tools4AI scans the classpath, and at runtime it maps anatural-language promptto the correct method, extracts the parameters, and invokes it — no manual function schemas required. Key capabilities used in this article: | Feature | What it does | |---|---| Action routing | Maps a prompt to the right @Action method automatically | Automatic parameter mapping | Fills method arguments including POJOs, lists, maps, dates from the prompt | POJO transformation | Converts free text into a populated Java object | Risk gating | Blocks HIGH -risk actions unless a human approves | Audit trail | Records every action for compliance | Agent memory | Keeps conversation context across turns | Because it is provider-agnostic, the same code runs on Gemini, OpenAI, Anthropic — or, as we will do here, a local Ollama model through its OpenAI-compatible endpoint. Ollama serves open-weight models Llama 3.1, Phi-4, Mistral, Gemma, and more behind an OpenAI-compatible REST API at http://localhost:11434/v1 . Because Tools4AI's OpenAiActionProcessor already speaks that protocol, wiring the two together is pure configuration — no adapter, no new code . Pull a model that is good at function calling and start it: ollama pull llama3.1 ollama run llama3.1 Ollama now serves the OpenAI-compatible API locally. Verify it: curl http://localhost:11434/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{"model":"llama3.1","messages": {"role":"user","content":"Say OK"} ,"stream":false}' You should get a JSON response with "content": "OK" .