tinycodinglm / agentic /aiagent-0075.jsonl
winapiadmin's picture
Upload folder using huggingface_hub
1f3a244 verified
|
Raw History Blame
2 kB
opencode trace
System 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 c...

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.

User

How are multi-agent teams structured with researcher, coder, reviewer and coordinator roles? Compare hub-and-spoke, blackboard and pipeline communication. Include code examples.

Assistant

Teams split roles; a coordinator routes work.

  • Hub-and-spoke: coordinator delegates, agents reply to hub
  • Blackboard: shared dict all agents read/write
  • Pipeline: researcher -> coder -> reviewer chain
  • Debate: agents critique until consensus
python
from dataclasses import dataclass, field

@dataclass
class Task:
    kind: str
    text: str
    context: str = ""

@dataclass
class Team:
    board: dict = field(default_factory=dict)

    def researcher(self, t: Task) -> str:
        return f"notes on {t.text}"

    def coder(self, t: Task) -> str:
        return f"def solution(): return {t.context!r}"

    def reviewer(self, code: str) -> str:
        return "LGTM" if "def " in code else "needs work"

    def run(self, goal: str) -> str:
        plan = [Task("research", goal), Task("code", goal)]
        notes = self.researcher(plan[0])
        self.board["notes"] = notes
        code = self.coder(Task("code", goal, context=notes))
        verdict = self.reviewer(code)
        self.board.update({"code": code, "verdict": verdict})
        return f"{verdict}: {code}"