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 id
agentId - requested agent id from POST /tasks
input - user input; empty on a resume run, which carries confirmation decisions instead
userId - parsed from context.user_id
parentSessionId - parsed from context.parent_session_id
resume - whether this run resumes a task that was awaiting tool confirmation
context - the submission context map 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 Details

    • AgentRequest

      public AgentRequest(String taskId, String agentId, String input, String userId, String parentSessionId, boolean resume, Map<String,Object> context)
      Creates an instance of a AgentRequest record class.
      Parameters:
      taskId - the value for the taskId record component
      agentId - the value for the agentId record component
      input - the value for the input record component
      userId - the value for the userId record component
      parentSessionId - the value for the parentSessionId record component
      resume - the value for the resume record component
      context - the value for the context record component
  • Method Details

    • contextValue

      public Object contextValue(String key)
      Returns the raw context value for key, or null when absent.
    • contextString

      public String contextString(String key)
      Returns the context value for key as a string, or null.
    • attributes

      public Map<String,Object> attributes()
      Caller-defined attributes from context.attributes, or an empty map when the caller sent none. These are the values propagated into the agent's RuntimeContext; the surrounding context() also holds the protocol's own fields.
    • attributeString

      public String attributeString(String key)
      Returns the context.attributes value for key as a string, or null.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • taskId

      public String taskId()
      Returns the value of the taskId record component.
      Returns:
      the value of the taskId record component
    • agentId

      public String agentId()
      Returns the value of the agentId record component.
      Returns:
      the value of the agentId record component
    • input

      public String input()
      Returns the value of the input record component.
      Returns:
      the value of the input record component
    • userId

      public String userId()
      Returns the value of the userId record component.
      Returns:
      the value of the userId record component
    • parentSessionId

      public String parentSessionId()
      Returns the value of the parentSessionId record component.
      Returns:
      the value of the parentSessionId record component
    • resume

      public boolean resume()
      Returns the value of the resume record component.
      Returns:
      the value of the resume record component
    • context

      public Map<String,Object> context()
      Returns the value of the context record component.
      Returns:
      the value of the context record component