TaskRecord
@JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public class TaskRecord
io/agentscope/harness/agent/subagent/task/TaskRecord.java:37–278任务记录,支持智能体之间的发现、委派与协作。位于 io.agentscope.harness.agent.subagent.task 包。核心成员包括 getTaskId、setTaskId、getSubAgentId、setSubAgentId、getParentAgentId、setParentAgentId。
Persistent metadata for a background subagent task, stored as JSON in the workspace under
agents/<parentAgentId>/tasks/<parentSessionId>.json.
This is the authoritative truth source for task state. In-memory BackgroundTask
handles are a local performance overlay; TaskRecord survives across JVM restarts and
request migrations in distributed deployments.
All fields use Jackson for JSON serialization. Unknown fields are silently ignored to allow forward-compatible schema evolution.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public TaskRecord() | 初始化 `TaskRecord` 实例。 Creates a new instance. |
public TaskRecord(String taskId, String subAgentId, String parentAgentId, String parentSessionId, String subSessionId) | 初始化 `TaskRecord` 实例。 Creates a new instance. |
方法摘要Method Summary
构造器详情Constructor Detail
TaskRecord
public TaskRecord()
初始化 TaskRecord 实例。
Creates a new instance.
io/agentscope/harness/agent/subagent/task/TaskRecord.java:80TaskRecord
public TaskRecord(String taskId, String subAgentId, String parentAgentId, String parentSessionId, String subSessionId)
初始化 TaskRecord 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
taskId | String | 任务标识(类型 `String`)。The task id. |
subAgentId | String | 子智能体标识(类型 `String`)。The sub agent id. |
parentAgentId | String | 父级智能体标识(类型 `String`)。The parent agent id. |
parentSessionId | String | 父级会话标识(类型 `String`)。The parent session id. |
subSessionId | String | 子会话标识(类型 `String`)。The sub session id. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:82–99方法详情Method Detail
getTaskId
public String getTaskId()
获取任务标识。
Returns the task id.
Stringio/agentscope/harness/agent/subagent/task/TaskRecord.java:101–103setTaskId
public void setTaskId(String taskId)
设置任务标识。
Sets the task id.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
taskId | String | 任务标识(类型 `String`)。The task id. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:105–107getSubAgentId
public String getSubAgentId()
获取子智能体标识。
Returns the sub agent id.
Stringio/agentscope/harness/agent/subagent/task/TaskRecord.java:109–111setSubAgentId
public void setSubAgentId(String subAgentId)
设置子智能体标识。
Sets the sub agent id.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
subAgentId | String | 子智能体标识(类型 `String`)。The sub agent id. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:113–115getParentAgentId
public String getParentAgentId()
获取父级智能体标识。
Returns the parent agent id.
Stringio/agentscope/harness/agent/subagent/task/TaskRecord.java:117–119setParentAgentId
public void setParentAgentId(String parentAgentId)
设置父级智能体标识。
Sets the parent agent id.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
parentAgentId | String | 父级智能体标识(类型 `String`)。The parent agent id. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:121–123getParentSessionId
public String getParentSessionId()
获取父级会话标识。
Returns the parent session id.
Stringio/agentscope/harness/agent/subagent/task/TaskRecord.java:125–127setParentSessionId
public void setParentSessionId(String parentSessionId)
设置父级会话标识。
Sets the parent session id.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
parentSessionId | String | 父级会话标识(类型 `String`)。The parent session id. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:129–131getSubSessionId
public String getSubSessionId()
获取子会话标识。
Returns the sub session id.
Stringio/agentscope/harness/agent/subagent/task/TaskRecord.java:133–135setSubSessionId
public void setSubSessionId(String subSessionId)
设置子会话标识。
Sets the sub session id.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
subSessionId | String | 子会话标识(类型 `String`)。The sub session id. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:137–139getStatus
public TaskStatus getStatus()
获取状态。
Returns the status.
TaskStatusio/agentscope/harness/agent/subagent/task/TaskRecord.java:141–143setStatus
public void setStatus(TaskStatus status)
设置状态。
Sets the status.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
status | TaskStatus | 状态(类型 `TaskStatus`)。The status. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:145–147getResult
public String getResult()
获取结果。
Returns the result.
Stringio/agentscope/harness/agent/subagent/task/TaskRecord.java:149–151setResult
public void setResult(String result)
设置结果。
Sets the result.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
result | String | 结果(类型 `String`)。The result. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:153–155getErrorMessage
public String getErrorMessage()
获取错误消息。
Returns the error message.
Stringio/agentscope/harness/agent/subagent/task/TaskRecord.java:157–159setErrorMessage
public void setErrorMessage(String errorMessage)
设置错误消息。
Sets the error message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
errorMessage | String | 错误消息(类型 `String`)。The error message. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:161–163isCancelRequested
public boolean isCancelRequested()
判断是否 isCancelRequested。
Returns whether the cancel requested.
booleanio/agentscope/harness/agent/subagent/task/TaskRecord.java:165–167setCancelRequested
public void setCancelRequested(boolean cancelRequested)
设置 setCancelRequested。
Sets the cancel requested.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
cancelRequested | boolean | 取消 Requested(类型 `boolean`)。The cancel requested. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:169–171getCreatedAt
public Instant getCreatedAt()
获取已创建 At。
Returns the created at.
Instantio/agentscope/harness/agent/subagent/task/TaskRecord.java:173–175setCreatedAt
public void setCreatedAt(Instant createdAt)
设置已创建 At。
Sets the created at.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
createdAt | Instant | 已创建 At(类型 `Instant`)。The created at. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:177–179getLastCheckedAt
public Instant getLastCheckedAt()
获取 getLastCheckedAt。
Returns the last checked at.
Instantio/agentscope/harness/agent/subagent/task/TaskRecord.java:181–183setLastCheckedAt
public void setLastCheckedAt(Instant lastCheckedAt)
设置 setLastCheckedAt。
Sets the last checked at.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
lastCheckedAt | Instant | 最后 Checked At(类型 `Instant`)。The last checked at. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:185–187getLastUpdatedAt
public Instant getLastUpdatedAt()
获取最后已更新 At。
Returns the last updated at.
Instantio/agentscope/harness/agent/subagent/task/TaskRecord.java:189–191setLastUpdatedAt
public void setLastUpdatedAt(Instant lastUpdatedAt)
设置最后已更新 At。
Sets the last updated at.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
lastUpdatedAt | Instant | 最后已更新 At(类型 `Instant`)。The last updated at. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:193–195touch
public void touch()
执行 touch 方法。
Convenience: update lastUpdatedAt to now.
io/agentscope/harness/agent/subagent/task/TaskRecord.java:198–200touchChecked
public void touchChecked()
执行 touchChecked 方法。
Convenience: update lastCheckedAt to now.
io/agentscope/harness/agent/subagent/task/TaskRecord.java:203–205getDeliveredAt
public Instant getDeliveredAt()
获取 getDeliveredAt。
Returns the delivered at.
Instantio/agentscope/harness/agent/subagent/task/TaskRecord.java:207–209setDeliveredAt
public void setDeliveredAt(Instant deliveredAt)
设置 setDeliveredAt。
Sets the delivered at.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
deliveredAt | Instant | delivered At(类型 `Instant`)。The delivered at. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:211–213isDelivered
public boolean isDelivered()
判断是否 isDelivered。
Whether this task's completion has been pushed back to the parent agent.
booleanio/agentscope/harness/agent/subagent/task/TaskRecord.java:216–218getTransportType
public String getTransportType()
获取传输层类型。
Returns the transport type.
Stringio/agentscope/harness/agent/subagent/task/TaskRecord.java:220–222setTransportType
public void setTransportType(String transportType)
设置传输层类型。
Sets the transport type.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
transportType | String | 传输层类型(类型 `String`)。The transport type. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:224–226getRemoteBaseUrl
public String getRemoteBaseUrl()
获取远程基类 URL。
Returns the remote base url.
Stringio/agentscope/harness/agent/subagent/task/TaskRecord.java:228–230setRemoteBaseUrl
public void setRemoteBaseUrl(String remoteBaseUrl)
设置远程基类 URL。
Sets the remote base url.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
remoteBaseUrl | String | 远程基类 URL(类型 `String`)。The remote base url. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:232–234getRemoteHeaders
public Map<String, String> getRemoteHeaders()
获取远程请求头。
Returns the remote headers.
Map<String, String>io/agentscope/harness/agent/subagent/task/TaskRecord.java:236–238setRemoteHeaders
public void setRemoteHeaders(Map<String, String> remoteHeaders)
设置远程请求头。
Sets the remote headers.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
remoteHeaders | Map<String, String> | 远程请求头(类型 `Map`)。The remote headers. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:240–245isAgentProtocolTransport
public boolean isAgentProtocolTransport()
判断是否智能体协议传输层。
Whether this task is executed via the HTTP task protocol.
booleanio/agentscope/harness/agent/subagent/task/TaskRecord.java:248–250isAwaitingConfirm
public boolean isAwaitingConfirm()
判断是否等待中的确认。
Returns whether the awaiting confirm.
booleanio/agentscope/harness/agent/subagent/task/TaskRecord.java:252–254setAwaitingConfirm
public void setAwaitingConfirm(boolean awaitingConfirm)
设置等待中的确认。
Sets the awaiting confirm.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
awaitingConfirm | boolean | 等待中的确认(类型 `boolean`)。The awaiting confirm. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:256–258getPendingConfirms
public List<RemotePendingConfirm> getPendingConfirms()
获取 getPendingConfirms。
Returns the pending confirms.
List<RemotePendingConfirm>io/agentscope/harness/agent/subagent/task/TaskRecord.java:260–262setPendingConfirms
public void setPendingConfirms(List<RemotePendingConfirm> pendingConfirms)
设置 setPendingConfirms。
Sets the pending confirms.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
pendingConfirms | List<RemotePendingConfirm> | 待处理 Confirms(类型 `List`)。The pending confirms. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:264–269getLastEventSeq
public long getLastEventSeq()
获取 getLastEventSeq。
Returns the last event seq.
longio/agentscope/harness/agent/subagent/task/TaskRecord.java:271–273setLastEventSeq
public void setLastEventSeq(long lastEventSeq)
设置 setLastEventSeq。
Sets the last event seq.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
lastEventSeq | long | 最后事件 Seq(类型 `long`)。The last event seq. |
io/agentscope/harness/agent/subagent/task/TaskRecord.java:275–277