Class SessionCreateParams.InitialEvent
-
- All Implemented Interfaces:
public final class SessionCreateParams.InitialEventAn event sent to the
sessionimmediately after it is created. Supportsuser.messageanduser.define_outcome.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceSessionCreateParams.InitialEvent.VisitorAn interface that defines how to map each variant of InitialEvent to a value of type T.
public final classSessionCreateParams.InitialEvent.Type
-
Method Summary
Modifier and Type Method Description final Optional<BetaManagedAgentsUserMessageEventParams>userMessage()Parameters for sending a user message to the session. final Optional<BetaManagedAgentsUserDefineOutcomeEventParams>userDefineOutcome()Parameters for defining an outcome the agent should work toward. final Optional<JsonValue>_json()final SessionCreateParams.InitialEvent.Typetype()final BooleanisUserMessage()final BooleanisUserDefineOutcome()final BetaManagedAgentsUserMessageEventParamsasUserMessage()Parameters for sending a user message to the session. final BetaManagedAgentsUserDefineOutcomeEventParamsasUserDefineOutcome()Parameters for defining an outcome the agent should work toward. final <T extends Any> Taccept(SessionCreateParams.InitialEvent.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final SessionCreateParams.InitialEventvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static SessionCreateParams.InitialEventofUserMessage(BetaManagedAgentsUserMessageEventParams userMessage)Parameters for sending a user message to the session. final static SessionCreateParams.InitialEventofUserMessage(List<BetaManagedAgentsUserMessageEventParams.Content> content)Returns an immutable instance of InitialEvent whose ofUserMessage variant is built from the given required content. final static SessionCreateParams.InitialEventofUserDefineOutcome(BetaManagedAgentsUserDefineOutcomeEventParams userDefineOutcome)Parameters for defining an outcome the agent should work toward. -
-
Method Detail
-
userMessage
final Optional<BetaManagedAgentsUserMessageEventParams> userMessage()
Parameters for sending a user message to the session.
-
userDefineOutcome
final Optional<BetaManagedAgentsUserDefineOutcomeEventParams> userDefineOutcome()
Parameters for defining an outcome the agent should work toward. The agent begins work on receipt.
-
type
final SessionCreateParams.InitialEvent.Type type()
-
isUserMessage
final Boolean isUserMessage()
-
isUserDefineOutcome
final Boolean isUserDefineOutcome()
-
asUserMessage
final BetaManagedAgentsUserMessageEventParams asUserMessage()
Parameters for sending a user message to the session.
-
asUserDefineOutcome
final BetaManagedAgentsUserDefineOutcomeEventParams asUserDefineOutcome()
Parameters for defining an outcome the agent should work toward. The agent begins work on receipt.
-
accept
final <T extends Any> T accept(SessionCreateParams.InitialEvent.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 = initialEvent.accept(new InitialEvent.Visitor<Optional<String>>() { @Override public Optional<String> visitUserMessage(BetaManagedAgentsUserMessageEventParams userMessage) { return Optional.of(userMessage.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final SessionCreateParams.InitialEvent 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 SessionCreateParams.InitialEvent ofUserMessage(BetaManagedAgentsUserMessageEventParams userMessage)
Parameters for sending a user message to the session.
-
ofUserMessage
final static SessionCreateParams.InitialEvent ofUserMessage(List<BetaManagedAgentsUserMessageEventParams.Content> content)
Returns an immutable instance of InitialEvent whose ofUserMessage variant is built from the given required content.
-
ofUserDefineOutcome
final static SessionCreateParams.InitialEvent ofUserDefineOutcome(BetaManagedAgentsUserDefineOutcomeEventParams userDefineOutcome)
Parameters for defining an outcome the agent should work toward. The agent begins work on receipt.
-
-
-
-