No API to list or stop background tasks started via run_in_background
Resolved 💬 2 comments Opened Mar 18, 2026 by R-Mitsuno Closed Mar 18, 2026
Problem
When using the Bash tool with run_in_background: true, the agent has no way to:
- List currently running background tasks
- Stop a specific background task by ID
The TaskStop tool exists but only works if the agent already knows the task ID. There is no TaskListBackground or equivalent tool to discover running background tasks.
Reproduction
- Start a long-running process in the background:
```
Bash(command: "./scripts/dev.sh", run_in_background: true)
bdx9k9dkj`)
→ Returns task ID (e.g.,
- In a later conversation turn (or after context compression), the agent loses track of the task ID.
- The user asks: "Stop the background process and restart it."
- The agent has no way to discover the running background task.
TaskListonly returns the TODO-style task list, not background shell processes.
Current workaround
The user must manually use the CLI UI (↓ to manage) to stop background tasks, which defeats the purpose of autonomous agent operation.
Expected behavior
One of:
- A tool like
TaskListBackgroundthat returns all running background shell/agent tasks with their IDs, commands, and status - Or extend the existing
TaskListtool to include background processes - Or extend
TaskOutputto accept no arguments and return all background tasks
Environment
- Claude Code CLI
- macOS (Darwin 24.1.0)
- Observed with Bash
run_in_backgroundtasks
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗