""" 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"