Use sessions_spawn for Background Work
2 min read
Some tasks don't need your attention while they run. Fire and forget — get a ping when it's done.
That's sessions_spawn. It creates an independent background session with its own context that doesn't block your main agent.
When to Use It
- Research — "Read this repo and summarize the architecture"
- Code generation — "Build a demo site from this spec"
- Long-running work — Anything taking more than a few minutes
- Parallel tasks — Multiple independent jobs at once
My most common pattern: "Clone this repo, study it, build something with it." Three phases, real time needed. I don't want to babysit each step.
Structure Your Tasks Well
Sub-agents can't ask clarifying questions mid-task. Front-load the details.
✅ Good:
"Clone the remotion repo, read their docs,
create a 30-second promo video. Use copy from
marketing/copy.md. Save to videos/promo-v1.mp4."❌ Bad:
"Look into video stuff and see what you think."Be specific: what to produce, where to save it, what resources to use.
Handling Results
When the sub-agent finishes, your main agent gets the summary automatically. Review the work, then kick off another sub-agent for the next phase.
I chain multi-phase projects: spawn for research → review → spawn for implementation → review. Each handoff is a checkpoint to course-correct.
The Mindset Shift
Instead of "I need to do X," it becomes "I need to describe X well enough that someone else can do it."
That's delegation. And delegation scales. Start with your next research task — you'll never go back.