# Embabel

> A JVM agent framework that plans typed actions toward goals instead of following a hand-written flow

- Category: Agents & Automation / Agent Frameworks & Builders
- Language: Kotlin
- Licence: Apache-2.0
- Repository: https://github.com/embabel/embabel-agent
- Website: https://hub.embabel.com
- Canonical page: https://ai-tldr.dev/tools/embabel-agent/

## In short

Embabel (pronounced Em-BAY-bel) is an open-source framework for writing AI agents on the JVM that mix LLM calls with ordinary code and a typed domain model. It is written in Kotlin but designed to read naturally from Java, builds on Spring and Spring AI, and comes from the creator of Spring. It sits in the Agent Frameworks & Builders category of the Agents & Automation tools and is open-source, written in Kotlin and licensed Apache-2.0.

## Overview

Embabel (pronounced Em-BAY-bel) is an open-source framework for writing AI agents on the JVM that mix LLM calls with ordinary code and a typed domain model. It is written in Kotlin but designed to read naturally from Java, builds on Spring and Spring AI, and comes from the creator of Spring. Its own analogy: Spring AI sits at the level of the Servlet API, and Embabel is meant to be the Spring MVC on top of it.

The idea that sets it apart is planning. You describe actions (steps, which may or may not call an LLM), goals and conditions over your domain objects, and the framework works out the sequence itself with a non-LLM planner — Goal-Oriented Action Planning by default, a technique borrowed from game AI, with Utility AI available for open-ended tasks. It replans after every action, so adding a new action or goal extends what the system can do without editing a state machine, and it can combine known steps in an order the developer never wrote down.

Agents are plain Spring beans annotated with `@Agent`, `@Action` and `@AchievesGoal` (or written in a Kotlin DSL), with services injected as usual and prompts producing typed objects rather than loose maps, which keeps them unit-testable. A platform can run one agent on request, classify user intent to pick an agent, or assemble a new agent from every known goal and action in its open mode. Embabel consumes MCP servers as tool groups, can expose its own agents as an MCP server or over Google's A2A protocol, and lets each action pick its model — OpenAI, Anthropic, MiniMax, Z.ai, OCI Generative AI, or local models through Ollama, Docker or LM Studio. It is licensed Apache-2.0 and published on Maven Central.

## What it does

- Actions, goals and conditions over a strongly typed domain model, authored with Spring-style annotations or a Kotlin DSL
- Dynamic planning with GOAP by default (Utility AI also built in) and replanning after each action, so new actions extend behaviour without rewriting flows
- Focused, closed and open execution modes — from calling one agent directly to letting the platform build an agent for a request from all known goals
- Per-action model choice to mix cheap, strong and local LLMs: OpenAI, Anthropic, MiniMax, Z.ai, OCI Generative AI, Ollama, Docker models and LM Studio
- MCP client and server support plus A2A integration, with Spring Boot starters and observability tracing
- Designed for testing: fake operation contexts let unit tests assert on prompts and hyperparameters without calling a model

## Getting started

Embabel runs on Spring Boot and is on Maven Central. The defaults expect an `OPENAI_API_KEY`; the README recommends also setting `ANTHROPIC_API_KEY`, since some examples use both.

1. Start from a template

   Create a repository from the Java or Kotlin agent template on GitHub ("Use this template"), or generate a project with Embabel's project creator. With an OpenAI key and Maven installed, the README says a template agent runs in under a minute.

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

2. Or add the starter to an existing Spring Boot app

   Since version 0.2.0 the starter resolves from Maven Central with no extra repository. Add `embabel-agent-starter-ollama` as well to make every model on a local Ollama endpoint available.

```xml
<dependency>
    <groupId>com.embabel.agent</groupId>
    <artifactId>embabel-agent-starter</artifactId>
    <version>${embabel-agent.version}</version>
</dependency>
```

3. Write an agent

   An agent is a Spring bean. Each `@Action` method takes typed inputs and returns a typed output — here an LLM turns free text into a domain object — and the planner chains actions until one marked `@AchievesGoal` can run.

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

    @Action
    public StarPerson extractStarPerson(UserInput userInput, Ai ai) {
        return ai
                .withLlm(OpenAiModels.GPT_41)
                .createObjectIfPossible(
                        "Create a person from this user input, extracting their name and star sign: "
                                + userInput.getContent(),
                        StarPerson.class);
    }

    // more @Action methods, then one annotated @AchievesGoal
}
```

4. Run the examples in the Spring Shell

   The examples repository starts an interactive shell. `execute` (or `x`) picks a matching agent and runs it; `-p` logs prompts and `-r` logs LLM responses, and `chat` starts an interactive session.

```bash
git clone https://github.com/embabel/embabel-agent-examples
cd embabel-agent-examples/scripts/kotlin
./shell.sh

# inside the shell
execute "Lynda is a Scorpio, find news for her" -p -r
```

5. Expose your agents over MCP

   A running Embabel platform serves its agents as an MCP server over SSE, so a client such as Claude Desktop can call them.

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

## When to use it

- Adding agentic features to an existing Spring application that can reuse its services, persistence and transactions directly
- Multi-step flows such as research, fact-checking or trip planning where the order of steps should adapt to what each step finds
- Mixing a strong hosted model for planning-heavy actions with cheaper or local models for simple extraction, chosen per action
- Teams that want agents covered by ordinary JUnit tests that check prompts and outputs
