A workflow is an explicitly defined sequence of operations that coordinates application-processing steps. In Embabel, annotated action methods form workflows whose inputs and outputs are connected through types. section 12.3.2 section 12.3.3
Build a workflow by:
- Defining intermediate actions such as loading game rules without marking them as goals. section 12.3.3
- Declaring goal-producing actions with @Action and @AchievesGoal. section 12.3.2
- Allowing compatible record types, such as GameRules, GameMechanics, and PlayerCount, to connect action inputs and outputs. section 12.3.2 section 12.3.3
Board-game information workflow
Load a game’s rules, then derive its mechanics and supported player counts. Prompt templates supply the LLM instructions, while typed action results provide the workflow’s intermediate data. section 12.3.2 section 12.3.3
Listing 12.7 GameInfoAgent: An Embabel agent for answering questions about board games
package com.example.embabelgamesagent;
import com.embabel.agent.api.annotation.AchievesGoal;
import com.embabel.agent.api.annotation.Action;
import com.embabel.agent.api.annotation.Agent;
import com.embabel.agent.api.common.PromptRunner;
import com.embabel.agent.domain.io.UserInput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ai.reader.tika.TikaDocumentReader;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.stringtemplate.v4.ST;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Map;
@Agent(
name = "GameInfoAgent",
description = "An agent that helps users answer questions " +
"about board games, including mechanics and player counts.",
version = "1.0.0") #1
public class GameInfoAgent {
private static final Logger LOGGER =
LoggerFactory.getLogger(GameInfoAgent.class);
private final String rulesFilePath;
public GameInfoAgent(
@Value("${boardgame.rules.path}") String rulesFilePath) {
this.rulesFilePath = rulesFilePath; #2
}
// ...action methods go here...
}
Inspect the complete GameInfoAgent implementation, including annotations, prompt-resource loading, helper methods, and typed action results. section 12.3.2















































