A comprehensive comparison of two leading approaches to building production-ready LLM agents:
- Embabel (Java GOAP): Deterministic planning with enterprise focus
- LangGraph (Python): State-based flexible orchestration
This project demonstrates identical deterministic workflows implemented in two different frameworks for fair side-by-side comparison:
- Pattern: Goal-Oriented Action Planning (GOAP) with deterministic 3-step execution
- Technology: Spring Boot, Spring AI, Java Records
- Focus: Type safety, enterprise integration, high throughput
- Location:
java-tool-server/
- Pattern: State graph orchestration with deterministic 3-step execution
- Technology: LangGraph, LangChain, Pydantic
- Focus: Rapid development, flexibility, Python ecosystem
- Location:
langgraph-advisor/
Both implementations follow the exact same workflow:
- Step 1: Call Technical Tool Server → Get quantitative data (SMA, RSI, MACD)
- Step 2: Call RAG Service → Retrieve qualitative market intelligence
- Step 3: LLM Synthesis → Generate investment thesis with recommendation
See SIDE_BY_SIDE_COMPARISON.md for detailed execution traces and comparison.
Both frameworks now integrate real Yahoo Finance data:
- Uses
yahoofinance-apilibrary (v3.17.0) - Fetches real historical data (90 days)
- Calculates technical indicators (SMA, RSI, MACD)
- Gracefully degrades to mock data if Yahoo Finance unavailable
- Uses
yfinancelibrary (v0.2.66) - Fetches real market data via Yahoo Finance API
- Calculates same technical indicators
- Multi-layer fallback: Yahoo Finance → MCP Server → Mock data
Note: Yahoo Finance unofficial APIs may hit rate limits. Both implementations handle this gracefully with fallback mechanisms.
curl -X POST http://localhost:8080/ai/agent/thesis \
-H "Content-Type: application/json" \
-d '{"ticker":"AAPL"}'Expected Output:
=== Java GOAP Workflow (Deterministic 3-Step) ===
[Java GOAP - Step 1/3] Call Technical Tool Server
[Java GOAP - Step 1/3] ✓ Retrieved: BULLISH
[Java GOAP - Step 2/3] Call RAG Service
[Java GOAP - Step 2/3] ✓ Retrieved 699 characters
[Java GOAP - Step 3/3] LLM Synthesis
[Java GOAP - Step 3/3] ✓ Recommendation: BUY (Confidence: 75.0%)
=== Java GOAP Workflow Complete ===
python langgraph-advisor/main_advisor.py AAPLExpected Output:
=== Python LangGraph Workflow (Deterministic 3-Step) ===
[LangGraph - Step 1/3] Call Technical Tool Server
[LangGraph - Step 1/3] ✓ Retrieved: BULLISH
[LangGraph - Step 2/3] Call RAG Service
[LangGraph - Step 2/3] ✓ Retrieved 473 characters
[LangGraph - Step 3/3] LLM Synthesis
[LangGraph - Step 3/3] ✓ Recommendation: BUY (Confidence: 75.0%)
=== Python LangGraph Workflow Complete ===
Quantitative tool server providing financial calculations:
- Technical Indicators: SMA, RSI, MACD calculations
- GOAP Investment Agent: 3-step workflow for investment thesis
- Mock RAG Service: Qualitative market intelligence
- MCP Protocol: HTTP API for microservice communication
State-based orchestration mirroring Java GOAP workflow:
- Node 1: Call Java MCP Tool Server
- Node 2: RAG search for qualitative data
- Node 3: LLM synthesis of investment thesis
Both implementations follow the same 3-step Goal-Oriented Action Planning:
- Call Quantitative Tool → Get technical indicators
- Call RAG Service → Retrieve market context
- LLM Synthesis → Generate investment thesis
cd java-tool-server
mvn spring-boot:runServer will be available at: http://localhost:8080
python langgraph-advisor/main_advisor.py AAPLGET http://localhost:8080/ai/tools/health
POST http://localhost:8080/ai/tools/technical-indicators
Body: {"ticker": "AAPL"}
POST http://localhost:8080/ai/agent/thesis
Body: {"ticker": "AAPL"}
public record ThesisResult(
String ticker,
String investmentThesis,
String recommendation,
double confidenceScore
) {}class ThesisResult(BaseModel):
ticker: str
investmentThesis: str
recommendation: str
confidenceScore: floatThe mcp.json manifest describes available tools and their schemas, enabling:
- Cross-language tool discovery
- Type-safe remote procedure calls
- Hybrid microservice architectures
Choose Java/Spring AI for:
- Production enterprise systems
- Strict compliance requirements
- High-concurrency microservices
- Integration with existing Java infrastructure
Choose Python/LangGraph for:
- R&D and experimentation
- Data science integration
- Rapid prototyping
- Custom ML model integration
Hybrid Approach (Best of Both):
- Python orchestration calling Java backend tools
- Fast development with stable, scalable foundations