Feature Request: Parallel SubAgent Execution for Agent-type Applications in v1.16
- Dominant language
- TypeScript
- Stars
- 156k
- Forks
- 24.6k
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 610
Description
### Self Checks
- [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542).
- [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] Please do not modify this template :) and fill in all the required fields.
### 1. Is this request related to a challenge you're experiencing? Tell me about your story.
**Current Pain Point:**
In Dify's current Agent-type applications, task execution is strictly sequential. When an Agent needs to handle a complex task that can be decomposed into multiple independent subtasks (e.g., querying different data sources simultaneously, performing parallel analysis on different aspects of a problem), it must execute them one by one. This leads to:
1. **High latency**: Users wait for each subtask to complete before the next one starts, even when subtasks have no dependencies on each other.
2. **Poor resource utilization**: LLM calls and tool invocations sit idle while waiting for sequential completion.
3. **Inability to model real-world teamwork**: In reality, complex tasks are often delegated to multiple specialists working in parallel. The current Agent architecture cannot represent this pattern natively.
**Proposed Feature:**
Add the ability for an Agent-type application (specifically targeting v1.16) to **assign SubAgents for parallel execution**. The main Agent should be able to:
1. **Decompose a task** into multiple independent subtasks based on LLM reasoning.
2. **Dispatch subtasks to SubAgents in parallel** — each SubAgent can have its own persona, tool permissions, and instructions.
3. **Aggregate results** — once all (or a configurable subset of) SubAgents complete, the main Agent receives their outputs and synthesizes a final response.
This is fundamentally different from the existing Workflow parallel branches, because:
- It operates within the **Agent** application type (conversational, autonomous reasoning), not a pre-defined DAG.
- The parallelism is **dynamic** — the Agent decides at runtime how many SubAgents to spawn and what tasks to assign, rather than following a static graph.
- Each SubAgent maintains its own **reasoning loop** with independent tool access.
### 2. Additional context or comments
**Use Case Examples:**
- **Customer support triage**: Main Agent receives a complex customer issue → spawns SubAgent-A to check order status, SubAgent-B to query knowledge base, SubAgent-C to check account history → aggregates findings into a comprehensive response. Total latency ≈ max(A, B, C) instead of A + B + C.
- **Research & analysis**: Main Agent is asked to compare three competing products → spawns three SubAgents each researching one product in parallel → merges results into a comparison table.
- **Multi-source data retrieval**: Main Agent needs data from CRM, ticketing system, and monitoring dashboard → parallel SubAgents fetch from each source simultaneously.
**Relationship to existing issues:**
- #37259 (Native Multi-Agent Dispatcher) focuses on skill registry and auto-routing but does not address dynamic parallel SubAgent spawning within an Agent's reasoning loop.
- #39331 (closed) mentioned multi-agent collaboration broadly but was too wide in scope.
**Suggested API/UX considerations:**
- A new "SubAgent" configuration panel in the Agent editor where users can pre-define available SubAgents (each with its own system prompt, tool set, and model).
- The main Agent's tool list includes a built-in `dispatch_subagents` tool that accepts a list of subtask descriptions and SubAgent assignments, returning aggregated results.
- Configurable concurrency limit and timeout per SubAgent invocation.
- Streaming support: partial results from completed SubAgents surface to the user while others are still running.
### 3. Can you help us with this feature?
- [x] I am interested in contributing to this feature.
Contributor guide
Research direction
Start by reviewing the existing Agent execution model and Workflow parallel branches described in the issue, then compare how Agent tools, SubAgent configuration, and result streaming would fit together. Done should include an agreed design for dynamic dispatch, concurrency and timeout controls, aggregation, and the Agent editor experience.
Written by the indexing model from the issue text.
Assessment
- Domain
- ai, backend-api-design, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100