OpenHands / OpenHands/software-agent-sdk
feat(delegate): Non-blocking background subagent execution
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 539
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 137
Description
Summary
_delegate_tasks() in openhands-tools/openhands/tools/delegate/impl.py uses thread.join() to block the parent agent until the sub-agent completes. This prevents the parent from doing other work while waiting for long-running sub-agent tasks.
Proposed Solution
Add a background flag to delegation that returns immediately with task IDs, plus commands for polling status, retrieving output, and stopping background agents.
Key Requirements
- Add
background: boolparameter to delegation - When
background=True, return immediately with a task ID - Implement
check_status(task_id)to poll sub-agent state - Implement
get_output(task_id)to retrieve results when complete - Implement
stop(task_id)to terminate a running background agent - Track background agents in a registry for the parent context
Key Files
openhands-tools/openhands/tools/delegate/impl.py—_delegate_tasks()withthread.join()
Acceptance Criteria
-
backgroundflag is supported in delegation - Parent agent is not blocked when
background=True - Task ID is returned for background agents
- Status polling, output retrieval, and stop commands work
- Multiple background agents can run concurrently
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in openhands-tools/openhands/tools/delegate/impl.py at _delegate_tasks() and its thread.join() behavior. Trace how delegation state and parent context are represented, then implement the background task lifecycle so task IDs, status, output retrieval, stopping, and concurrent agents satisfy every acceptance criterion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai-infra-agents, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100