💡 Tools4AI
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.
Table of Contents
📌 Rapid Start
🧱 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
🧭 Architecture & Comparison with Spring AI
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
🤖 Agent Toolkit
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.
Memory / Conversation History
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?";
Multi-Agent Orchestration
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());
Re