Skip to content

refactor: consolidate SubagentTools.task into BackgroundTaskCapability #353

Description

@Million-mo

Problem

There are currently two separate task-like capabilities with overlapping functionality:

  1. SubagentTools.task (src/agentpool_toolsets/builtin/subagent_tools.py) — based on FunctionToolsetCapability, supports team execution (parallel/sequential), list_available_nodes discovery, runtime_registry, model_id propagation.
  2. BackgroundTaskCapability._task (src/agentpool/capabilities/background_task/capability.py) — based on AbstractCapability, supports background_output, background_cancel, steer_task, NotificationBatcher, SessionTaskState, after_node_run / get_model_settings lifecycle hooks, load_skills / expected_output / title params.

They cannot simply be merged into one because their base classes (FunctionToolsetCapability vs AbstractCapability) provide different capability boundaries.

Proposed Direction

The correct consolidation path is to port SubagentTools specific features into BackgroundTaskCapability, then retire SubagentTools:

  • Team execution support (parallel/sequential) — currently in SubagentTools._run_sync / _resolve_node_config
  • runtime_registry integration for agent config discovery
  • model_id propagation from agent config
  • list_available_nodes was already removed (PR feat(capabilities): add QuestionCapability and migrate BackgroundTaskCapability from xeno-agent #346) — agents list is now injected via system prompt
  • Replace SubagentToolsetConfig.get_provider() to return BackgroundTaskCapability instead
  • Deprecate SubagentTools / SubagentToolsetConfig type

Background

This was discussed in PR #345 (comment: #345 (comment)). Consensus was to keep them separate for the migration PR and address the consolidation as a follow-up (per analysis: #345 (comment)).

Out of Scope

  • BackgroundTaskCapability specific features (background_output, cancel, steer, notification, lifecycle hooks) — these are the reason AbstractCapability is the right base.
  • ToolDisplayCapability or other unrelated capabilities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions