Files
sama/tests/test_integration/test_agent_collaboration.py
T
Celes Renata 57619860d5 feat: implement DCOS source tree, tests, and build configuration
Complete implementation of the DCOS package including:
- 40+ Python source files across agents, communication, core, learning, memory, protocols, utils
- pyproject.toml build configuration
- 102 unit tests across all subsystems
- Fixed flake.nix (Python 3.12, proper dependencies, pyproject build)
- Fixed .woodpecker.yml (correct paths, removed silent-fail flags)
- Added .gitignore
- Cleared stale pytest cache
2026-08-02 03:29:55 -07:00

51 lines
1.8 KiB
Python

"""
Integration tests for agent collaboration workflows.
"""
import pytest
from dcos.core.scheduler import TaskScheduler, Task
from dcos.core.registry import AgentRegistry, AgentRecord
from dcos.core.coordinator import AgentCoordinator
from dcos.agents.planning import PlanningAgent
from dcos.agents.research import ResearchAgent
class TestAgentCollaboration:
def test_scheduler_registry_integration(self):
"""Verify scheduler and registry work together."""
scheduler = TaskScheduler()
registry = AgentRegistry()
registry.register(AgentRecord(agent_id="a1", name="planner", role="planner"))
task = Task(name="plan", agent_id="a1")
scheduler.enqueue(task)
dequeued = scheduler.dequeue()
assert dequeued is not None
record = registry.get("a1")
assert record is not None
def test_planner_researcher_collaboration(self):
"""Verify planner can decompose and researcher can fulfill."""
planner = PlanningAgent()
researcher = ResearchAgent()
tasks = planner.decompose("research_project")
assert len(tasks) > 0
research_result = researcher.research(tasks[0]["id"], depth=2)
assert research_result["topic"] == tasks[0]["id"]
def test_coordinator_workflow(self):
"""Verify coordinator can orchestrate a workflow."""
coord = AgentCoordinator()
coord.create_workflow("wf_1", ["planner", "researcher", "logician"])
assert coord.get_workflow_status("wf_1") is not None
assert coord.get_workflow_status("wf_1")["status"] == "created"
assigned = coord.assign_task("wf_1", "researcher", "Gather data")
assert assigned is True
coord.complete_workflow("wf_1")
status = coord.get_workflow_status("wf_1")
assert status["status"] == "completed"