Package com.google.genkit.ai.agent
Class TurnContext
java.lang.Object
com.google.genkit.ai.agent.TurnContext
Per-turn context exposed to
TurnBody implementations. Carries the snapshot IDs reserved
for this turn and the current turn index.-
Constructor Summary
ConstructorsConstructorDescriptionTurnContext(String snapshotId, String parentSnapshotId, int turnIndex) Constructs a new TurnContext. -
Method Summary
Modifier and TypeMethodDescriptionReturns the parent snapshot ID (ID of the previous turn's snapshot).Returns the snapshot ID reserved for this turn.intReturns the zero-based index of this turn.
-
Constructor Details
-
TurnContext
Constructs a new TurnContext.- Parameters:
snapshotId- the snapshot ID reserved for this turn (empty string for client-managed)parentSnapshotId- the snapshot ID from the previous turn, or null if this is the first turnturnIndex- the zero-based index of this turn
-
-
Method Details
-
snapshotId
Returns the snapshot ID reserved for this turn.- Returns:
- the snapshot ID (empty string for client-managed mode)
-
parentSnapshotId
Returns the parent snapshot ID (ID of the previous turn's snapshot).- Returns:
- the parent snapshot ID, or null if this is the first turn
-
turnIndex
public int turnIndex()Returns the zero-based index of this turn.- Returns:
- the turn index
-