Package akka.javasdk.agent
Record Class SessionMessage.ToolCallResponse
- Record Components:
sanitized- true when the message holds the tool result that the runtime sent to the model, with the configured sanitizers applied. The runtime sends such a message to the model as it is. For a message with false, the runtime masks the text with the current sanitizers before it sends it. Leave it false in a message that you build.isError- true when the MCP server reported the result as an error, or when the runtime turned a failed tool call into an error result for the model. The runtime passes the flag to the model provider. Not all model providers send the flag to the model.
- All Implemented Interfaces:
SessionMessage
- Enclosing interface:
SessionMessage
public static record SessionMessage.ToolCallResponse(Instant timestamp, String componentId, String id, String name, String text, boolean sanitized, boolean isError)
extends Record
implements SessionMessage
The text result of a tool call, fed back to the model as input.
-
Nested Class Summary
Nested classes/interfaces inherited from interface akka.javasdk.agent.SessionMessage
SessionMessage.AiMessage, SessionMessage.MessageContent, SessionMessage.MultimodalToolCallResponse, SessionMessage.MultimodalUserMessage, SessionMessage.TokenUsage, SessionMessage.ToolCallRequest, SessionMessage.ToolCallResponse, SessionMessage.UserMessage -
Constructor Summary
ConstructorsConstructorDescriptionToolCallResponse(Instant timestamp, String componentId, String id, String name, String text, boolean sanitized) ToolCallResponse(Instant timestamp, String componentId, String id, String name, String text, boolean sanitized, boolean isError) Creates an instance of aToolCallResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecomponentIdrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.booleanisError()Returns the value of theisErrorrecord component.name()Returns the value of thenamerecord component.booleanReturns the value of thesanitizedrecord component.intsize()The approximate size of this message in bytes, used to enforce memory size limits.text()Returns the value of thetextrecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.A copy of this response with another text.
-
Constructor Details
-
ToolCallResponse
-
ToolCallResponse
-
ToolCallResponse
public ToolCallResponse(Instant timestamp, String componentId, String id, String name, String text, boolean sanitized, boolean isError) Creates an instance of aToolCallResponserecord class.- Parameters:
timestamp- the value for thetimestamprecord componentcomponentId- the value for thecomponentIdrecord componentid- the value for theidrecord componentname- the value for thenamerecord componenttext- the value for thetextrecord componentsanitized- the value for thesanitizedrecord componentisError- the value for theisErrorrecord component
-
-
Method Details
-
withText
A copy of this response with another text. The copy keepsisErrorand hassanitizedfalse, because it no longer holds the text that the runtime sent to the model. -
size
public int size()Description copied from interface:SessionMessageThe approximate size of this message in bytes, used to enforce memory size limits.- Specified by:
sizein interfaceSessionMessage
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-
componentId
Returns the value of thecomponentIdrecord component.- Specified by:
componentIdin interfaceSessionMessage- Returns:
- the value of the
componentIdrecord component
-
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
text
Returns the value of thetextrecord component.- Returns:
- the value of the
textrecord component
-
sanitized
public boolean sanitized()Returns the value of thesanitizedrecord component.- Returns:
- the value of the
sanitizedrecord component
-
isError
public boolean isError()Returns the value of theisErrorrecord component.- Returns:
- the value of the
isErrorrecord component
-