Interface TurnBody<S>

Type Parameters:
S - the type of the custom session state
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface TurnBody<S>
The body of one agent turn. Implementations run the actual agent logic (e.g. calling the model, executing tools) and return the AgentFinishReason for this turn.

TurnBody is called by SessionRunner.runTurn(com.google.genkit.ai.agent.AgentInput, com.google.genkit.ai.agent.TurnBody<S>) after input validation and message appending. On success the runner persists a COMPLETED snapshot; on exception the runner persists a FAILED snapshot and swallows the exception.

  • Method Details