Key Use Cases for Embabel-Agent: Building Production-Ready LLM Agents in Java and Kotlin

Embabel-agent is a JVM-native framework for building goal-oriented, LLM-driven agents with automatic planning, mixed code-LLM workflows, and built-in observability.

The embabel-agent repository provides a strongly-typed agentic platform that separates goals, actions, conditions, and domain models into composable components. According to the embabel/emabel-agent source code, this architecture enables developers to build autonomous systems that can replan dynamically without modifying existing code. Below are the seven primary use cases that demonstrate why teams choose this framework for production agent development.


Goal-Oriented Autonomous Agents with Automatic Planning

The core use case for embabel-agent is creating autonomous agents that pursue goals through automatic planning.

Developers annotate a class with @Agent and define methods with @Goal, @Action, and @Condition. The runtime—implemented in AgentPlatform.kt—automatically constructs execution plans using GOAP (Goal-Oriented Action Planning) or Utility AI algorithms. After each action completes, the system evaluates whether replanning is necessary.

This replanning capability is crucial for long-running agents. When an action fails or preconditions change, the GoalChoiceApprover interface determines the next best goal without developer intervention.

@Agent(description = "Find news based on a person's star sign")
public class StarNewsFinder {
    // Actions automatically sequenced by the planner
}

The planning layer is pluggable, as documented in the repository's Planning section.


Mixed LLM-Code Flows for Hybrid Intelligence

Embabel-agent excels at combining deterministic code with non-deterministic LLM calls in single methods.

The Ai interface provides withLlm(...) methods that let developers invoke models inline while also executing regular Java/Kotlin logic. This enables scenarios where you:

  • Extract structured data from unstructured input using an LLM
  • Enrich prompts with live database or API data
  • Chain multiple model calls with business logic between them
@Action
public StarPerson extractStarPerson(UserInput userInput, Ai ai) {
    return ai.withLlm(OpenAiModels.GPT_41)
             .createObjectIfPossible(
                 "Create a person from: " + userInput.getContent(),
                 StarPerson.class);
}

The ToolGroup and @Tool annotations provide the architectural foundation for this hybrid approach, as shown in the Show Me The Code example.


Dynamic Tool Integration via Model Context Protocol (MCP)

Embabel-agent ships with a built-in MCP client for calling external tools through a standardized Server-Sent Events (SSE) interface.

The McpClient class enables agents to invoke search engines, web fetchers, browsers, and custom tools without hardcoding integrations. Configuration in application.yml activates tool groups like ToolGroup.WEB:

@Action(toolGroups = {CoreToolGroups.WEB})
public RelevantNewsStories findNewsStories(StarPerson person,
                                            Horoscope horoscope,
                                            Ai ai) {
    // Web search and fetch tools available automatically
}

The EmbabelToolLoopObservationConvention standardizes how tool results flow back into the agent's context window, enabling multi-step tool use loops.


Production Observability and Distributed Tracing

Adding embabel-agent-starter-observability to your classpath automatically instruments the entire agent lifecycle.

The TrackedAspect.java file implements AspectJ-based tracing that captures:

  • Agent initialization and goal selection
  • Action execution timing and outcomes
  • LLM call latency, token usage, and prompts
  • Tool invocation successes and failures

Spans propagate through EmbeddingEventListener and MicrometerAgentInstrumentation for export to OpenTelemetry backends, Jaeger, or Prometheus.

This addresses a critical gap in LLM systems: debugging why an agent made a particular decision. The tracing data reveals the exact sequence of planner choices, model responses, and tool results that led to any output.


Multi-Model and Local Model Deployment

Embabel-agent supports pluggable model backends through Spring AI integration.

The framework works with:

  • OpenAI (GPT-4, GPT-4.1, GPT-4o)
  • Anthropic (Claude models)
  • Ollama (local open-source models)
  • Docker (containerized inference)
  • OCI Generative AI (Oracle Cloud)

Switching models requires only a bean definition change. The OpenAiConfiguration and EmbabelAgentPlatform classes handle provider-specific formatting transparently.

For air-gapped or cost-sensitive deployments, the embabel-agent-starter-ollama module demonstrates zero-code local model integration.


Test-First Agent Development

Unlike many LLM frameworks that resist unit testing, embabel-agent provides AgentTestSupport for capturing and asserting on LLM interactions.

The EmbabelMockitoIntegrationTest.java file in embabel-agent-test-support demonstrates how to:

  • Replace live models with FakeOperationContext implementations
  • Assert on exact prompt contents sent to the LLM
  • Verify tool group composition and parameter binding
  • Test replanning logic under simulated failure conditions
@Test
void shouldExtractStarPersonFromInput() {
    // Given a captured LLM interaction
    // When the action executes
    // Then the prompt contains expected structure
}

This enables TDD for agents: write tests specifying expected behavior, then implement actions to satisfy them.


Extensible Federation and Cross-System Collaboration

The embabel-agent roadmap includes agent federation capabilities for distributed systems.

Future versions will support:

  • A2A (Agent-to-Agent) protocol for cross-service goal sharing
  • Goal and action registries across organizational boundaries
  • A2AServer implementations for external agent discovery

The GoalChoiceApprover interface already provides hooks for external goal arbitration, laying groundwork for federated planning where multiple agent platforms collaborate on shared objectives.


Summary

Embabel-agent addresses seven critical use cases for production agent development:

  • Automatic planning and replanning through GOAP/Utility AI in AgentPlatform
  • Hybrid LLM-code workflows via the Ai interface and @Action annotations
  • Standardized tool integration through the built-in McpClient and MCP protocol
  • Zero-configuration observability with TrackedAspect and Micrometer integration
  • Flexible model deployment across cloud and local providers
  • Testable architecture using AgentTestSupport and FakeOperationContext
  • Future-proof federation via A2A protocol support

These capabilities make embabel-agent suitable for applications ranging from simple chatbots to complex autonomous research agents that browse the web, synthesize findings, and produce structured outputs—all while remaining fully observable and testable.


Frequently Asked Questions

What programming languages does embabel-agent support?

Embabel-agent is JVM-native and primarily targets Java and Kotlin. The core API in AgentPlatform.kt and AgentDsl.kt provides idiomatic Kotlin DSL support (agent { ... } blocks) while maintaining full Java interoperability. All annotations (@Agent, @Action, @Goal) work identically in both languages.

How does embabel-agent compare to LangChain or LlamaIndex?

LangChain and LlamaIndex are Python-centric with optional JavaScript support. Embabel-agent is purpose-built for JVM ecosystems with compile-time type safety, Spring integration, and enterprise observability patterns. Its planning architecture (GOAP/Utility AI) differs from LangChain's chain-based approach, offering more explicit goal-action relationships.

Can I use embabel-agent with existing Spring Boot applications?

Yes. Embabel-agent is designed as Spring Boot starters. Add embabel-agent-starter to your dependencies, define an @Agent-annotated bean, and the framework auto-configures planning, LLM clients, and observability. The MCP client and tool groups integrate through standard Spring dependency injection.

Is embabel-agent suitable for long-running autonomous agents?

Yes. The GoalChoiceApprover interface and automatic replanning after each action make embabel-agent well-suited for persistent agents that execute over extended periods. The observability stack ensures you can audit decisions even when agents run for hours or days.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →