An open API service indexing awesome lists of open source software.

https://github.com/embabel/embabel-agent-examples

Agent Framework Examples for Java and Kotlin Developers
https://github.com/embabel/embabel-agent-examples

Last synced: 5 months ago
JSON representation

Agent Framework Examples for Java and Kotlin Developers

Awesome Lists containing this project

README

          

# ๐Ÿค– Embabel Agent Examples

![Build](https://github.com/embabel/embabel-agent-examples/actions/workflows/maven.yml/badge.svg)

[//]: # ([![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=embabel_embabel-agent&metric=alert_status&token=d275d89d09961c114b8317a4796f84faf509691c)](https://sonarcloud.io/summary/new_code?id=embabel_embabel-agent))

[//]: # ([![Bugs](https://sonarcloud.io/api/project_badges/measure?project=embabel_embabel-agent&metric=bugs)](https://sonarcloud.io/summary/new_code?id=embabel_embabel-agent))

![Kotlin](https://img.shields.io/badge/kotlin-%237F52FF.svg?style=for-the-badge&logo=kotlin&logoColor=white)
![Java](https://img.shields.io/badge/java-%23ED8B00.svg?style=for-the-badge&logo=openjdk&logoColor=white)
![Spring](https://img.shields.io/badge/spring-%236DB33F.svg?style=for-the-badge&logo=spring&logoColor=white)
![Apache Tomcat](https://img.shields.io/badge/apache%20tomcat-%23F8DC75.svg?style=for-the-badge&logo=apache-tomcat&logoColor=black)
![Apache Maven](https://img.shields.io/badge/Apache%20Maven-C71A36?style=for-the-badge&logo=Apache%20Maven&logoColor=white)
![ChatGPT](https://img.shields.io/badge/chatGPT-74aa9c?style=for-the-badge&logo=openai&logoColor=white)
![Jinja](https://img.shields.io/badge/jinja-white.svg?style=for-the-badge&logo=jinja&logoColor=black)
![JSON](https://img.shields.io/badge/JSON-000?logo=json&logoColor=fff)
![GitHub Actions](https://img.shields.io/badge/github%20actions-%232671E5.svg?style=for-the-badge&logo=githubactions&logoColor=white)
![SonarQube](https://img.shields.io/badge/SonarQube-black?style=for-the-badge&logo=sonarqube&logoColor=4E9BCD)
![Docker](https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white)
![IntelliJ IDEA](https://img.shields.io/badge/IntelliJIDEA-000000.svg?style=for-the-badge&logo=intellij-idea&logoColor=white)

ย ย ย ย 

**English** ยท [็ฎ€ไฝ“ไธญๆ–‡](./README.zh-CN.md)

Learn agentic AI development with **Spring Framework** and **Java** or **Kotlin**. These examples demonstrate building
intelligent agents that can plan, execute workflows, use tools, and interact with humans.

> This repository uses the latest Embabel snapshots to illustrate current best practice, whereas
> the [Java](https://github.com/embabel/java-agent-template)
> and [Kotlin](https://github.com/embabel/kotlin-agent-template)
> template repositories s use the latest milestone release for greater stability.
> There may be some minor API incompatilibites and not everything you see here may work in your own project created
> from one of those templates, unless you upgrade the `embabel-agent.version` property in the POM file, as in this
> repository.

## ๐Ÿš€ Quick Start

### Prerequisites

- **Java 21+**
- **API Key** (at least one): [OpenAI](https://platform.openai.com/api-keys)
or [Anthropic](https://www.anthropic.com/api)
- **Maven 3.9+** (optional - project includes Maven wrapper)

### 1. Clone & Build

```bash
git clone https://github.com/embabel/embabel-agent-examples.git
cd embabel-agent-examples
./mvnw clean install # Unix/Linux/macOS
mvnw.cmd clean install # Windows
```

### 2. Set API Keys

```bash
# Required (choose one or both)
export OPENAI_API_KEY="your_openai_key"
export ANTHROPIC_API_KEY="your_anthropic_key"

```

### 3. Run Examples

#### **Kotlin Examples**

```bash
cd scripts/kotlin
./shell.sh # Unix/Linux/macOS - With Docker tools (default)
shell.cmd # Windows - With Docker tools (default)

./shell.sh --no-docker-tools # Unix/Linux/macOS - Basic features only
shell.cmd --no-docker-tools # Windows - Basic features only
```

#### **Java Examples**

```bash
cd scripts/java
./shell.sh # Unix/Linux/macOS - With Docker tools (default)
shell.cmd # Windows - With Docker tools (default)

./shell.sh --no-docker-tools # Unix/Linux/macOS - Basic features only
shell.cmd --no-docker-tools # Windows - Basic features only
```

---

### Creating Your Own Project

You can create your own agent repo from our [Java](https://github.com/embabel/java-agent-template)
or [Kotlin](https://github.com/embabel/kotlin-agent-template) GitHub template by clicking the "Use this template"
button.

You can also create your own Embabel agent project locally with our quick start tool, which allows some customization:

```
uvx --from git+https://github.com/embabel/project-creator.git project-creator
```

Choose Java or Kotlin and specify your project name and package name and you'll have an agent running in under a minute,
if you already have an `OPENAI_API_KEY` and have Maven installed.

## ๐Ÿ†• **Spring Boot Integration Architecture**

### **Embabel Agent Starter Guide:**

#### **`embabel-agent-starter`**

- โœ… Application decides on startup mode (console, web application, etc)
- โœ… Agent discovery and registration
- โœ… Agent Platform beans are available via Dependency Injection mechanism for Application to use as needed
- โœ… Progress tracking and logging
- โœ… Development-friendly error handling

#### **`embabel-agent-starter-shell`**

- โœ… Interactive command-line interface
- โœ… Agent discovery and registration
- โœ… Human-in-the-loop capabilities
- โœ… Progress tracking and logging
- โœ… Development-friendly error handling

#### **`embabel-agent-starter-mcpserver`**

- โœ… MCP protocol server implementation
- โœ… Tool registration and discovery
- โœ… JSON-RPC communication via SSE (Server-Sent Events)
- โœ… Integration with MCP-compatible clients
- โœ… Security and sandboxing

### **Application Examples**

#### Shell Mode with Logging Theme

```kotlin
@SpringBootApplication
@ConfigurationPropertiesScan(basePackages = ["com.embabel.example"])
class KotlinAgentShellApplication

fun main(args: Array) {
runApplication(*args) {
setDefaultProperties(
mapOf("embabel.agent.logging.personality" to LoggingThemes.STAR_WARS)
)
}
}
```

```java
// Java version
@SpringBootApplication
@ConfigurationPropertiesScan(basePackages = {"com.embabel.example"})
public class JavaAgentShellApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(JavaAgentShellApplication.class);
app.setDefaultProperties(Map.of(
"embabel.agent.logging.personality", LoggingThemes.STAR_WARS
));
app.run(args);
}
}
```

#### Shell Mode with MCP Client Support (Docker Tools)

```kotlin
@SpringBootApplication
@ConfigurationPropertiesScan(basePackages = ["com.embabel.example"])
class KotlinAgentShellApplication

fun main(args: Array) {
runApplication(*args) {
setAdditionalProfiles(McpServers.DOCKER) // Activates application-docker-ce.yml
setDefaultProperties(
mapOf("embabel.agent.logging.personality" to LoggingThemes.SEVERANCE)
)
}
}
```

#### MCP Server Mode

```kotlin
@SpringBootApplication
@ConfigurationPropertiesScan(basePackages = ["com.embabel.example"])
class KotlinAgentMcpServerApplication

fun main(args: Array) {
runApplication(*args) {
setAdditionalProfiles(McpServers.DOCKER, McpServers.DOCKER_DESKTOP)
}
}
```

### **Configuration Guide**

#### Logging Personality

Set via the `embabel.agent.logging.personality` property:

- `"starwars"` - May the Force be with your logs!
- `"severance"` - Welcome to Lumon Industries (default)

#### MCP Client Integration

Configure via Spring profiles that define Spring AI MCP client connections in `application-{profile}.yml`:

```yaml
# application-docker-ce.yml
spring:
ai:
mcp:
client:
type: SYNC
stdio:
connections:
docker-mcp:
command: docker
args: [mcp, gateway, run]
```

---

## Setting up MCP Tools

Several of the examples use the Model Context Protocol (MCP) to access tools and services.

The default source is the Docker Desktop MCP server, which is installed with Docker Desktop.

To ensure tools are available and startup doesn't time out, first pull models with:

```bash
docker login
docker mcp gateway run
```

When the gateway has come up you can kill it and start the Embabel server.

## ๐Ÿ“š Examples by Learning Level

### ๐Ÿ† **Beginner: InjectedComponent**

> **Available in:** Java | **Concept:** Just a Little AI

Demonstrates how you can inject any Spring component with an Embabel `OperationContext`
and use it to call LLMs with the rich Embabel API.

```java

@Component
public record InjectedComponent(Ai ai) {

public record Joke(String leadup, String punchline) {
}

public String tellJokeAbout(String topic) {
return ai
.withDefaultLlm()
.generateText("Tell me a joke about " + topic);
}

public Joke createJokeObjectAbout(String topic1, String topic2, String voice) {
return ai
.withLlm(LlmOptions.withDefaultLlm().withTemperature(.8))
.createObject("""
Tell me a joke about %s and %s.
The voice of the joke should be %s.
The joke should have a leadup and a punchline.
""".formatted(topic1, topic2, voice),
Joke.class);
}

}
```

### ๐ŸŒŸ **Beginner: Horoscope News Agent**

> **Available in:** Java & Kotlin | **Concept:** Basic Agent Workflow

A fun introduction to agent development that finds personalized news based on someone's star sign.

**What It Teaches:**

- ๐Ÿ“‹ **Action-based workflows** with `@Action` annotations
- ๐Ÿ” **Data extraction** from user input using LLMs
- ๐ŸŒ **Web tool integration** for finding news stories
- ๐Ÿ“ **Content generation** with personality and context
- ๐ŸŽฏ **Goal achievement** with `@AchievesGoal`

**How It Works:**

1. Extract person's name from user input
2. Get their star sign (via form if needed)
3. Retrieve daily horoscope
4. Search web for relevant news stories
5. Create amusing writeup combining horoscope + news

**Try It:**

Start the agent shell, then type:

```bash
x "Find horoscope news for Alice who is a Gemini"
```

`x` is short for `execute`, which triggers the agent to run its workflow.

**Code Comparison:**

- **Kotlin:** `examples-kotlin/src/main/kotlin/com/embabel/example/horoscope/StarNewsFinder.kt`
- **Java:** `examples-java/src/main/java/com/embabel/example/horoscope/StarNewsFinder.java`

**Key Patterns:**

```kotlin
@Agent(description = "Find news based on a person's star sign")
class StarNewsFinder {

@Action
fun extractPerson(userInput: UserInput, context: OperationContext): Person?

@Action(toolGroups = [CoreToolGroups.WEB])
fun findNewsStories(person: StarPerson, horoscope: Horoscope, context: OperationContext): RelevantNewsStories

@AchievesGoal(description = "Create an amusing writeup")
@Action
fun starNewsWriteup(/* params */): Writeup
}
```

---

### ๐Ÿ”ฌ **Expert: Multi-LLM Research Agent**

> **Available in:** Java, Kotlin | **Concept:** Self-Improving AI Workflows

A sophisticated research agent using multiple AI models with self-critique capabilities.

**What It Teaches:**

- ๐Ÿง  **Multi-model consensus** (GPT-4 + Claude working together)
- ๐Ÿ” **Self-improvement loops** with critique and retry
- โš™๏ธ **Configuration-driven behavior** with Spring Boot properties
- ๐ŸŒŠ **Parallel processing** of research tasks
- ๐Ÿ“ **Quality control** through automated review

**Architecture:**

```kotlin
@ConfigurationProperties(prefix = "embabel.examples.researcher")
data class ResearcherProperties(
val maxWordCount: Int = 300,
val claudeModelName: String = AnthropicModels.CLAUDE_35_HAIKU,
val openAiModelName: String = OpenAiModels.GPT_41_MINI
)
```

**Self-Improvement Pattern:**

```kotlin
@Action(outputBinding = "gpt4Report")
fun researchWithGpt4(/* params */): SingleLlmReport

@Action(outputBinding = "claudeReport")
fun researchWithClaude(/* params */): SingleLlmReport

@Action(outputBinding = "mergedReport")
fun mergeReports(gpt4: SingleLlmReport, claude: SingleLlmReport): ResearchReport

@Action
fun critiqueReport(report: ResearchReport): Critique

@AchievesGoal(description = "Completes research with quality assurance")
fun acceptReport(report: ResearchReport, critique: Critique): ResearchReport
```

**Try It:**

```bash
"Research the latest developments in renewable energy adoption"
```

**Location:** `examples-kotlin/src/main/kotlin/com/embabel/example/researcher/`

---

### โœ… **Expert: Fact-Checking Agent (DSL Style)**

> **Available in:** Kotlin | **Concept:** Functional Agent Construction

A fact-verification agent built using Embabel's functional DSL approach instead of annotations.

**What It Teaches:**

- ๐Ÿ”ง **Functional DSL construction** for agents
- ๐Ÿ” **Parallel fact verification** across multiple claims
- ๐Ÿ“Š **Confidence scoring** and source trust evaluation
- ๐ŸŒ **Web research integration** for verification
- โšก **Functional programming patterns** in agent design

**DSL Construction:**

```kotlin
fun factCheckerAgent(llms: List, properties: FactCheckerProperties) =
agent(name = "FactChecker", description = "Check content for factual accuracy") {

flow {
aggregate(
transforms = llms.map { llm ->
{ context -> /* extract assertions with this LLM */ }
},
merge = { list, context -> /* rationalize overlapping claims */ }
)
}

transformation {
/* parallel fact-checking */
}
}
```

**Domain Model:**

```kotlin
data class FactualAssertion(
val claim: String,
val reasoning: String
)

data class AssertionCheck(
val assertion: FactualAssertion,
val isFactual: Boolean,
val confidence: Double,
val sources: List
)
```

**Try It:**

```bash
"Check these facts: The Earth is flat. Paris is the capital of France."
```

**Location:** `examples-kotlin/src/main/kotlin/com/embabel/example/factchecker/`

---

## ๐Ÿ› ๏ธ Core Concepts You'll Learn

### **Spring Framework Integration**

- **Auto-Configuration:** Starters handle all configuration automatically
- **Profile-Based Configuration:** MCP clients configured via Spring profiles
- **Maven Profiles:** `enable-shell`, `enable-shell-mcp-client`, `enable-agent-mcp-server`
- **Dependency Injection:** Constructor-based injection with agents as Spring beans
- **Configuration Properties:** Type-safe configuration with `@ConfigurationProperties`
- **Conditional Beans:** Environment-specific components with `@ConditionalOnBean`
- **Repository Pattern:** Spring Data integration for domain entities

### **Modern Spring Boot Patterns**

- **Auto-Configuration:** Starters handle all configuration automatically
- **Profile-Based Configuration:** MCP clients configured via Spring profiles
- **Profile-Based Execution:** Maven profiles control which application class runs
- **Auto-Configuration Classes:** Understanding Spring Boot's auto-configuration
- **Conditional Configuration:** Mode-specific bean loading
- **Theme-Based Customization:** Dynamic behavior based on properties

### **Modern Kotlin Features**

- **Data Classes:** Rich domain models with computed properties
- **Type Aliases:** Domain-specific types (`typealias OneThroughTen = Int`)
- **Extension Functions:** Enhanced functionality for existing types
- **Delegation:** Clean composition patterns
- **DSL Construction:** Functional agent building
- **Coroutines:** Parallel execution with structured concurrency

### **Agent Design Patterns**

- **Workflow Orchestration:** Multi-step processes with `@Action` chains
- **Blackboard Pattern:** Shared workspace for data between actions
- **Human-in-the-Loop:** User confirmations and form submissions
- **Self-Improvement:** Critique and retry loops for quality
- **Multi-Model Consensus:** Combining results from different LLMs
- **Condition-Based Flow:** Workflow control with `@Condition`
- **Progress Tracking:** Event publishing for monitoring

---

### Additional Examples

Some of our examples are projects in their own right, and are therefore
in separate repositories.

See:

- [Coding Agent](https://www.github.com/embabel/coding-agent): An open source coding agent
- [Flicker](https://www.github.com/embabel/flicker): A movie recommendation engine that takes into account the user's
tastes and what's available to them in their country on the streaming services they subscribe to. Uses external APIs
and PostgreSQL via JPA. Illustrates a complex workflow where recommendations are generated until enough available
movies have been found.
- [Decker](https://www.github.com/embabel/decker): An agent to build presentations using Embabel
- [Tripper](https://www.github.com/embabel/tripper): Travel planning agent. Uses mapping APIs to find routes and places
of interest, and generates a travel itinerary. Performs research on points of interest in parallel.

## ๐Ÿ”ง Running Specific Examples

### **Interactive Shell Mode** (Default)

```bash
cd scripts/kotlin && ./shell.sh # With Docker tools (default)
cd scripts/kotlin && shell.cmd # With Docker tools (Windows)
# or
cd scripts/java && ./shell.sh # With Docker tools (default)
cd scripts/java && shell.cmd # With Docker tools (Windows)
```

Uses Maven profile: `enable-shell-mcp-client`

### **Shell Without Docker Tools**

```bash
cd scripts/kotlin && ./shell.sh --no-docker-tools # Basic features only
cd scripts/kotlin && shell.cmd --no-docker-tools # Basic features (Windows)
# or
cd scripts/java && ./shell.sh --no-docker-tools # Basic features only
cd scripts/java && shell.cmd --no-docker-tools # Basic features (Windows)
```

Uses Maven profile: `enable-shell`

### **With Observability (Zipkin Tracing)**

Enable distributed tracing with Zipkin by adding the `--observability` flag:

```bash
cd scripts/kotlin && ./shell.sh --observability # Enable observability
cd scripts/kotlin && shell.cmd --observability # Enable observability (Windows)
# or
cd scripts/java && ./shell.sh --observability # Enable observability
cd scripts/java && shell.cmd --observability # Enable observability (Windows)
```

Make sure to run `docker compose up` in the project root to start Zipkin trace collector:

```bash
docker compose up
```
You should be able to access Zipkin Console: http://127.0.0.1:9411/zipkin/

### **MCP Server Mode**

```bash
cd scripts/kotlin && ./mcp_server.sh
cd scripts/kotlin && mcp_server.cmd # Windows
# or
cd scripts/java && ./mcp_server.sh
cd scripts/java && mcp_server.cmd # Windows
```

Uses Maven profile: `enable-agent-mcp-server`

You can use the Embabel agent platform as an MCP server from a
UI like Claude Desktop. The Embabel MCP server is available over SSE.

Configure Claude Desktop as follows in your `claude_desktop_config.yml`:

```json
{
"mcpServers": {
"embabel-examples": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"http://localhost:8080/sse"
]
}
}
}

```

See [MCP Quickstart for Claude Desktop Users](https://modelcontextprotocol.io/quickstart/user) for how to configure
Claude Desktop.

Create a project in Claude Desktop to work with Embabel examples. This will
enable you to add a custom system prompt.

The Embabel server will expose each goal as an MCP tool, enabling
Claude Desktop to invoke them like this:

Claude Desktop invoking Embabel Star News Finder Agent

The [MCP Inspector](https://github.com/modelcontextprotocol/inspector) is a helpful tool for interacting with your
Embabel
SSE server, manually invoking tools and checking the exposed prompts and resources.

Start the MCP Inspector with:

```bash
npx @modelcontextprotocol/inspector
```

### **Manual Execution**

```bash
# Kotlin shell mode with MCP client (default)
cd examples-kotlin
mvn -P enable-shell-mcp-client spring-boot:run

# Kotlin shell mode without MCP client
cd examples-kotlin
mvn -P enable-shell spring-boot:run

# Kotlin MCP server mode
cd examples-kotlin
mvn -P enable-agent-mcp-server spring-boot:run

# Java equivalents use the same pattern
cd examples-java
mvn -P enable-shell-mcp-client spring-boot:run
```

### **Testing**

```bash
# Run all tests
./mvnw test # Unix/Linux/macOS
mvnw.cmd test # Windows

# Module-specific tests
cd examples-kotlin && ../mvnw test
cd examples-java && ../mvnw test
```

---

## ๐ŸŒ **MCP (Model Context Protocol) Support**

### **What is MCP?**

MCP (Model Context Protocol) is an open protocol that enables AI assistants and applications to securely connect to data
sources and tools. Embabel supports MCP in two ways:

1. **MCP Server Mode**: Your agents become tools that can be called by MCP clients
2. **MCP Client Support**: Your agents can call external MCP servers (like Docker Desktop)

### **MCP Server Mode**

Run your agents as an MCP server that exposes tools over Server-Sent Events (SSE):

```bash
# Start Kotlin agents as MCP server
cd scripts/kotlin && ./mcp_server.sh

# Start Java agents as MCP server
cd scripts/java && ./mcp_server.sh
```

Your agents become available as tools:

- **StarNewsFinder** - `find_horoscope_news`
- **Researcher** - `research_topic`
- **FactChecker** - `check_facts`

### **MCP Client Support**

Docker tools are enabled by default. To disable:

```bash
# Disable Docker MCP integration
cd scripts/kotlin && ./shell.sh --no-docker-tools
cd scripts/java && ./shell.sh --no-docker-tools
```

With Docker tools enabled, your agents can:

- Execute commands in Docker containers
- Access containerized services
- Integrate with other MCP-compatible tools

### **Benefits of MCP**

- **๐Ÿ”„ Tool Interoperability** - Agents can use and be used as tools
- **๐ŸŽฏ Domain Expertise** - Specialized agents for specific tasks
- **๐Ÿ› ๏ธ Tool Composition** - Combine multiple tools in workflows
- **๐Ÿ”’ Secure Access** - MCP handles authentication and sandboxing
- **๐Ÿ“ˆ Scalable Architecture** - Add new tools without changing code

---

## ๐ŸŽฏ **Creating Your Own Agent Application**

### **Basic Shell Application**

```kotlin
@SpringBootApplication
class MyAgentApplication

fun main(args: Array) {
runApplication(*args)
}
```

Add the shell starter to your `pom.xml`:
```xml

com.embabel.agent
embabel-agent-starter-shell

```

### **Shell with Theme and MCP Client**

```kotlin
@SpringBootApplication
@ConfigurationPropertiesScan(basePackages = ["com.example"])
class MyThemedAgentApplication

fun main(args: Array) {
runApplication(*args) {
setAdditionalProfiles("docker-ce") // Enable MCP client via profile
setDefaultProperties(
mapOf("embabel.agent.logging.personality" to LoggingThemes.STAR_WARS)
)
}
}
```

### **MCP Server Application**

```kotlin
@SpringBootApplication
class MyMcpServerApplication

fun main(args: Array) {
runApplication(*args)
}
```

Add the MCP server starter to your `pom.xml`:
```xml

com.embabel.agent
embabel-agent-starter-mcpserver

```

---

## ๐ŸŽฏ Getting Started Recommendations

### **New to Agents?**

1. Start with **Horoscope News Agent** (Java or Kotlin)
2. Compare the Java vs Kotlin implementations
3. Experiment with different prompts and see how the agent plans different workflows
4. Try different logging themes to make development more fun!

### **Spring Developer?**

1. Look at the configuration classes and repository integration
2. Study the domain model design and service composition
3. Explore the different application modes and Maven profiles
4. See how profiles and properties configure MCP clients

### **Kotlin Enthusiast?**

1. Progress to **Researcher** for multi-model patterns
2. Explore **Fact Checker** for functional DSL approaches

### **AI/ML Developer?**

1. Study prompt engineering techniques in any example
2. Examine the **Researcher** for multi-model consensus patterns
3. Look at **Fact Checker** for confidence scoring and source evaluation
4. Explore MCP integration for tool composition

---

## ๐Ÿšจ Common Issues & Solutions

| Problem | Solution |
|---------------------------------|-------------------------------------------------------------------------------------------------|
| **"No API keys found"** | Set `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` |
| **Wrong examples load** | Use correct script: `kotlin/shell.sh` vs `java/shell.sh` |
| **Build failures** | Run `./mvnw clean install` (Unix/macOS) or `mvnw.cmd clean install` (Windows) from project root |
| **Application class not found** | Check Maven profile matches application class |
| **MCP client fails to connect** | Check port availability and Docker Desktop status. See instructions on pulling models above. |

Look at the log output in the event of failure as it may contain hints as to the solution.

---

## ๐Ÿ“ Project Structure

```
embabel-agent-examples/
โ”œโ”€โ”€ examples-kotlin/ # ๐Ÿ† Kotlin implementations
โ”‚ โ”œโ”€โ”€ src/main/kotlin/com/embabel/example/
โ”‚ โ”‚ โ”œโ”€โ”€ KotlinAgentShellApplication.kt # Shell + MCP client (default)
โ”‚ โ”‚ โ”œโ”€โ”€ KotlinAgentSimpleShellApplication.kt # Shell without MCP
โ”‚ โ”‚ โ”œโ”€โ”€ KotlinAgentMcpServerApplication.kt # MCP server mode
โ”‚ โ”‚ โ”œโ”€โ”€ horoscope/ # ๐ŸŒŸ Beginner: Star news agent
โ”‚ โ”œโ”€โ”€ pom.xml # Maven profiles for each mode
โ”‚ โ””โ”€โ”€ README.md # ๐Ÿ“– Kotlin-specific documentation
โ”‚
โ”œโ”€โ”€ examples-java/ # โ˜• Java implementations
โ”‚ โ”œโ”€โ”€ src/main/java/com/embabel/example/
โ”‚ โ”‚ โ”œโ”€โ”€ JavaAgentShellApplication.java # Shell with themes
โ”‚ โ”‚ โ”œโ”€โ”€ JavaAgentSimpleShellApplication.java # Shell without MCP
โ”‚ โ”‚ โ”œโ”€โ”€ JavaMcpServerApplication.java # MCP server mode
โ”‚ โ”‚ โ””โ”€โ”€ horoscope/ # ๐ŸŒŸ Beginner: Star news agent
โ”‚ โ””โ”€โ”€ README.md # ๐Ÿ“– Java-specific documentation
โ”‚
โ”œโ”€โ”€ examples-common/ # ๐Ÿ”ง Shared services & utilities
โ”œโ”€โ”€ scripts/ # ๐Ÿš€ Quick-start scripts
โ”‚ โ”œโ”€โ”€ kotlin/
โ”‚ โ”‚ โ”œโ”€โ”€ shell.sh # Launch shell (--no-docker-tools to disable)
โ”‚ โ”‚ โ””โ”€โ”€ mcp_server.sh # Launch MCP server
โ”‚ โ”œโ”€โ”€ java/
โ”‚ โ”‚ โ”œโ”€โ”€ shell.sh # Launch shell (--no-docker-tools to disable)
โ”‚ โ”‚ โ””โ”€โ”€ mcp_server.sh # Launch MCP server
โ”‚ โ”œโ”€โ”€ support/ # Shared script utilities
โ”‚ โ””โ”€โ”€ README.md # ๐Ÿ“– Scripts documentation
โ””โ”€โ”€ pom.xml # Parent Maven configuration
```

---

## ๐Ÿ“„ License

Licensed under the Apache License 2.0. See [LICENSE](LICENSE) for details.

**๐ŸŽ‰ Happy coding with Spring Framework and agentic AI!**

### ๐ŸŒŸ May the Force be with your agents! ๐ŸŒŸ

## Contributors

[![Embabel contributors](https://contrib.rocks/image?repo=embabel/embabel-agent-examples)](https://github.com/embabel/embabel-agent-examples/graphs/contributors)