File size: 2,004 Bytes
1f3a244 | 1 2 3 4 5 | {"type": "session", "harness": "opencode", "id": "aiagent-0075", "name": "multi-agent"}
{"type": "message", "message": {"role": "system", "content": "You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies."}}
{"type": "message", "message": {"role": "user", "content": "How are multi-agent teams structured with researcher, coder, reviewer and coordinator roles? Compare hub-and-spoke, blackboard and pipeline communication. Include code examples."}}
{"type": "message", "message": {"role": "assistant", "content": "**Teams split roles; a coordinator routes work.**\n\n- **Hub-and-spoke:** coordinator delegates, agents reply to hub\n- **Blackboard:** shared dict all agents read/write\n- **Pipeline:** researcher -> coder -> reviewer chain\n- **Debate:** agents critique until consensus\n\n```python\nfrom dataclasses import dataclass, field\n\n@dataclass\nclass Task:\n kind: str\n text: str\n context: str = \"\"\n\n@dataclass\nclass Team:\n board: dict = field(default_factory=dict)\n\n def researcher(self, t: Task) -> str:\n return f\"notes on {t.text}\"\n\n def coder(self, t: Task) -> str:\n return f\"def solution(): return {t.context!r}\"\n\n def reviewer(self, code: str) -> str:\n return \"LGTM\" if \"def \" in code else \"needs work\"\n\n def run(self, goal: str) -> str:\n plan = [Task(\"research\", goal), Task(\"code\", goal)]\n notes = self.researcher(plan[0])\n self.board[\"notes\"] = notes\n code = self.coder(Task(\"code\", goal, context=notes))\n verdict = self.reviewer(code)\n self.board.update({\"code\": code, \"verdict\": verdict})\n return f\"{verdict}: {code}\"\n```"}}
|