1
0

test: update delegation tests for YAML-driven agent IDs

Old hardcoded IDs (seer, forge, echo, helm, quill) replaced with
YAML-defined IDs (orchestrator, researcher, coder, writer, memory,
experimenter). Added test that old names are explicitly rejected.
This commit is contained in:
Trip T
2026-03-14 08:40:24 -04:00
parent dc380860ba
commit 0e89caa830
7 changed files with 523 additions and 64 deletions

View File

@@ -6,8 +6,8 @@ BaseAgent provides:
- Memory integration
- Structured logging
SubAgent is the concrete implementation used for all persona-based agents
(replacing the individual Helm/Echo/Seer/Forge/Quill classes).
SubAgent is the single seed class for ALL agents. Differentiation
comes entirely from config (agents.yaml), not from Python subclasses.
"""
import logging
@@ -29,7 +29,7 @@ logger = logging.getLogger(__name__)
class BaseAgent(ABC):
"""Base class for all sub-agents."""
"""Base class for all agents."""
def __init__(
self,
@@ -38,36 +38,47 @@ class BaseAgent(ABC):
role: str,
system_prompt: str,
tools: list[str] | None = None,
model: str | None = None,
max_history: int = 10,
) -> None:
self.agent_id = agent_id
self.name = name
self.role = role
self.tools = tools or []
self.model = model or settings.ollama_model
self.max_history = max_history
# Create Agno agent
self.system_prompt = system_prompt
self.agent = self._create_agent(system_prompt)
# Event bus for communication
self.event_bus: EventBus | None = None
logger.info("%s agent initialized (id: %s)", name, agent_id)
logger.info(
"%s agent initialized (id: %s, model: %s)",
name,
agent_id,
self.model,
)
def _create_agent(self, system_prompt: str) -> Agent:
"""Create the underlying Agno agent."""
"""Create the underlying Agno agent with per-agent model."""
# Get tools from registry
tool_instances = []
for tool_name in self.tools:
handler = tool_registry.get_handler(tool_name)
if handler:
tool_instances.append(handler)
if tool_registry is not None:
for tool_name in self.tools:
handler = tool_registry.get_handler(tool_name)
if handler:
tool_instances.append(handler)
return Agent(
name=self.name,
model=Ollama(id=settings.ollama_model, host=settings.ollama_url, timeout=300),
model=Ollama(id=self.model, host=settings.ollama_url, timeout=300),
description=system_prompt,
tools=tool_instances if tool_instances else None,
add_history_to_context=True,
num_history_runs=10,
num_history_runs=self.max_history,
markdown=True,
telemetry=settings.telemetry_enabled,
)
@@ -134,16 +145,18 @@ class BaseAgent(ABC):
"agent_id": self.agent_id,
"name": self.name,
"role": self.role,
"model": self.model,
"status": "ready",
"tools": self.tools,
}
class SubAgent(BaseAgent):
"""Concrete agent configured by persona data (prompt + tools).
"""Concrete agent — the single seed class for all agents.
Replaces the individual agent classes (Helm, Echo, Seer, Forge, Quill)
which all shared the same structure and differed only by config.
Every agent in the system is an instance of SubAgent, differentiated
only by the config values passed in from agents.yaml. No subclassing
needed — add new agents by editing YAML, not Python.
"""
def __init__(
@@ -153,6 +166,8 @@ class SubAgent(BaseAgent):
role: str,
system_prompt: str,
tools: list[str] | None = None,
model: str | None = None,
max_history: int = 10,
) -> None:
super().__init__(
agent_id=agent_id,
@@ -160,6 +175,8 @@ class SubAgent(BaseAgent):
role=role,
system_prompt=system_prompt,
tools=tools,
model=model,
max_history=max_history,
)
async def execute_task(self, task_id: str, description: str, context: dict) -> Any: