Skip to content

Feature request: batch-spawn forked subagents from a shared preloaded context #18683

Closed

Description

@exeex

Please add an API / runtime primitive for batch-spawning multiple forked subagents from one shared preloaded context.

Today, fork_context=true appears to fork from the current caller agent's context, which is useful, but it is still fundamentally a one-agent-at-a-time interface.

What seems to be missing is a higher-level primitive like:

  • preload one shared prompt/context once
  • fork N subagents immediately after that shared prefix
  • provide each fork with a small per-agent payload, such as an agent id, worker index, or task selector
  • let each subagent follow the same common instructions but branch by its own identity or assigned shard

Conceptually, this is closer to a SIMD / CUDA-thread style launch:

  • same code / same shared prompt prefix
  • different thread / worker ids
  • different target objects or shards

Why this would help

This would likely improve orchestration efficiency for multi-agent workloads:

  • better shared-prefix reuse
  • higher KV-cache hit rate
  • potentially better MoE expert reuse / routing locality
  • lower repeated prompt overhead
  • lower latency for fan-out workloads
  • cleaner programming model for planner-worker or tree-search patterns

Right now, if I want a whole group of subagents to share the same long setup prompt, I effectively need to recreate that launch pattern one agent at a time. That feels less efficient than a native batch-fork primitive.

Proposed interface shape

Not prescribing exact naming, but something in this family:

spawn_agents({
  shared_context: ...,
  forks: [
    { id: "worker-0", message: "task selector: 0" },
    { id: "worker-1", message: "task selector: 1" },
    { id: "worker-2", message: "task selector: 2" }
  ]
})

Activity

  1. added
    enhancementNew feature or request
    subagentIssues involving subagents or multi-agent features
    app-serverIssues involving app server protocol or interfaces
    and removed
    app-serverIssues involving app server protocol or interfaces
    on Apr 20, 2026
  2. etraut-openai commented on May 31, 2026

    @etraut-openai
    Contributor

    This feature request hasn't received enough upvotes, so I'm closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsubagentIssues involving subagents or multi-agent features

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions