Co-Authored-By: Quentin Torroba <quentin.torroba@mistral.ai>
Co-Authored-By: Michel Thomazo <michel.thomazo@mistral.ai>
Co-Authored-By: Clément Drouin <clement.drouin@mistral.ai>
Co-Authored-By: Vincent Guilloux <vincent.guilloux@mistral.ai>
Co-Authored-By: Clément Siriex <clement.sirieix@mistral.ai>
Co-Authored-By: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai>
Co-Authored-By: Thaddee Tyl <thaddee.tyl@gmail.com>
Co-Authored-By: David Brochart <david.brochart@gmail.com>
Co-Authored-By: Joseph Guhlin <joseph.guhlin@gmail.com>
Co-Authored-By: Thomas Kenbeek <thomaskenbeek@gmail.com>
Co-Authored-By: Remenby31 <baptiste.cruvellier31@gmail.com>
This commit is contained in:
Mathias Gesbert 2026-01-27 16:39:30 +01:00 committed by Mathias Gesbert
parent 79f215d91c
commit d33db9fff8
217 changed files with 16911 additions and 4305 deletions

78
tests/core/test_agents.py Normal file
View file

@ -0,0 +1,78 @@
from __future__ import annotations
import pytest
from vibe.core.agents.manager import AgentManager
from vibe.core.agents.models import BUILTIN_AGENTS, EXPLORE, AgentSafety, AgentType
from vibe.core.config import VibeConfig
class TestAgentProfile:
def test_explore_agent_is_subagent(self) -> None:
"""Test that EXPLORE agent has SUBAGENT type."""
assert EXPLORE.agent_type == AgentType.SUBAGENT
def test_explore_agent_has_safe_safety(self) -> None:
"""Test that EXPLORE agent has SAFE safety level."""
assert EXPLORE.safety == AgentSafety.SAFE
def test_explore_agent_has_enabled_tools(self) -> None:
"""Test that EXPLORE agent has expected enabled tools."""
enabled_tools = EXPLORE.overrides.get("enabled_tools", [])
assert "grep" in enabled_tools
assert "read_file" in enabled_tools
def test_builtin_agents_contains_explore(self) -> None:
"""Test that BUILTIN_AGENTS includes explore."""
assert "explore" in BUILTIN_AGENTS
assert BUILTIN_AGENTS["explore"] is EXPLORE
class TestAgentManager:
@pytest.fixture
def manager(self) -> AgentManager:
config = VibeConfig(include_project_context=False, include_prompt_detail=False)
return AgentManager(lambda: config)
def test_get_subagents_returns_only_subagents(self, manager: AgentManager) -> None:
"""Test that only SUBAGENT type agents are returned."""
subagents = manager.get_subagents()
for agent in subagents:
assert agent.agent_type == AgentType.SUBAGENT
def test_get_subagents_includes_explore(self, manager: AgentManager) -> None:
"""Test that EXPLORE is included in subagents."""
subagents = manager.get_subagents()
names = [a.name for a in subagents]
assert "explore" in names
def test_get_subagents_excludes_agents(self, manager: AgentManager) -> None:
"""Test that AGENT type agents are not returned."""
subagents = manager.get_subagents()
names = [a.name for a in subagents]
# These are AGENT type
assert "default" not in names
assert "plan" not in names
assert "auto-approve" not in names
def test_get_builtin_agent(self, manager: AgentManager) -> None:
"""Test getting a builtin agent by name."""
agent = manager.get_agent("explore")
assert agent is EXPLORE
assert agent.agent_type == AgentType.SUBAGENT
def test_get_nonexistent_agent_raises(self, manager: AgentManager) -> None:
"""Test that getting a nonexistent agent raises ValueError."""
with pytest.raises(ValueError, match="not found"):
manager.get_agent("nonexistent-agent")
def test_get_default_agent(self, manager: AgentManager) -> None:
"""Test getting the default agent."""
agent = manager.get_agent("default")
assert agent.name == "default"
assert agent.agent_type == AgentType.AGENT