Agentic Framework for Java, written in 100% Java using Gemini, OpenAI, LocalAI, Anthropic. Build Autonomous Agents in Java with Multi AI voting mechanism. Conv
Agentic Framework for Java, written in 100% Java using Gemini, OpenAI, LocalAI, Anthropic. Build Autonomous Agents in Java with Multi AI voting mechanism. Conv
Tools4AI is 100% Java based Agentic AI Framework and light weight ADK library which can be used to build Java based AI agents for integration with enterprise Java applications. It can be used to build AI agents in A2A , MCP, A2UI, UCP and other protocols. This project illustrates the integration of AI Agents with enterprise tools or external tools, converting natural language prompts into agent actions. These prompts can be called "actionble prompts" or "agent prompts" By leveraging AI capabilities, it streamlines user interactions with complex systems, enhancing productivity and innovation across diverse applications.
For example , we can integrate AI Agent with a customer service application. Users can interact with the AI agent by asking questions or making requests in natural language. For example, a user might ask,"Schedule a maintenance appointment for my car." The AI agent interprets the request, extracts relevant information such as the service required and preferred date, and then triggers the appropriate agent action in the customer service application to schedule the appointment. This seamless integration streamlines the process for users and enhances the efficiency of the customer service workflow through agentic ai automation.
| Prompt | Action |
|---|---|
| Create a new task for the marketing campaign. | The AI agent interprets the request and generates a new task entry within the project management tool dedicated to the marketing campaign, assigning it relevant details such as priority level, due date, and task description. |
| Generate a sales report for the previous quarter. | The AI agent accesses data from the company's sales database, analyzes the information for the previous quarter, and generates a comprehensive sales report, which is then delivered to the user or stored in the appropriate location for access. |
| Check the inventory status of product X. | The AI agent retrieves real-time inventory data for product X from the inventory management system and provides the user with information regarding current stock levels, including quantities available, locations, and any pending orders. |
| Schedule a video conference with the engineering team for next Monday at 10 AM. | The AI agent interfaces with the calendar and scheduling tool, creates a new event titled "Engineering Team Video Conference" for the specified date and time, and sends out meeting invitations to all members of the engineering team. |
| Submit a reimbursement request for the business trip expenses. | The AI agent guides the user through the reimbursement request process, collecting necessary details such as expense receipts, dates, amounts, and purpose of expenditure. Once compiled, the system submits the reimbursement request to the appropriate department for processing. |
Prompt prediction is a technique used to anticipate user actions based on their input prompts. For instance, if a user's prompt is "my car broke down," in addition to the action "bookTaxi," the AI agent can predict a set of subsequent actions such as "bookCarService" and "orderFood" (if it's dinner time). This predictive capability enhances the user experience by proactively suggesting relevant actions or services based on the context provided in the prompt.
Do you want to start building ASAP , Look at Rapid start here https://github.com/vishalmysore/agenticjava
Integration of Spring Controller and AI Actions - https://github.com/vishalmysore/SpringActions
Tools4AI is a retrofit layer — it makes any existing Java system AI-controllable with minimal code change.
Spring AI is a platform for building AI-first apps from scratch on Spring Boot.
| Dimension | Tools4AI | Spring AI |
|---|---|---|
| Core purpose | Agentic action routing — maps prompts to pre-existing Java methods/REST/shell | AI primitives — chat, embeddings, RAG, vector stores for Spring apps |
| Entry point | Annotate any existing Java class/method — works without Spring | Built on Spring Boot — Spring context is required |
| Action discovery | Annotation-driven classpath scan + YAML/JSON config for REST/shell | Manual @Tool registration, function callbacks |
| Parameter mapping | Fully automatic — POJOs, Lists, Maps, arrays populated from prompt | Manual — you define function schemas explicitly |
| Non-Java actions | First-class shell scripts, Swagger/OpenAPI, HTTP REST — no code needed | Not supported natively |
| Safety layer | GuardRails, HumanInLoop, hallucination/bias/fact detectors |
Not built in |
| RAG / Embeddings | Not present | Core feature |
| Weight | Lightweight, single JAR | Full Spring ecosystem |
Full architecture deep-dive, capability breakdown, and improvement roadmap → ARCHITECTURE.md
The com.t4a.agent package adds composable agentic building blocks on top of any AIProcessor
(OpenAI, Gemini, Anthropic, LocalAI). Everything is a plain decorator or helper — no existing
code changes, no Spring required, and the pieces compose freely.
| Capability | Package | Wrap it when you need |
|---|---|---|
| Memory | com.t4a.agent.memory |
conversation context across turns or restarts |
| Orchestration | com.t4a.agent.orchestration |
one prompt routed across several specialist agents |
| ReAct planning | com.t4a.agent.planning |
goals that take several dependent tool calls |
| Tool result feedback | com.t4a.agent.feedback |
a natural-language answer instead of a raw return value |
| Retry & fallback | com.t4a.agent.resilience |
transient provider failures, or a backup provider |
| Rate limiting | com.t4a.agent.resilience |
to stay inside a provider's requests-per-second quota |
| Risk gating | com.t4a.agent.safety |
human approval enforced before destructive actions |
| Audit trail | com.t4a.agent.audit |
a persistent record of what ran and what came back |
| Metrics | com.t4a.agent.metrics |
latency and error rates per operation |
| Async execution | com.t4a.agent.async |
independent calls to overlap instead of queue |
Runnable examples: AgentCapabilitiesExample covers memory, orchestration, planning and feedback; ProductionAgentExample covers risk gating, rate limiting, metrics, async, and the full composed stack.
Give your agent short-term (sliding window) or long-term (file-backed, survives restarts) memory:
AgentMemory memory = new InMemoryAgentMemory(20); // last 20 turns
AgentMemory memory = new PersistentFileAgentMemory("/var/agent/session.json"); // durable
memory.addTurn("What is the weather?", "25°C");
String prompt = memory.getHistoryAsContext() + "\nNow: what should I wear?";Register multiple specialised agents and let the LLM route each part of a compound prompt to the right one, then synthesise a combined answer:
AgentOrchestrator orch = new AgentOrchestrator(new OpenAiActionProcessor());
orch.register(new AgentDefinition("flights", "handles flight booking", flightProcessor));
orch.register(new AgentDefinition("hotels", "handles hotel reservations", hotelProcessor));
OrchestrationResult result = orch.execute(
"Book a flight to Bangalore on Aug 15 and a hotel for 3 nights");
System.out.println(result.getSummary());Multi-step Reason → Act → Observe planning for goals that need several tool calls:
ReActPlanner planner = new ReActPlanner(new OpenAiActionProcessor());
ExecutionPlan plan = planner.plan("Research the best route and book the cheapest flight to Tokyo");
System.out.println(plan.getFinalAnswer());By default processSingleAction returns the raw Java return value. Wrap the processor to have
the LLM turn that raw result into a natural-language answer:
AIProcessor enriched = new ToolResultFeedbackProcessor(new OpenAiActionProcessor());
String answer = (String) enriched.processSingleAction("What is the temperature in Toronto?");
// "The temperature in Toronto is 25°C today." instead of "25"LLM calls fail transiently — rate limits, network blips, model overload. RetryActionProcessor
retries with exponential backoff and can fall back to a different provider when retries run out:
AIProcessor resilient = new RetryActionProcessor(
new OpenAiActionProcessor(),
3, // max attempts
500, // initial backoff ms (doubles each retry)
new GeminiV2ActionProcessor()); // optional fallback provider
Object result = resilient.processSingleAction("Book a flight to Bangalore");Retrying after a 429 is the reactive half of quota management; shapin
No open issues yet, or sync has not completed.