Spaces:
Sleeping
Sleeping
| """Tests for agent routing via route_agents function.""" | |
| from agents.agent_flow import route_agents | |
| class TestRouteAgents: | |
| def test_route_design_keywords(self): | |
| agents = route_agents("I want a sleek design with smooth shape", [], False) | |
| assert "design" in agents | |
| def test_route_engineering_keywords(self): | |
| agents = route_agents("Use M6 bolts with 3mm wall thickness in aluminum", [], False) | |
| assert "engineering" in agents | |
| def test_route_cnc_keywords(self): | |
| agents = route_agents("Can this be machined on a 3-axis CNC mill?", [], False) | |
| assert "cnc" in agents | |
| def test_route_default_when_no_match(self): | |
| agents = route_agents("hello there", [], False) | |
| assert agents == ["design", "engineering"] | |
| def test_route_max_three_agents(self): | |
| # Keyword-scored agents are capped at max_active_agents (3), but the | |
| # CAD trigger can append "cad" beyond that cap. | |
| agents = route_agents("design shape in aluminum for CNC machining, generate preview", [], False) | |
| non_cad = [a for a in agents if a != "cad"] | |
| assert len(non_cad) <= 3 | |
| def test_has_cad_trigger_true(self): | |
| agents = route_agents("Generate a preview", [], False) | |
| assert "cad" in agents | |
| def test_has_cad_trigger_false(self): | |
| agents = route_agents("hello there", [], False) | |
| assert "cad" not in agents | |