[FEATURE] Agent tool: add resume_session parameter to respawn terminated agents
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When spawning teammate agents via the Agent tool, there's no way to resume a previously terminated agent's session. The CLI supports claude --resume <session-id>and session JSONL files persist on disk, but the Agent tool doesn't expose this.
Use case: dev agent pushes a PR, gets terminated to save RAM, CI reports regressions 15 min later. Currently the only option is spawning a fresh agent that has to re-read all context. With resume_session, the new agent would pick up exactly where the old one left off.
Proposed Solution
Add a resume_session parameter to the Agent tool that passes through
to claude --resume <session-id>:
Agent(
name: "dev-929",
resume_session: "fb6dc0e5-5d6c-44c1-96e9-6c71a10ffde3",
prompt: "CI found 246 regressions on your PR. Fix them."
)
The agent would load the terminated session's full conversation
context, then process the new prompt as a continuation. The session ID
could be captured from the Agent tool's return value when first
spawning:
result = Agent(name: "dev-929", ...)
# result.session_id = "fb6dc0e5-..."
# Save for later resume
````
### Alternative Solutions
- Keep agents idle instead of terminating (wastes ~350MB RAM per agent)
- Write context summaries to files before shutdown, pass to new agent (lossy, manual)
- Use SendMessage to wake idle agents (works but can't resume terminated ones)
### Priority
High - Significant impact on productivity
### Feature Category
API and model interactions
### Use Case Example
1. Team lead spawns a teammate to implement a feature
2. teammate works for 30 min, pushes branch, opens PR, goes idle
3. Team lead shuts down teammate to free RAM for other agents
4. 15 min later, CI reports 246 test regressions on the PR
5. Team lead wants to resume the teammate with full context of what it tried
6. Currently: spawn fresh agent, re-read all files, lose debugging context
7. With resume_session: agent picks up exactly where it left off
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗