Table of Contents
Fetching ...

AgentSpawn: Adaptive Multi-Agent Collaboration Through Dynamic Spawning for Long-Horizon Code Generation

Igor Costa

TL;DR

AgentSpawn introduces a runtime, memory-aware multi-agent architecture for long-horizon code generation. By enabling dynamic spawning triggered by runtime complexity metrics, automatic memory slicing, skilled inheritance, a Spawn-Resume protocol, and a coherence manager, it addresses memory continuity, skill transfer, resumption with context, and concurrent edits. Empirical results show a 34% improvement in task completion over static baselines and a 42% reduction in memory overhead due to selective memory transfer, with notable gains increasing on harder tasks. The work emphasizes metacognitive spawning decisions and scalable, conflict-free parallelism, offering a generalizable framework for adaptive collaboration in complex, long-horizon domains.

Abstract

Long-horizon code generation requires sustained context and adaptive expertise across domains. Current multi-agent systems use static workflows that cannot adapt when runtime analysis reveals unanticipated complexity. We propose AgentSpawn, an architecture enabling dynamic agent collaboration through: (1) automatic memory transfer during spawning, (2) adaptive spawning policies triggered by runtime complexity metrics, and (3) coherence protocols for concurrent modifications. AgentSpawn addresses five critical gaps in existing research around memory continuity, skill inheritance, task resumption, runtime spawning, and concurrent coherence. Experimental validation demonstrates AgentSpawn achieves 34% higher completion rates than static baselines on benchmarks like SWE-bench while reducing memory overhead by 42% through selective slicing.

AgentSpawn: Adaptive Multi-Agent Collaboration Through Dynamic Spawning for Long-Horizon Code Generation

TL;DR

AgentSpawn introduces a runtime, memory-aware multi-agent architecture for long-horizon code generation. By enabling dynamic spawning triggered by runtime complexity metrics, automatic memory slicing, skilled inheritance, a Spawn-Resume protocol, and a coherence manager, it addresses memory continuity, skill transfer, resumption with context, and concurrent edits. Empirical results show a 34% improvement in task completion over static baselines and a 42% reduction in memory overhead due to selective memory transfer, with notable gains increasing on harder tasks. The work emphasizes metacognitive spawning decisions and scalable, conflict-free parallelism, offering a generalizable framework for adaptive collaboration in complex, long-horizon domains.

Abstract

Long-horizon code generation requires sustained context and adaptive expertise across domains. Current multi-agent systems use static workflows that cannot adapt when runtime analysis reveals unanticipated complexity. We propose AgentSpawn, an architecture enabling dynamic agent collaboration through: (1) automatic memory transfer during spawning, (2) adaptive spawning policies triggered by runtime complexity metrics, and (3) coherence protocols for concurrent modifications. AgentSpawn addresses five critical gaps in existing research around memory continuity, skill inheritance, task resumption, runtime spawning, and concurrent coherence. Experimental validation demonstrates AgentSpawn achieves 34% higher completion rates than static baselines on benchmarks like SWE-bench while reducing memory overhead by 42% through selective slicing.
Paper Structure (43 sections, 6 equations, 4 figures, 6 tables, 3 algorithms)

This paper contains 43 sections, 6 equations, 4 figures, 6 tables, 3 algorithms.

Figures (4)

  • Figure 1: AgentSpawn architecture showing parent agent spawning specialized children based on runtime complexity detection, with automatic memory slicing and coherence management for concurrent spawns.
  • Figure 2: Memory slicing algorithm showing selection of relevant episodic, semantic, and working memory items. Irrelevant items (shown with gray pattern) are filtered, achieving 42% reduction (87K $\rightarrow$ 51K tokens) while maintaining task-relevant context.
  • Figure 3: Adaptive spawning policy showing five complexity metrics normalized and combined via weighted sum. When spawn score exceeds threshold ($\delta = 0.7$), child agent is spawned with specialization determined by dominant metric.
  • Figure 4: Memory coherence protocol for concurrent spawns. Four children execute independently on memory snapshots. Conflict detection identifies overlapping changes. Resolution strategies: automatic merge (15%), semantic merge via LLM (73%), or parent escalation (12%).