AgentRequest
public record AgentRequest( String taskId, String agentId, String input, String userId, String parentSessionId, boolean resume, Map<String, Object> context)
io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86承载智能体请求数据的记录类型。位于 io.agentscope.extensions.agentprotocol 包。核心成员包括 taskId、agentId、input、userId、parentSessionId、resume。
Everything an AgentFactory needs to pick or build the agent for one task run.
记录组件摘要Record Component Summary
| 组件Component | 类型Type | 说明Description |
|---|---|---|
taskId | String | 执行任务标识相关操作。 task identifier, also used as the agent session id |
agentId | String | 执行智能体标识相关操作。 requested agent id from `POST /tasks` |
input | String | 执行输入相关操作。 user input; empty on a resume run, which carries confirmation decisions instead |
userId | String | 执行用户标识相关操作。 parsed from `context.user_id` |
parentSessionId | String | 执行父级会话标识相关操作。 parsed from `context.parent_session_id` |
resume | boolean | 执行恢复相关操作。 whether this run resumes a task that was awaiting tool confirmation |
context | Map<String, Object> | 执行上下文相关操作。 the submission `context` map exactly as received, including any custom keys |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public AgentRequest(String taskId, String agentId, String input, String userId, String parentSessionId, boolean resume, Map<String, Object> context) | 初始化 `AgentRequest` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Object contextValue(String key) | 设置上下文值。 Returns the raw `context` value for `key`, or `null` when absent. |
public String contextString(String key) | 设置该参数。 Returns the `context` value for `key` as a string, or `null`. |
public Map<String, Object> attributes() | 返回属性。 Caller-defined attributes from `context.attributes`, or an empty map when the caller
sent none. |
public String attributeString(String key) | 设置该参数。 Returns the `context.attributes` value for `key` as a string, or `null`. |
记录组件详情Record Component Detail
taskId
String taskId执行任务标识相关操作。
task identifier, also used as the agent session id
io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86agentId
String agentId执行智能体标识相关操作。
requested agent id from POST /tasks
io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86input
String input执行输入相关操作。
user input; empty on a resume run, which carries confirmation decisions instead
io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86userId
String userId执行用户标识相关操作。
parsed from context.user_id
io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86parentSessionId
String parentSessionId执行父级会话标识相关操作。
parsed from context.parent_session_id
io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86resume
boolean resume执行恢复相关操作。
whether this run resumes a task that was awaiting tool confirmation
io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86context
Map<String, Object> context执行上下文相关操作。
the submission context map exactly as received, including any custom keys
io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86构造器详情Constructor Detail
AgentRequest
public AgentRequest(String taskId, String agentId, String input, String userId, String parentSessionId, boolean resume, Map<String, Object> context)
初始化 AgentRequest 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
taskId | String | 任务标识(类型 `String`)。The task id. |
agentId | String | 智能体标识(类型 `String`)。The agent id. |
input | String | 输入消息(类型 `String`)。The input. |
userId | String | 用户标识(类型 `String`)。The user id. |
parentSessionId | String | 父级会话标识(类型 `String`)。The parent session id. |
resume | boolean | 恢复(类型 `boolean`)。The resume. |
context | Map<String, Object> | 上下文(类型 `Map`)。The context. |
io/agentscope/extensions/agentprotocol/AgentRequest.java:42–48方法详情Method Detail
contextValue
public Object contextValue(String key)
设置上下文值。
Returns the raw context value for key, or null when absent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | String | 键(类型 `String`)。The key. |
Objectio/agentscope/extensions/agentprotocol/AgentRequest.java:51–53contextString
public String contextString(String key)
设置该参数。
Returns the context value for key as a string, or null.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | String | 键(类型 `String`)。The key. |
Stringio/agentscope/extensions/agentprotocol/AgentRequest.java:56–59attributes
public Map<String, Object> attributes()
返回属性。
Caller-defined attributes from context.attributes, or an empty map when the caller sent none.
Map<String, Object>io/agentscope/extensions/agentprotocol/AgentRequest.java:67–79attributeString
public String attributeString(String key)
设置该参数。
Returns the context.attributes value for key as a string, or null.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | String | 键(类型 `String`)。The key. |
Stringio/agentscope/extensions/agentprotocol/AgentRequest.java:82–85