Replies: 5 comments 5 replies
|
@GSword We have considered to support subagents in sdk-level. However, the issue is that how to expose the hitl events from the sub agents within a unified streaming |
|
One design point that decides whether subagents actually save context, from running this pattern daily. The saving comes from the subagent's transcript being a separate context. That holds only if what it returns is small. A subagent that reads 40 files and returns a 3,000-token report has moved the cost, not removed it, because the parent re-sends that report on every later step of its own turn. Cost per token is size times the number of steps remaining after it arrives, so a long return early in a parent turn is the most expensive shape there is. So the API for a subagent needs a return budget as a first-class parameter. The subagent writes the full detail to a file or a store, and returns a short summary plus the path. The parent reads the detail only at the step that needs it, if at all. On HITL routing, the same boundary helps. An approval request from inside a subagent should surface to the human through the parent with the summary, not the transcript, for the same reason. I maintain a reference architecture that documents this exact pattern: https://github.com/jimy-r/agent-workspace-architecture/blob/main/PATTERNS.md#18-position-is-price--a-token-costs-more-the-earlier-you-add-it |
|
jimy-r’s point about the 3,000-token report is the crux here. If the subagent dumps a big transcript back, you have not bought anything, you just moved where the tokens get burned. The missing primitive is an artifact store. Subagent writes its full output to a shared store, returns a handle plus a one-paragraph summary, parent dereferences the handle only when it actually needs the detail. That turns the return boundary into reference-passing instead of value-passing, and the savings stop depending on prompt discipline. The return contract has to be declared when you define the subagent, though. Shape of the artifact, token budget for the summary, what gets persisted. If the framework enforces that contract structurally, it works even when the subagent misbehaves or the task drifts. Relying on the model to keep its summary tight is exactly how you end up with parents re-reading 3,000-token reports every step. We hit the same wall building something adjacent, and the enforced contract is what made it stick. Without it, the abstraction leaks and you are back to prompt engineering the size of the return value. |
|
@GSword @RICARDO51167 We've merged SDK-level subagent support through The leader can delegate tasks to member agents running in their own contexts and receive their final replies as tool results, addressing @GSword's context-isolation use case. Following the separation @RICARDO51167 suggested, the pipeline handles orchestration and HITL routing without extending the tool protocol to carry arbitrary agent events. Callers can observe both leader and member events through a unified To keep the interface and usage consistent with regular tool calls, delegation is currently blocking from the leader's perspective: it waits for the assigned members to finish before continuing. Different members can still run concurrently within the same round. Thanks for the ideas here! Please give |
|
Your ask to support subagents on the Agent class so a main agent can manage context and scale complex tasks is exactly the handoff lane I care about. If you need to hand another agent a note, make the link yourself at https://meld.mergeinc.workers.dev. Say what it's for. They have 36 hours to answer. Each reply keeps that same link open for another 24 hours. It's free. |
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
The current Agent class (from agentscope.agent) does not natively support subagents. In real-world scenarios, a main agent often needs to delegate heavy reading and filtering of large volumes of data to specialized subagents. Without this capability, all the raw data and intermediate results must be processed within the main agent's context, which quickly pollutes the context window, increases token costs, and degrades performance.
Describe the solution you'd like
I propose adding a native subagent mechanism similar to the DeepAgents framework. For example, we could have a factory function or a constructor that accepts a list of subagent definitions, like:
The main agent should be able to:
All reactions