This project is a simple Agentic AI Proof of Concept built using Spring Boot + Spring AI + OpenRouter (LLM).
It demonstrates how an AI Agent can investigate a problem step-by-step (like a human engineer) instead of following a fixed hardcoded workflow.
🎯 What Problem Does It Solve?
Given a goal like:
“Why is my Order API slow?”
The agent will:
Check system metrics
Check database performance
Check Kafka lag (optional)
Correlate results
Find the root cause
Stop automatically
🤖 What Is “Agentic AI” Here?
This is NOT a chatbot.
This is:
A state machine where an LLM is used only to decide the next step.
The LLM:
Does NOT access DB
Does NOT access metrics
Does NOT execute anything
It only says:
“Check metrics”
“Now check DB”
“Now we are done”
All real work is done by Java code (tools).
🏗️ Architecture (Simple View)
🔁 Agent Execution Loop (Core Idea)
This is called:
Think → Act → Observe → Think → Act → Stop
🧩 Components
1. ObservabilityAgent
The main orchestrator
Runs the loop
Talks to LLM
Calls tools
Decides when to stop
2. Tools (Simulated)
MetricsTool→ returns API latencyDbTool→ returns slow query infoKafkaTool→ returns consumer lag
(You can replace these with real Prometheus / DB / Kafka later.)
3. MemoryStore
Stores investigation history
Passed back to LLM every iteration
Prevents the agent from “forgetting”
4. LLM (via OpenRouter)
Used only for decision making
Returns which action to perform next
🛑 Very Important Design Rule
The agent is NOT allowed to run forever.
The code contains hard stop conditions, for example:
If a slow query is found → STOP
If max iterations reached → STOP
Never let an LLM control termination in production systems.
▶️ How to Run
1. Get a Free API Key
Go to: https://openrouter.ai
Create account
Create API key
2. Configure application.yml
3. Run Spring Boot App
4. Call in Browser
or
✅ Example Output
🧠 What This Demonstrates (Interview Points)
Agentic AI = LLM + Loop + Tools + Memory
LLM used as decision engine, not execution engine
Deterministic execution + probabilistic reasoning
Safe termination conditions
Real-world use case: production incident investigation
🚫 What This Is NOT
Not a chatbot
Not autonomous
Not replacing real code
Not suitable for core transaction logic
It is for:
Diagnosis, investigation, exploration, triage, decision support
🚀 Future Improvements
Replace fake tools with:
Prometheus client
Real DB queries
Kafka Admin client
Use Spring AI Tool Calling instead of parsing text
Add Verifier Agent
Add Planner Agent
🏁 Final Summary
This project shows how to build a controlled, safe, enterprise-style Agentic AI system using Spring Boot, where an LLM helps in reasoning, but all execution remains in deterministic Java code.
Comments
Post a Comment