Skip to content

Commit 97a85de

Browse files
refactor: Rename MultiModelAgent to RouterAgent for better clarity
- Renamed MultiModelAgent class to RouterAgent throughout codebase - Updated multi_model_agent.py -> router_agent.py - Updated all imports, exports, and references in: - src/praisonai-agents/praisonaiagents/agent/__init__.py - examples/python/agents/multi-provider-agent.py - examples/python/agents/MULTI_PROVIDER_README.md - src/praisonai-agents/test_multi_provider.py - RouterAgent better reflects the primary purpose of intelligent model routing - Maintains all existing functionality and backward compatibility Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
1 parent e5ee0c7 commit 97a85de

5 files changed

Lines changed: 29 additions & 29 deletions

File tree

examples/python/agents/MULTI_PROVIDER_README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ pip install praisonaiagents
3939

4040
```python
4141
from praisonaiagents import Task, PraisonAIAgents
42-
from praisonaiagents.agent import MultiModelAgent
42+
from praisonaiagents.agent import RouterAgent
4343

4444
# Create a multi-model agent
45-
agent = MultiModelAgent(
45+
agent = RouterAgent(
4646
name="Smart Assistant",
4747
role="Adaptive AI Assistant",
4848
goal="Complete tasks using the most appropriate model",
@@ -84,7 +84,7 @@ router = ModelRouter(
8484
)
8585

8686
# Create cost-conscious agent
87-
analyzer = MultiModelAgent(
87+
analyzer = RouterAgent(
8888
name="Budget Analyzer",
8989
role="Data Analyst",
9090
goal="Analyze data efficiently",
@@ -203,7 +203,7 @@ auto = AutoAgents(
203203

204204
# Convert to multi-model agents
205205
for i, agent in enumerate(auto.agents):
206-
auto.agents[i] = MultiModelAgent(
206+
auto.agents[i] = RouterAgent(
207207
name=agent.name,
208208
role=agent.role,
209209
goal=agent.goal,

examples/python/agents/multi-provider-agent.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
import os
99
from praisonaiagents import Agent, Task, PraisonAIAgents
10-
from praisonaiagents.agent import MultiModelAgent
10+
from praisonaiagents.agent import RouterAgent
1111
from praisonaiagents.llm.model_router import ModelRouter, ModelProfile, TaskComplexity
1212

1313
# Example 1: Simple Multi-Model Agent with Auto-Routing
1414
def example_auto_routing():
1515
"""Example of automatic model routing based on task complexity"""
1616
print("\n=== Example 1: Auto-Routing Multi-Model Agent ===\n")
1717

18-
# Create a multi-model agent that automatically selects models
19-
research_agent = MultiModelAgent(
18+
# Create a router agent that automatically selects models
19+
research_agent = RouterAgent(
2020
name="Smart Researcher",
2121
role="Adaptive Research Assistant",
2222
goal="Research topics using the most appropriate AI model",
@@ -75,7 +75,7 @@ def example_cost_optimized_workflow():
7575
)
7676

7777
# Create specialized agents with different model strategies
78-
analyzer = MultiModelAgent(
78+
analyzer = RouterAgent(
7979
name="Cost-Conscious Analyzer",
8080
role="Data Analyzer",
8181
goal="Analyze data efficiently while minimizing costs",
@@ -89,7 +89,7 @@ def example_cost_optimized_workflow():
8989
verbose=True
9090
)
9191

92-
writer = MultiModelAgent(
92+
writer = RouterAgent(
9393
name="Quality Writer",
9494
role="Content Writer",
9595
goal="Create high-quality content",
@@ -152,7 +152,7 @@ def example_auto_agents_multi_provider():
152152
multi_model_agents = []
153153
for agent in auto_agents.agents:
154154
# Convert regular agents to multi-model agents
155-
multi_agent = MultiModelAgent(
155+
multi_agent = RouterAgent(
156156
name=agent.name,
157157
role=agent.role,
158158
goal=agent.goal,
@@ -220,7 +220,7 @@ def search_web(query: str) -> str:
220220
return f"Search results for: {query}"
221221

222222
# Create specialized agent
223-
coder = MultiModelAgent(
223+
coder = RouterAgent(
224224
name="Adaptive Coder",
225225
role="Software Developer",
226226
goal="Write and debug code using the best model for each task",

src/praisonai-agents/praisonaiagents/agent/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
from .agent import Agent
33
from .image_agent import ImageAgent
44
from .handoff import Handoff, handoff, handoff_filters, RECOMMENDED_PROMPT_PREFIX, prompt_with_handoff_instructions
5-
from .multi_model_agent import MultiModelAgent
5+
from .router_agent import RouterAgent
66

7-
__all__ = ['Agent', 'ImageAgent', 'Handoff', 'handoff', 'handoff_filters', 'RECOMMENDED_PROMPT_PREFIX', 'prompt_with_handoff_instructions', 'MultiModelAgent']
7+
__all__ = ['Agent', 'ImageAgent', 'Handoff', 'handoff', 'handoff_filters', 'RECOMMENDED_PROMPT_PREFIX', 'prompt_with_handoff_instructions', 'RouterAgent']

src/praisonai-agents/praisonaiagents/agent/multi_model_agent.py renamed to src/praisonai-agents/praisonaiagents/agent/router_agent.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Multi-Model Agent that can use different LLM models based on task requirements.
2+
Router Agent that can use different LLM models based on task requirements.
33
44
This module extends the base Agent class to support multiple models and intelligent
55
model selection based on task characteristics.
@@ -15,7 +15,7 @@
1515
logger = logging.getLogger(__name__)
1616

1717

18-
class MultiModelAgent(Agent):
18+
class RouterAgent(Agent):
1919
"""
2020
An enhanced agent that can dynamically select and use different LLM models
2121
based on task requirements, optimizing for cost and performance.
@@ -31,7 +31,7 @@ def __init__(
3131
**kwargs
3232
):
3333
"""
34-
Initialize a MultiModelAgent.
34+
Initialize a RouterAgent.
3535
3636
Args:
3737
models: List of model names or dict mapping model names to configurations
@@ -284,7 +284,7 @@ def execute(
284284
context_size=context_size
285285
)
286286

287-
logger.info(f"MultiModelAgent '{self.name}' selected model: {selected_model} for task")
287+
logger.info(f"RouterAgent '{self.name}' selected model: {selected_model} for task")
288288

289289
# Execute with the selected model
290290
return self._execute_with_model(

src/praisonai-agents/test_multi_provider.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
99

1010
from praisonaiagents import Agent, Task, PraisonAIAgents
11-
from praisonaiagents.agent import MultiModelAgent
11+
from praisonaiagents.agent import RouterAgent
1212
from praisonaiagents.llm import ModelRouter, TaskComplexity
1313

1414
def test_model_router():
@@ -49,12 +49,12 @@ def test_model_router():
4949
print("\n✓ ModelRouter tests completed")
5050

5151

52-
def test_multi_model_agent():
53-
"""Test the MultiModelAgent functionality"""
54-
print("\n=== Testing MultiModelAgent ===\n")
52+
def test_router_agent():
53+
"""Test the RouterAgent functionality"""
54+
print("\n=== Testing RouterAgent ===\n")
5555

56-
# Create a multi-model agent
57-
agent = MultiModelAgent(
56+
# Create a router agent
57+
agent = RouterAgent(
5858
name="Test Agent",
5959
role="Test Assistant",
6060
goal="Test multi-model functionality",
@@ -74,15 +74,15 @@ def test_multi_model_agent():
7474
)
7575
print(f"Selected model for simple task: {selected}")
7676

77-
print("\nMultiModelAgent tests completed")
77+
print("\nRouterAgent tests completed")
7878

7979

8080
def test_integration():
8181
"""Test integration with PraisonAIAgents"""
8282
print("\n=== Testing Integration ===\n")
8383

84-
# Create a simple multi-model agent
85-
agent = MultiModelAgent(
84+
# Create a simple router agent
85+
agent = RouterAgent(
8686
name="Integration Test Agent",
8787
role="Tester",
8888
goal="Test the integration",
@@ -107,7 +107,7 @@ def test_integration():
107107
verbose=False
108108
)
109109

110-
print("Created PraisonAIAgents with MultiModelAgent")
110+
print("Created PraisonAIAgents with RouterAgent")
111111
print("✓ Integration test setup completed")
112112

113113
# Note: Actual execution would require API keys
@@ -119,14 +119,14 @@ def main():
119119

120120
try:
121121
test_model_router()
122-
test_multi_model_agent()
122+
test_router_agent()
123123
test_integration()
124124

125125
print("\n✅ All tests completed successfully!")
126126
print("\n📝 Summary:")
127127
print("- ModelRouter can analyze task complexity")
128128
print("- ModelRouter can select appropriate models")
129-
print("- MultiModelAgent can be created and configured")
129+
print("- RouterAgent can be created and configured")
130130
print("- Integration with PraisonAIAgents works")
131131
print("\n🎉 Multi-provider support is ready to use!")
132132

0 commit comments

Comments
 (0)