Skip to content

⚙️ FEATURE: Sub-agent peer review — route written code to a verification sub-agent #42

Description

@FernandoCelmer

Problem

pycodeloop's DelegateTool spawns sub-agents for task delegation, but there is no built-in pattern for peer review: after a coder sub-agent writes code, a second read-only sub-agent verifies it (review, security check, test coverage analysis).

"Code as Agent Harness" (arXiv 2605.18747) identifies multi-agent peer review via shared code artifacts as a key scaling pattern for reliable long-horizon agent execution.

Expected behavior

from pycodeloop import CodeLoop, PeerReviewWorkflow

result = await PeerReviewWorkflow(
    coder=CodeLoop(config=coder_config),
    reviewer=CodeLoop(config=reviewer_config),  # read-only tools
).run("Implement JWT authentication")
# reviewer output appended to session trace

Or via built-in Config:

Config(peer_review=True, reviewer_system_prompt="You are a security reviewer...")

Suggested implementation

  • Add PeerReviewWorkflow class in pycodeloop/workflows/peer_review.py
  • Coder agent runs first with full tool access
  • After coder finishes, collect list of files written from JSONL trace
  • Reviewer agent receives those files as context (read-only tools) + reviewer system prompt
  • Reviewer output stored as {"type": "peer_review", "findings": [...]} in JSONL trace
  • If reviewer finds blocking issues, feed back to coder for a fix cycle

References

  • "Code as Agent Harness" — arXiv 2605.18747, Section 5 (Multi-agent peer review)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions