Class AgentResponse<S>
- Type Parameters:
S- the type of custom session state
AgentChat.send(java.lang.String) returns for one completed turn.
It surfaces the assistant Message and convenience views derived from it (text,
tool-request parts, interrupts) alongside the turn's identifiers, custom state, artifacts, finish
reason, and the raw AgentOutput.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the turn's artifacts.custom()Returns the custom session state after the turn.Returns the turn's finish reason.Returns the interrupts for this turn.message()Returns the assistant message produced by the turn.raw()Returns the underlying raw agent output.Returns the session ID.Returns the snapshot ID produced by the turn (server-managed agents).state()Returns the full session state at the end of the turn.text()Returns the concatenated text of the assistant message's text parts.Returns the tool-request parts of the assistant message.
-
Method Details
-
message
Returns the assistant message produced by the turn.- Returns:
- the message, or
nullif the turn produced none
-
text
Returns the concatenated text of the assistant message's text parts.- Returns:
- the text (empty string if there is no message / no text parts)
-
toolRequests
Returns the tool-request parts of the assistant message.- Returns:
- an unmodifiable list of tool-request parts (possibly empty)
-
interrupts
Returns the interrupts for this turn.Best-effort: when the turn finished with
AgentFinishReason.INTERRUPTED, every tool-request part of the assistant message is reported as an interrupt. The wirePartdoes not currently carry an explicit interrupt flag, so all pending tool requests are treated as interrupts. When the turn did not finish interrupted, this returns an empty list.- Returns:
- an unmodifiable list of interrupts (possibly empty)
-
finishReason
Returns the turn's finish reason.- Returns:
- the finish reason, or
null
-
snapshotId
Returns the snapshot ID produced by the turn (server-managed agents).- Returns:
- the snapshot ID, or
null
-
sessionId
Returns the session ID.- Returns:
- the session ID, or
null
-
custom
Returns the custom session state after the turn.- Returns:
- the custom state, or
null
-
state
Returns the full session state at the end of the turn.For client-managed agents this is the inline state echoed by the agent. For server-managed agents the agent does not echo full state inline, so this returns
null; usesnapshotId()withAgentChat/getSnapshotDatato read server-side state.- Returns:
- the session state, or
null
-
artifacts
Returns the turn's artifacts.- Returns:
- an unmodifiable list of artifacts (possibly empty)
-
raw
Returns the underlying raw agent output.- Returns:
- the raw output
-