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

Resolved 💬 1 comment Opened Apr 20, 2026 by exeex Closed May 31, 2026

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" }
  ]
})

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗