StudyBuddy CLI demonstrates the power of building LLM agents with Java instead of Python, using the Embabel framework to create type-safe, production-ready AI applications on the JVM.
Documentación en Español | English Documentation
This project demonstrates that Java with the Embabel framework is an excellent choice for building LLM agents, offering significant advantages for production AI applications:
- Type Safety: Compile-time checking ensures robust code
- Performance: JVM optimization and true multithreading capabilities
- Production Ready: Enterprise-grade monitoring, logging, and deployment
- Dependency Management: Maven's mature dependency resolution
- IDE Support: Excellent refactoring and code intelligence
- Embabel Framework: Purpose-built for Java LLM agents with Spring Boot integration
- Clean Code: Type-safe interfaces and clear contracts
- Maintainability: Strong typing makes refactoring safe and easy
- Enterprise Ready: Seamlessly integrates with existing Java infrastructure
- Spring Ecosystem: Leverage Spring Boot's powerful features
- Powered by Claude 3.5 Haiku: Fast and cost-effective responses
- Bilingual: Native support for Spanish (default) and English
- Three modes:
- Summarize: Topic summaries with difficulty levels
- Research: Academic research with configurable depth
- Explain: Concept explanations with customizable format
- Optimized CLI: Fast interface using PicoCLI
- JVM-based: Built with Embabel framework (Java 21)
- Java 21+
- Maven 3.6+
- Anthropic API key
# 1. Clone the project
git clone <repository-url>
cd studybuddy-cli
# 2. Configure environment variables
echo "ANTHROPIC_API_KEY=your_key_here" > .env
# 3. Build the application
./mvnw clean package -DskipTests
# 4. Test functionality
./studybuddy.sh --help# Basic summary in Spanish (default)
./studybuddy.sh summarize "machine learning"
# Intermediate summary in English
./studybuddy.sh summarize "photosynthesis" --lang EN --level INTERMEDIATE
# Advanced summary
./studybuddy.sh summarize "quantum computing" --lang EN --level ADVANCEDAvailable levels: BEGINNER, INTERMEDIATE, ADVANCED
# Basic research
./studybuddy.sh research "artificial intelligence" --lang EN --depth BASIC
# Detailed research
./studybuddy.sh research "blockchain technology" --lang EN --depth DETAILEDAvailable depths: BASIC, DETAILED
# Explanation in plain text
./studybuddy.sh explain "gravitation" --lang EN --format PLAIN
# Explanation in Markdown
./studybuddy.sh explain "photosynthesis" --lang EN --format MARKDOWNAvailable formats: PLAIN, MARKDOWN
--lang [ES|EN]: Output language (default: Spanish)--help: Show command help
StudyBuddy-CLI/
├── StudyBuddyAgent # Main agent with 3 actions
│ ├── summarizeTopic() # Educational summaries
│ ├── researchTopic() # Academic research
│ └── explainConcept() # Detailed explanations
├── LocalizationService # i18n system
├── CLI Commands # PicoCLI interface
└── Domain Objects # Type-safe data model
- Framework: Embabel Agent Framework 0.1.2
- LLM: Claude 3.5 Haiku Latest
- Templates: Freemarker for localization
- CLI: PicoCLI + Spring Boot
- Build: Maven + Java 21
# Claude 3.5 Haiku optimized for education
embabel.models.defaultLlm=claude-3-5-haiku-latest
embabel.ai.anthropic.temperature=0.3
embabel.ai.anthropic.max-tokens=2000With Claude 3.5 Haiku:
- Input: $0.80 per 1M tokens
- Output: $4 per 1M tokens
- Prompt Caching: 90% discount
- Typical cost per request: ~$0.007 (less than 1 cent)
src/main/java/com/michead/studybuddy/
├── agent/
│ └── StudyBuddyAgent.java
├── domain/
│ ├── StudyRequest.java
│ ├── ResearchRequest.java
│ ├── ExplanationRequest.java
│ ├── StudySummary.java
│ ├── ResearchResult.java
│ └── ConceptExplanation.java
├── localization/
│ ├── StudyBuddyLocale.java
│ ├── LocalizationService.java
│ └── LocalizationConfig.java
└── cli/
├── StudyBuddyCLI.java
├── SummarizeCommand.java
├── ResearchCommand.java
└── ExplainCommand.java
src/main/resources/templates/prompts/
├── es/
│ ├── research.ftl
│ ├── educational_content.ftl
│ └── summarization.ftl
└── en/
├── research.ftl
├── educational_content.ftl
└── summarization.ftl
# Run all tests
./mvnw test
# Specific localization test
./mvnw test -Dtest=LocalizationServiceTestThis project demonstrates JVM advantages for LLM agents mentioned in Rod Johnson's article:
- Type Safety: No magic strings, everything type-safe
- Less Code: More concise than Python equivalents
- Production Ready: Logging, configuration, concurrency handling
- Better Integration: Seamless with Java/Spring ecosystem
- Performance: JVM optimizations + Claude 3.5 Haiku speed
StudyBuddy-CLI is the perfect proof-of-concept for LLM agent potential on the JVM.
- Support for more languages (French, Italian)
- Integration with academic databases
- Export to PDF/Word
- Complementary Web UI
- IDE plugins
- GraalVM native image support
- Fork the project
- Create feature branch (
git checkout -b feature/new-feature) - Commit changes (
git commit -am 'Add new feature') - Push branch (
git push origin feature/new-feature) - Open Pull Request
Licensed under the Apache License, Version 2.0
If you encounter issues or have questions:
- Check the Spanish documentation
- Verify your API key configuration
- Run with
--helpto see all available options
StudyBuddy-CLI - Demonstrating the power of LLM agents on the JVM with Claude 3.5 Haiku