AS AgentScopeAPI 手册 / API Reference

AgentRequest

public record AgentRequest( String taskId, String agentId, String input, String userId, String parentSessionId, boolean resume, Map<String, Object> context)
源码Source 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
taskIdString
执行任务标识相关操作。
task identifier, also used as the agent session id
agentIdString
执行智能体标识相关操作。
requested agent id from `POST /tasks`
inputString
执行输入相关操作。
user input; empty on a resume run, which carries confirmation decisions instead
userIdString
执行用户标识相关操作。
parsed from `context.user_id`
parentSessionIdString
执行父级会话标识相关操作。
parsed from `context.parent_session_id`
resumeboolean
执行恢复相关操作。
whether this run resumes a task that was awaiting tool confirmation
contextMap<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

源码Source io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86

agentId

String agentId

执行智能体标识相关操作。

requested agent id from POST /tasks

源码Source io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86

input

String input

执行输入相关操作。

user input; empty on a resume run, which carries confirmation decisions instead

源码Source io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86

userId

String userId

执行用户标识相关操作。

parsed from context.user_id

源码Source io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86

parentSessionId

String parentSessionId

执行父级会话标识相关操作。

parsed from context.parent_session_id

源码Source io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86

resume

boolean resume

执行恢复相关操作。

whether this run resumes a task that was awaiting tool confirmation

源码Source io/agentscope/extensions/agentprotocol/AgentRequest.java:33–86

context

Map<String, Object> context

执行上下文相关操作。

the submission context map exactly as received, including any custom keys

源码Source 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.

参数Parameters
名称Name类型Type说明Description
taskIdString任务标识(类型 `String`)。The task id.
agentIdString智能体标识(类型 `String`)。The agent id.
inputString输入消息(类型 `String`)。The input.
userIdString用户标识(类型 `String`)。The user id.
parentSessionIdString父级会话标识(类型 `String`)。The parent session id.
resumeboolean恢复(类型 `boolean`)。The resume.
contextMap<String, Object>上下文(类型 `Map`)。The context.
源码Source 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.

参数Parameters
名称Name类型Type说明Description
keyString键(类型 `String`)。The key.
返回Returns Object
返回对象。Returns object.
源码Source io/agentscope/extensions/agentprotocol/AgentRequest.java:51–53

contextString

public String contextString(String key)

设置该参数。

Returns the context value for key as a string, or null.

参数Parameters
名称Name类型Type说明Description
keyString键(类型 `String`)。The key.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/agentprotocol/AgentRequest.java:56–59

attributes

public Map<String, Object> attributes()

返回属性。

Caller-defined attributes from context.attributes, or an empty map when the caller sent none.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/extensions/agentprotocol/AgentRequest.java:67–79

attributeString

public String attributeString(String key)

设置该参数。

Returns the context.attributes value for key as a string, or null.

参数Parameters
名称Name类型Type说明Description
keyString键(类型 `String`)。The key.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/agentprotocol/AgentRequest.java:82–85
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.