
Decision Gates
Using LLMs to make routing decisions.
Decision Gates
Hardcoded if/else logic (checking keywords) is brittle.
The power of AI is using an LLM as a "Decision Gate".
The Router Node
Create a tiny node whose only job is to classify the intent.
Prompt: "You are a router. The user said: {input}. Respond with either 'SALES' or 'SUPPORT'."
This node doesn't answer the user. It just outputs a classification token. The Conditional Edge then reads this token to route the graph.
graph TD
Input --> RouterLLM
RouterLLM -- "SALES" --> SalesAgent
RouterLLM -- "SUPPORT" --> SupportAgent