Record Class AgentRequest
java.lang.Object
java.lang.Record
io.agentscope.extensions.agentprotocol.AgentRequest
- Record Components:
taskId- task identifier, also used as the agent session idagentId- requested agent id fromPOST /tasksinput- user input; empty on a resume run, which carries confirmation decisions insteaduserId- parsed fromcontext.user_idparentSessionId- parsed fromcontext.parent_session_idresume- whether this run resumes a task that was awaiting tool confirmationcontext- the submissioncontextmap exactly as received, including any custom keys
public record AgentRequest(String taskId, String agentId, String input, String userId, String parentSessionId, boolean resume, Map<String,Object> context)
extends Record
Everything an
AgentFactory needs to pick or build the agent for one task run.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionagentId()Returns the value of theagentIdrecord component.Caller-defined attributes fromcontext.attributes, or an empty map when the caller sent none.attributeString(String key) Returns thecontext.attributesvalue forkeyas a string, ornull.context()Returns the value of thecontextrecord component.contextString(String key) Returns thecontextvalue forkeyas a string, ornull.contextValue(String key) Returns the rawcontextvalue forkey, ornullwhen absent.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.input()Returns the value of theinputrecord component.Returns the value of theparentSessionIdrecord component.booleanresume()Returns the value of theresumerecord component.taskId()Returns the value of thetaskIdrecord component.final StringtoString()Returns a string representation of this record class.userId()Returns the value of theuserIdrecord component.
-
Constructor Details
-
AgentRequest
public AgentRequest(String taskId, String agentId, String input, String userId, String parentSessionId, boolean resume, Map<String, Object> context) Creates an instance of aAgentRequestrecord class.- Parameters:
taskId- the value for thetaskIdrecord componentagentId- the value for theagentIdrecord componentinput- the value for theinputrecord componentuserId- the value for theuserIdrecord componentparentSessionId- the value for theparentSessionIdrecord componentresume- the value for theresumerecord componentcontext- the value for thecontextrecord component
-
-
Method Details
-
contextValue
Returns the rawcontextvalue forkey, ornullwhen absent. -
contextString
Returns thecontextvalue forkeyas a string, ornull. -
attributes
Caller-defined attributes fromcontext.attributes, or an empty map when the caller sent none. These are the values propagated into the agent'sRuntimeContext; the surroundingcontext()also holds the protocol's own fields. -
attributeString
Returns thecontext.attributesvalue forkeyas a string, ornull. -
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 '=='. -
taskId
Returns the value of thetaskIdrecord component.- Returns:
- the value of the
taskIdrecord component
-
agentId
Returns the value of theagentIdrecord component.- Returns:
- the value of the
agentIdrecord component
-
input
Returns the value of theinputrecord component.- Returns:
- the value of the
inputrecord component
-
userId
Returns the value of theuserIdrecord component.- Returns:
- the value of the
userIdrecord component
-
parentSessionId
Returns the value of theparentSessionIdrecord component.- Returns:
- the value of the
parentSessionIdrecord component
-
resume
public boolean resume()Returns the value of theresumerecord component.- Returns:
- the value of the
resumerecord component
-
context
Returns the value of thecontextrecord component.- Returns:
- the value of the
contextrecord component
-