AS AgentScopeAPI 手册 / API Reference

SubagentFactory

@FunctionalInterface public interface SubagentFactory
源码Source io/agentscope/harness/agent/subagent/SubagentFactory.java:36–48

定义子智能体工厂契约的接口。位于 io.agentscope.harness.agent.subagent 包。核心成员包括 create。

Creates a new subagent instance for a single spawn or session. Registered under an agent_id in DefaultAgentManager; each #create(RuntimeContext) call should return a fresh agent when isolation is required.

This type replaces a raw java.util.function.Supplier for subagent wiring so call sites and maps are self-documenting.

Phase B-0: Implementations should bake parentRc.getUserId() and parentRc.getSessionId() into the child agent's persisted SessionKey so that AgentState stays isolated per (user, parent-session) — regardless of which io.agentscope.core.state.AgentStateStore backend (Workspace / Redis / InMemory / custom) is configured. Both fields are nullable; when absent the child falls back to the legacy single bucket form keyed only by declaration name.

方法摘要Method Summary

方法Method说明Description
public Agent create(RuntimeContext parentRc)
创建并返回实例。
Builds a new subagent instance for the given parent runtime context.

方法详情Method Detail

create

public Agent create(RuntimeContext parentRc)

创建并返回实例。

Builds a new subagent instance for the given parent runtime context.

参数Parameters
名称Name类型Type说明Description
parentRcRuntimeContext父级 Rc(类型 `RuntimeContext`)。parent agent's runtime context at spawn time; may be `RuntimeContext#empty()` when caller has no scope
返回Returns Agent
返回智能体。Returns agent.
源码Source io/agentscope/harness/agent/subagent/SubagentFactory.java:47
基于官方固定版本源码静态生成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.