Class BetaManagedAgentsSendSessionEvents.Data
-
- All Implemented Interfaces:
public final class BetaManagedAgentsSendSessionEvents.DataUnion type for events that can be sent to a session.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaManagedAgentsSendSessionEvents.Data.VisitorAn interface that defines how to map each variant of Data to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<BetaManagedAgentsUserMessageEvent>userMessage()A user message event in the session conversation. final Optional<BetaManagedAgentsUserInterruptEvent>userInterrupt()An interrupt event that pauses agent execution and returns control to the user. final Optional<BetaManagedAgentsUserToolConfirmationEvent>userToolConfirmation()A tool confirmation event that approves or denies a pending tool execution. final Optional<BetaManagedAgentsUserCustomToolResultEvent>userCustomToolResult()Event sent by the client providing the result of a custom tool execution. final Optional<BetaManagedAgentsUserDefineOutcomeEvent>userDefineOutcome()Echo of a user.define_outcomeinput event.final Optional<BetaManagedAgentsUserToolResultEvent>userToolResult()Event sent by the client providing the result of an agent-toolset tool execution. final Optional<BetaManagedAgentsSystemMessageEvent>systemMessage()A mid-conversation system message event. final BooleanisUserMessage()final BooleanisUserInterrupt()final BooleanisUserToolConfirmation()final BooleanisUserCustomToolResult()final BooleanisUserDefineOutcome()final BooleanisUserToolResult()final BooleanisSystemMessage()final BetaManagedAgentsUserMessageEventasUserMessage()A user message event in the session conversation. final BetaManagedAgentsUserInterruptEventasUserInterrupt()An interrupt event that pauses agent execution and returns control to the user. final BetaManagedAgentsUserToolConfirmationEventasUserToolConfirmation()A tool confirmation event that approves or denies a pending tool execution. final BetaManagedAgentsUserCustomToolResultEventasUserCustomToolResult()Event sent by the client providing the result of a custom tool execution. final BetaManagedAgentsUserDefineOutcomeEventasUserDefineOutcome()Echo of a user.define_outcomeinput event.final BetaManagedAgentsUserToolResultEventasUserToolResult()Event sent by the client providing the result of an agent-toolset tool execution. final BetaManagedAgentsSystemMessageEventasSystemMessage()A mid-conversation system message event. final Optional<JsonValue>_json()final <T extends Any> Taccept(BetaManagedAgentsSendSessionEvents.Data.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaManagedAgentsSendSessionEvents.Datavalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaManagedAgentsSendSessionEvents.DataofUserMessage(BetaManagedAgentsUserMessageEvent userMessage)A user message event in the session conversation. final static BetaManagedAgentsSendSessionEvents.DataofUserInterrupt(BetaManagedAgentsUserInterruptEvent userInterrupt)An interrupt event that pauses agent execution and returns control to the user. final static BetaManagedAgentsSendSessionEvents.DataofUserToolConfirmation(BetaManagedAgentsUserToolConfirmationEvent userToolConfirmation)A tool confirmation event that approves or denies a pending tool execution. final static BetaManagedAgentsSendSessionEvents.DataofUserCustomToolResult(BetaManagedAgentsUserCustomToolResultEvent userCustomToolResult)Event sent by the client providing the result of a custom tool execution. final static BetaManagedAgentsSendSessionEvents.DataofUserDefineOutcome(BetaManagedAgentsUserDefineOutcomeEvent userDefineOutcome)Echo of a user.define_outcomeinput event.final static BetaManagedAgentsSendSessionEvents.DataofUserToolResult(BetaManagedAgentsUserToolResultEvent userToolResult)Event sent by the client providing the result of an agent-toolset tool execution. final static BetaManagedAgentsSendSessionEvents.DataofSystemMessage(BetaManagedAgentsSystemMessageEvent systemMessage)A mid-conversation system message event. -
-
Method Detail
-
userMessage
final Optional<BetaManagedAgentsUserMessageEvent> userMessage()
A user message event in the session conversation.
-
userInterrupt
final Optional<BetaManagedAgentsUserInterruptEvent> userInterrupt()
An interrupt event that pauses agent execution and returns control to the user.
-
userToolConfirmation
final Optional<BetaManagedAgentsUserToolConfirmationEvent> userToolConfirmation()
A tool confirmation event that approves or denies a pending tool execution.
-
userCustomToolResult
final Optional<BetaManagedAgentsUserCustomToolResultEvent> userCustomToolResult()
Event sent by the client providing the result of a custom tool execution.
-
userDefineOutcome
final Optional<BetaManagedAgentsUserDefineOutcomeEvent> userDefineOutcome()
Echo of a
user.define_outcomeinput event. Carries the server-generatedoutcome_idthat subsequentspan.outcome_evaluation_*events reference.
-
userToolResult
final Optional<BetaManagedAgentsUserToolResultEvent> userToolResult()
Event sent by the client providing the result of an agent-toolset tool execution. Only valid on
self_hostedenvironments, where sandbox-routed tools are executed by the client rather than the server.
-
systemMessage
final Optional<BetaManagedAgentsSystemMessageEvent> systemMessage()
A mid-conversation system message event. Carries system-role content that is appended to the session as a
role: "system"turn.
-
isUserMessage
final Boolean isUserMessage()
-
isUserInterrupt
final Boolean isUserInterrupt()
-
isUserToolConfirmation
final Boolean isUserToolConfirmation()
-
isUserCustomToolResult
final Boolean isUserCustomToolResult()
-
isUserDefineOutcome
final Boolean isUserDefineOutcome()
-
isUserToolResult
final Boolean isUserToolResult()
-
isSystemMessage
final Boolean isSystemMessage()
-
asUserMessage
final BetaManagedAgentsUserMessageEvent asUserMessage()
A user message event in the session conversation.
-
asUserInterrupt
final BetaManagedAgentsUserInterruptEvent asUserInterrupt()
An interrupt event that pauses agent execution and returns control to the user.
-
asUserToolConfirmation
final BetaManagedAgentsUserToolConfirmationEvent asUserToolConfirmation()
A tool confirmation event that approves or denies a pending tool execution.
-
asUserCustomToolResult
final BetaManagedAgentsUserCustomToolResultEvent asUserCustomToolResult()
Event sent by the client providing the result of a custom tool execution.
-
asUserDefineOutcome
final BetaManagedAgentsUserDefineOutcomeEvent asUserDefineOutcome()
Echo of a
user.define_outcomeinput event. Carries the server-generatedoutcome_idthat subsequentspan.outcome_evaluation_*events reference.
-
asUserToolResult
final BetaManagedAgentsUserToolResultEvent asUserToolResult()
Event sent by the client providing the result of an agent-toolset tool execution. Only valid on
self_hostedenvironments, where sandbox-routed tools are executed by the client rather than the server.
-
asSystemMessage
final BetaManagedAgentsSystemMessageEvent asSystemMessage()
A mid-conversation system message event. Carries system-role content that is appended to the session as a
role: "system"turn.
-
accept
final <T extends Any> T accept(BetaManagedAgentsSendSessionEvents.Data.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.anthropic.core.JsonValue; import java.util.Optional; Optional<String> result = data.accept(new Data.Visitor<Optional<String>>() { @Override public Optional<String> visitUserMessage(BetaManagedAgentsUserMessageEvent userMessage) { return Optional.of(userMessage.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaManagedAgentsSendSessionEvents.Data validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofUserMessage
final static BetaManagedAgentsSendSessionEvents.Data ofUserMessage(BetaManagedAgentsUserMessageEvent userMessage)
A user message event in the session conversation.
-
ofUserInterrupt
final static BetaManagedAgentsSendSessionEvents.Data ofUserInterrupt(BetaManagedAgentsUserInterruptEvent userInterrupt)
An interrupt event that pauses agent execution and returns control to the user.
-
ofUserToolConfirmation
final static BetaManagedAgentsSendSessionEvents.Data ofUserToolConfirmation(BetaManagedAgentsUserToolConfirmationEvent userToolConfirmation)
A tool confirmation event that approves or denies a pending tool execution.
-
ofUserCustomToolResult
final static BetaManagedAgentsSendSessionEvents.Data ofUserCustomToolResult(BetaManagedAgentsUserCustomToolResultEvent userCustomToolResult)
Event sent by the client providing the result of a custom tool execution.
-
ofUserDefineOutcome
final static BetaManagedAgentsSendSessionEvents.Data ofUserDefineOutcome(BetaManagedAgentsUserDefineOutcomeEvent userDefineOutcome)
Echo of a
user.define_outcomeinput event. Carries the server-generatedoutcome_idthat subsequentspan.outcome_evaluation_*events reference.
-
ofUserToolResult
final static BetaManagedAgentsSendSessionEvents.Data ofUserToolResult(BetaManagedAgentsUserToolResultEvent userToolResult)
Event sent by the client providing the result of an agent-toolset tool execution. Only valid on
self_hostedenvironments, where sandbox-routed tools are executed by the client rather than the server.
-
ofSystemMessage
final static BetaManagedAgentsSendSessionEvents.Data ofSystemMessage(BetaManagedAgentsSystemMessageEvent systemMessage)
A mid-conversation system message event. Carries system-role content that is appended to the session as a
role: "system"turn.
-
-
-
-