Back to Catalog
Agentic AI
Planning & Control Flow
Query-Decomposition Agent
An agent whose explicit job is to split an incoming user query into smaller independent sub-queries that can be answered sequentially or in parallel, then merge results.
Intent & Description
🎯 Intent
An agent whose explicit job is to split an incoming user query into smaller independent sub-queries that can be answered sequentially or in parallel, then merge results.
📋 Context
A user asks a multi-part question — “compare the privacy implications of these three vendors across GDPR, HIPAA, and SOC 2”. Answering it as one prompt produces a sprawling, low-quality response: the model interleaves vendor-axis facts with regulation-axis facts and misses combinations.
💡 Solution
- Front the workflow with a decomposer agent whose system prompt asks it to enumerate independent sub-queries that together answer the user’s question. - Run each sub-query (in parallel or sequence) through the answering agent, RAG retriever, or tool. - Pass the leaf answers to an aggregator that composes the final response. - The decomposition output is itself an inspectable artefact the user can challenge.
Real-world Use Case
- Questions are compositional (entity × dimension matrices, multi-source comparisons).
- Sub-queries are usefully independent.
- Latency budget allows parallel leaf execution.
Source
Advantages
- Multi-part questions get scaffolded answers with per-leaf depth.
- Leaf parallelism cuts latency on independent sub-queries.
- Decomposition output is an inspectable artefact users can challenge.
Disadvantages
- Mis-decomposition silently drops dimensions of the question.
- Over-decomposition fans out into too many leaves and balloons cost.
- Aggregation can lose nuance present in individual leaves.