liveBook · Manning

@Action

As explained in Spring AI in Action

@Action is an Embabel annotation that marks a method as an action available for workflow planning or execution.

@Action marks a method as an Embabel action that can participate in workflow planning and execution. Embabel uses the method’s inputs and outputs to assemble agent workflows. section 12.3.2 section 12.3.3

Use @Action methods to define the parts of an agentic workflow:

  • Annotate methods inside a class marked with @Agent. section 12.3.2
  • Return typed domain objects such as GameRules, GameMechanics, or PlayerCount; Embabel uses these types when connecting actions. section 12.3.3 section 12.3.2
  • Add @AchievesGoal when a method represents a workflow goal; leave it off intermediate actions such as loading game rules. section 12.3.2 section 12.3.3
  • Build action bodies with Spring AI facilities such as PromptRunner, resource-backed prompt templates, and TikaDocumentReader. section 12.3.2 section 12.3.3

Goal-oriented game information

A GameInfoAgent can annotate determineGameMechanics(GameRules) with @Action and @AchievesGoal, returning GameMechanics through PromptRunner. A separate @Action method, getGameRules(GameTitle, RulesFile), supplies the GameRules object but does not itself complete a goal.

How Spring AI in Action covers it

How deep it goes
Explains annotation placement, goal distinction, typed data flow, and implementation with PromptRunner, but not annotation internals.
Examples
Demonstrates game-mechanics, player-count, and rule-loading methods using GameRules, GameMechanics, PlayerCount, and TikaDocumentReader.
What it assumes
Assumes Java and Spring familiarity while teaching agent actions, goals, typed flow, and rule loading through a concrete application.
What you can do after
Build it from scratch by defining typed Embabel actions and composing goal-oriented agent workflows.
How it connects
Connects @Action to @Agent, @AchievesGoal, Goal-Oriented Action Planning, Spring AI, PromptRunner, and type safety.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring AI in Action. The section links point to the parts of the book it draws on.