AS AgentScopeAPI 手册 / API Reference

SubagentRecord

public record SubagentRecord( String subagentId, String agentId, String sessionId, String userId, String parentSessionId, Instant createdAt, Instant expiresAt)
源码Source io/agentscope/harness/agent/gateway/SubagentRecord.java:41–108

承载子智能体记录数据的记录类型。位于 io.agentscope.harness.agent.gateway 包。核心成员包括 subagentId、agentId、sessionId、userId、parentSessionId、createdAt。

Durable, recovery-oriented descriptor of an exposed subagent. Unlike the in-memory ExposedSession (which holds a live Agent reference), a SubagentRecord stores only the recipe needed to re-materialize and route to the subagent on any node: its type (agentId), its own conversational session (sessionId), and lifecycle metadata.

The agentId feeds the agent factory to rebuild the instance; the sessionId is passed at invocation time so the rebuilt agent loads the correct conversation history from a (distributed) AgentStateStore.

记录组件摘要Record Component Summary

组件Component类型Type说明Description
subagentIdString
执行子智能体标识相关操作。
the user-visible handle for direct addressing
agentIdString
执行智能体标识相关操作。
the subagent type identifier (used to re-materialize the agent)
sessionIdString
执行会话标识相关操作。
the subagent's own session id (used to load its conversational state)
userIdString
执行用户标识相关操作。
the originating user id, or `null` when unknown
parentSessionIdString
执行父级会话标识相关操作。
the parent session that exposed this subagent, or `null`
createdAtInstant
执行已创建 At相关操作。
when the subagent was exposed
expiresAtInstant
执行过期 At相关操作。
optional expiry instant; `null` means no TTL

方法摘要Method Summary

方法Method说明Description
public boolean isExpired(Instant now)
判断是否已过期。
Whether this record has a TTL that has already elapsed relative to `now`.
public Map<String, Object> toMap()
返回到映射。
Serializes this record to a flat string/number map for `BaseStore` persistence.
public static SubagentRecord fromMap(Map<String, Object> m)
static
设置来自映射。
Reconstructs a record from a persisted map, tolerating missing optional fields.

记录组件详情Record Component Detail

subagentId

String subagentId

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

the user-visible handle for direct addressing

源码Source io/agentscope/harness/agent/gateway/SubagentRecord.java:41–108

agentId

String agentId

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

the subagent type identifier (used to re-materialize the agent)

源码Source io/agentscope/harness/agent/gateway/SubagentRecord.java:41–108

sessionId

String sessionId

执行会话标识相关操作。

the subagent's own session id (used to load its conversational state)

源码Source io/agentscope/harness/agent/gateway/SubagentRecord.java:41–108

userId

String userId

执行用户标识相关操作。

the originating user id, or null when unknown

源码Source io/agentscope/harness/agent/gateway/SubagentRecord.java:41–108

parentSessionId

String parentSessionId

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

the parent session that exposed this subagent, or null

源码Source io/agentscope/harness/agent/gateway/SubagentRecord.java:41–108

createdAt

Instant createdAt

执行已创建 At相关操作。

when the subagent was exposed

源码Source io/agentscope/harness/agent/gateway/SubagentRecord.java:41–108

expiresAt

Instant expiresAt

执行过期 At相关操作。

optional expiry instant; null means no TTL

源码Source io/agentscope/harness/agent/gateway/SubagentRecord.java:41–108

方法详情Method Detail

isExpired

public boolean isExpired(Instant now)

判断是否已过期。

Whether this record has a TTL that has already elapsed relative to now.

参数Parameters
名称Name类型Type说明Description
nowInstant当前时间(类型 `Instant`)。The now.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/gateway/SubagentRecord.java:51–53

toMap

public Map<String, Object> toMap()

返回到映射。

Serializes this record to a flat string/number map for BaseStore persistence.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/harness/agent/gateway/SubagentRecord.java:56–74

fromMap

public static SubagentRecord fromMap(Map<String, Object> m)
static

设置来自映射。

Reconstructs a record from a persisted map, tolerating missing optional fields.

参数Parameters
名称Name类型Type说明Description
mMap<String, Object>m(类型 `Map`)。The m.
返回Returns SubagentRecord
返回SubagentRecord。Returns subagent record.
源码Source io/agentscope/harness/agent/gateway/SubagentRecord.java:77–89
基于官方固定版本源码静态生成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.