Interface SubagentFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
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 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
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
Modifier and TypeMethodDescriptionio.agentscope.core.agent.Agentcreate(io.agentscope.core.agent.RuntimeContext parentRc) Builds a new subagent instance for the given parent runtime context.
-
Method Details
-
create
io.agentscope.core.agent.Agent create(io.agentscope.core.agent.RuntimeContext parentRc) Builds a new subagent instance for the given parent runtime context. Implementations are responsible for translatingparentRcinto appropriate state-isolation hints (e.g. a parent-awareSessionKey); see the type-level javadoc.- Parameters:
parentRc- parent agent's runtime context at spawn time; may beRuntimeContext.empty()when caller has no scope
-