Decomposing Composite Intents: Designing Intent Routing and Task Planning Mechanisms
Real users never ask in single intents. "My order has been sitting for five days, where is it — can I get a refund?" hides three things in one sentence: logistics lookup, anomaly judgment, and refund policy inquiry. If intent routing catches only one, the answer will be irrelevant; if it catches all three but cannot orchestrate execution order, the system queries the refund policy before the order status and gets the dependency backwards.
This is the fifth post in an experience-sharing series for AI customer service product managers and developers, drawn from hands-on practice as an AI product manager at a Southeast Asian cross-border e-commerce platform. In this post I want to share an intent routing and task planning design for when a single user question involves product rules, order status, and after-sales policy at once — deciding which tools to call, in what order, and when to end the task and return results.

Three Key Points in Intent Routing and Task Planning
- Task decomposition and orchestration for composite intents: splitting one sentence into multiple subtasks and untangling their dependencies.
- Handling tool-call dependencies: serial vs. parallel execution and passing forward outputs is the core of orchestration correctness.
- Termination conditions and result aggregation: when to stop, when to ask, when to hand off — preventing the system from running on in its own world.
The Overall Design
1. Intent routing: classify first, then decompose
The first layer uses a lightweight model or classifier to decide whether the utterance carries a single or composite intent. "Why can't my order xx be refunded yet" involves both order lookup and refund rules — a classic composite.
A composite intent is decomposed into a subtask DAG (directed acyclic graph) that makes dependencies explicit: order status is a prerequisite input for refund eligibility, so it must run first. Once decomposition is right, execution order follows naturally.
2. Planning and orchestration: templates plus dynamic planning
I would use a two-level scheme:
- Frequent combinations become fixed orchestration templates — high-volume paths like "query order → check refund eligibility" run on templates for stability and low latency;
- Unseen combinations are planned dynamically by the LLM based on tool descriptions, so the long tail is still covered.
Execution supports parallelism: independent subtasks (check product rules + check logistics) run in parallel to cut response time; dependent ones run serially, with earlier results passed as later parameters.
After each step, validate the result's validity and decide whether to retry, switch paths, or terminate — not every failure deserves a retry.
3. Termination: three exits to keep the system from running away
- Normal completion: all required subtasks finished with results ready → aggregate the structured returns from each tool and generate the final answer;
- Missing information: key details unclear (e.g., no order number) → pause and clarify with the user rather than guessing;
- Fallback termination: max execution steps exceeded or consecutive tool failures → terminate and hand off to a human, preventing infinite loops and runaway cost.
When aggregating, require the model to answer only from the structured results returned by tools — fabricating unreturned data is forbidden. That is the final anti-hallucination gate.
How This Maps to Weiyu
The Weiyu open-source customer service system (GitHub: https://github.com/bytedesk/bytedesk , website: https://www.weiyuai.cn ) ships the building blocks for this mechanism: the AI Agent supports tool calling, so order and logistics interfaces can be registered as tools invoked on demand; in multi-turn dialogue the AI can proactively ask clarifying questions; when a task cannot be completed or the user's frustration rises, it hands off smoothly to human agents in skill groups, carrying over the context already collected; conversation QA and statistics reports help review "which composite questions were not resolved in one pass," informing which orchestration templates to codify next. Fixed high-frequency paths can also be served deterministically via FAQ and fixed-flow capabilities.
Key Takeaways
- Decompose composite intents into a subtask DAG first; dependencies dictate execution order — that is the root of orchestration correctness.
- Two-level planning: templates for frequent combos, LLM dynamic planning for the long tail.
- Parallel when independent, serial when dependent — the balance point of latency and correctness.
- Three termination exits: aggregate on completion, clarify on missing info, bail out on limits — all three are mandatory.
- Aggregate answers only from tool-returned facts; the model must never invent unreturned data.
