Loading lesson…
Courses›Subagents with depth guards

Subagents with depth guards

DetailedOverviewQuizFlashcard

Subagents with depth guards

Trace-detective lab (Module 9, L9.2): a planner with no depth discipline spawns eight agents seven levels deep, each inheriting the transcript above it, and the bill arrives before the task does -- 8 agents, 7 levels, 278,000 tokens and $4.17 for a finding knowable at depth 1, with 97.5 percent of the bill spent below it. Read the expanded case file and name three faults by line: the first spawn past the guard at line 5, the orphan a9 that was never waited on or closed, and the resume after close at line 16. Then install the five-operation lifecycle (spawn, send, wait, resume, close) with a depth guard at 3 that refuses the depth-4 spawn by naming the parent chain a1 -> a2 -> a3 -> a4, refuses 88.0 percent of the tokens, and hands each child a 10-word brief instead of a 17,100-token transcript (1710x distillation). Widening to 4 siblings at depth 1 is 12,000 tokens cheaper and answers 4x as many questions. In-memory only; scripted agents, no threads, model or provider call.

This Harness Engineering lesson is part of a paid plan. Sign in with a plan that includes this course to read it.