|
| 1 | +--- |
| 2 | +title: "Part 6: Agentic AI Teams in Router Mode: Multilingual Routing with AGNO" |
| 3 | +date: 2025-07-21T10:04:38.579Z |
| 4 | +author: Dinesh R Singh |
| 5 | +authorimage: /img/dinesh-192-192.jpg |
| 6 | +disable: false |
| 7 | +--- |
| 8 | +<style> |
| 9 | +li { |
| 10 | + font-size: 27px; |
| 11 | + line-height: 33px; |
| 12 | + max-width: none; |
| 13 | +} |
| 14 | +</style> |
| 15 | + |
| 16 | +One of the most powerful capabilities in Agentic AI is orchestrating multiple agents to work together—each with its own specialization. In this segment, we explore the Router Mode pattern, a configuration where a central team detects context (like language or domain) and routes queries to the right agent accordingly. |
| 17 | + |
| 18 | +This method is especially effective in scenarios requiring multilingual or domain-specific support. Using the AGNO Framework, we’ll see how to construct a language-routing team that handles diverse user inputs with precision and fallback logic. |
| 19 | + |
| 20 | +[Inspired by my Medium post.](https://dineshr1493.medium.com/all-you-need-to-know-about-the-evolution-of-generative-ai-to-agentic-ai-part-6-agentic-ai-a-39714050857b) |
| 21 | + |
| 22 | +## Router Mode: What It Is ? |
| 23 | + |
| 24 | +In Router Mode, the team acts like a switchboard, rather than executing tasks itself. Its core responsibility is to: |
| 25 | + |
| 26 | +* Analyze user input |
| 27 | +* Detect the appropriate context (e.g., language) |
| 28 | +* Route the request to a specialized agent |
| 29 | +* Handle unsupported inputs gracefully |
| 30 | + |
| 31 | +<center><img src="/img/screenshot-2025-07-21-at-3.38.34 pm.png" width="600" height="550" alt="Route Mode" title="Route Mode"></center> |
| 32 | + |
| 33 | +### Use Case: Multilingual Chat Support |
| 34 | + |
| 35 | +Imagine a chatbot that receives queries in different languages. Router Mode enables: |
| 36 | + |
| 37 | +* Language detection |
| 38 | +* Delegation to language-specific agents (e.g., Japanese, French, German) |
| 39 | +* Fallback messages for unsupported languages |
| 40 | + |
| 41 | +### Implementation: AGNO Framework Setup |
| 42 | + |
| 43 | +We’ll define a set of language-specific agents and create a routing team that delegates accordingly. |
| 44 | + |
| 45 | +#### Step 1: Define Language Agents |
| 46 | + |
| 47 | +``` |
| 48 | +from agno.agent import Agent |
| 49 | +from agno.models.anthropic import Claude |
| 50 | +from agno.models.deepseek import DeepSeek |
| 51 | +from agno.models.mistral.mistral import MistralChat |
| 52 | +from agno.models.openai import OpenAIChat |
| 53 | +
|
| 54 | +english_agent = Agent( |
| 55 | + name="English Agent", |
| 56 | + role="You can only answer in English", |
| 57 | + model=OpenAIChat(id="gpt-4.5-preview"), |
| 58 | + instructions=["You must only respond in English"], |
| 59 | +) |
| 60 | +
|
| 61 | +japanese_agent = Agent( |
| 62 | + name="Japanese Agent", |
| 63 | + role="You can only answer in Japanese", |
| 64 | + model=DeepSeek(id="deepseek-chat"), |
| 65 | + instructions=["You must only respond in Japanese"], |
| 66 | +) |
| 67 | +
|
| 68 | +chinese_agent = Agent( |
| 69 | + name="Chinese Agent", |
| 70 | + role="You can only answer in Chinese", |
| 71 | + model=DeepSeek(id="deepseek-chat"), |
| 72 | + instructions=["You must only respond in Chinese"], |
| 73 | +) |
| 74 | +
|
| 75 | +spanish_agent = Agent( |
| 76 | + name="Spanish Agent", |
| 77 | + role="You can only answer in Spanish", |
| 78 | + model=OpenAIChat(id="gpt-4.5-preview"), |
| 79 | + instructions=["You must only respond in Spanish"], |
| 80 | +) |
| 81 | +
|
| 82 | +french_agent = Agent( |
| 83 | + name="French Agent", |
| 84 | + role="You can only answer in French", |
| 85 | + model=MistralChat(id="mistral-large-latest"), |
| 86 | + instructions=["You must only respond in French"], |
| 87 | +) |
| 88 | +
|
| 89 | +german_agent = Agent( |
| 90 | + name="German Agent", |
| 91 | + role="You can only answer in German", |
| 92 | + model=Claude("claude-3-5-sonnet-20241022"), |
| 93 | + instructions=["You must only respond in German"], |
| 94 | +) |
| 95 | + |
| 96 | +
|
| 97 | + |
| 98 | +
|
| 99 | +
|
| 100 | +``` |
| 101 | + |
| 102 | +### Step 2: Create the Router Team |
| 103 | + |
| 104 | +``` |
| 105 | +
|
| 106 | +from agno.team.team import Team |
| 107 | +
|
| 108 | +multi_language_team = Team( |
| 109 | + name="Multi Language Team", |
| 110 | + mode="route", |
| 111 | + model=OpenAIChat("gpt-4.5-preview"), |
| 112 | + members=[ |
| 113 | + english_agent, |
| 114 | + spanish_agent, |
| 115 | + japanese_agent, |
| 116 | + french_agent, |
| 117 | + german_agent, |
| 118 | + chinese_agent, |
| 119 | + ], |
| 120 | + show_tool_calls=True, |
| 121 | + markdown=True, |
| 122 | + show_members_responses=True, |
| 123 | + instructions=[ |
| 124 | + "You are a language router that directs questions to the appropriate language agent.", |
| 125 | + "If the user asks in a language whose agent is not a team member, respond in English with:", |
| 126 | + "'I can only answer in the following languages: English, Spanish, Japanese, French and German. Please ask your question in one of these languages.'", |
| 127 | + "Always check the language of the user's input before routing to an agent.", |
| 128 | + "For unsupported languages like Italian, respond in English with the above message.", |
| 129 | + ] |
| 130 | +) |
| 131 | +``` |
| 132 | + |
| 133 | +### Step 3: Run Multilingual Examples |
| 134 | + |
| 135 | +``` |
| 136 | +
|
| 137 | +
|
| 138 | +multi_language_team.print_response("How are you?", stream=True) # English |
| 139 | +multi_language_team.print_response("你好吗?", stream=True) # Chinese |
| 140 | +multi_language_team.print_response("お元気ですか?", stream=True) # Japanese |
| 141 | +multi_language_team.print_response("Comment allez-vous?", stream=True) # French |
| 142 | +
|
| 143 | +
|
| 144 | +``` |
| 145 | + |
| 146 | +### Output: |
| 147 | + |
| 148 | +``` |
| 149 | +[English Agent]: I'm doing great! How can I help you today? |
| 150 | +[Chinese Agent]: 我很好,谢谢你的关心。你呢? |
| 151 | +[Japanese Agent]: 元気です。あなたはお元気ですか? |
| 152 | +[French Agent]: Je vais bien, merci. Et vous ? |
| 153 | +``` |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | +<center><img src="/img/screenshot-2025-07-21-at-3.38.47 pm.png" width="600" height="550" alt="Agent Mode Parameters" title="Agent Mode Parameters"></center> |
| 158 | + |
| 159 | +## Key Parameters Explained |
| 160 | + |
| 161 | +## Why Router Mode Works |
| 162 | + |
| 163 | +* Context-awareness: Inputs are analyzed for language, not just keywords |
| 164 | +* Agent exclusivity: Each agent strictly operates in its assigned language |
| 165 | +* Fallback resilience: Unsupported queries are met with a clear, unified message |
| 166 | +* Modularity: Each language agent is replaceable or extendable |
| 167 | + |
| 168 | +## Conclusion |
| 169 | + |
| 170 | +Router Mode in Agentic AI introduces scalable intelligence by structuring agents like a multilingual team. Rather than overwhelming a single agent, you delegate responsibility across specialists and keep interactions clean, accurate, and context-driven. |
| 171 | + |
| 172 | +With the AGNO Framework, creating such intelligent, language-aware teams becomes seamless — and your agents become not just reactive, but well-organized and self-aware of their boundaries. |
| 173 | + |
| 174 | +A structured team, strict instructions, and intelligent routing — that’s the future of responsive AI, sir. |
0 commit comments