OpenHands / OpenHands/software-agent-sdk

feat(delegate): Non-blocking background subagent execution

Open
#2,047 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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: bool parameter 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() with thread.join()

Acceptance Criteria

  • background flag 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.