Multi-agent-GitHub-PR-review-workflow
Multi-agent PR review workflow in n8n — a Lead Reviewer agent delegates to OWASP-grounded security and optimization specialist agents, then posts a merged…
An automated multi-agent code review system built with n8n, triggered by GitHub pull requests. A Lead Reviewer Agent delegates to specialist sub-agents (security, optimization) and posts a synthesized review straight back to the PR as a comment. 1. PR Webhook — GitHub trigger fires on every new/updated pull request 2. Get PR Diff — pulls the actual code diff for that PR via the GitHub API 3. Lead Reviewer Agent — the orchestrator.
Summary extracted from the README.
Multi-Agent GitHub PR Review Workflow
An automated multi-agent code review system built with n8n, triggered by GitHub pull requests. A Lead Reviewer Agent delegates to specialist sub-agents (security, optimization) and posts a synthesized review straight back to the PR as a comment.
![Executed workflow]
)
How it works
- PR Webhook — GitHub trigger fires on every new/updated pull request
- Get PR Diff — pulls the actual code diff for that PR via the GitHub API
- Lead Reviewer Agent — the orchestrator. Sends the full diff to two specialist tools and synthesizes their output:
- security_specialist — audits the diff against OWASP Top 10 categories, using a
owasp_policy_searchvector-store tool (RAG) to ground each finding in the actual OWASP policy text - optimization_specialist — reviews algorithmic complexity, performance, and code readability/maintainability
- security_specialist — audits the diff against OWASP Top 10 categories, using a
- Post PR Review Comment — the Lead Agent's combined markdown review (Summary, Security Findings, Optimization & Readability, Recommended Next Steps) is posted back to the PR automatically
Architecture

Stack
- n8n — workflow orchestration
- LangChain agent nodes (
@n8n/n8n-nodes-langchain) — multi-agent orchestration + tool delegation - OpenAI (GPT-5) — Lead, Security, and Optimization model backends
- OpenAI Embeddings + in-memory vector store — OWASP policy retrieval (RAG)
- GitHub API (OAuth2) — webhook trigger, diff retrieval, comment posting
Setup
- Import
workflow.jsoninto your n8n instance (Workflows → Import from File) - Add your GitHub OAuth2 credentials (needs repo + pull request scopes) and your OpenAI credentials
- Load your OWASP Top 10 reference text into the
owasp_policy_searchvector store (used as the security specialist's grounding knowledge base) - On your target GitHub repo: Settings → Webhooks → Add webhook, pointing at this workflow's production webhook URL, subscribed to Pull request events
- Open a PR — the agent team reviews it and comments automatically within seconds
Why I built this
A single LLM call reviewing a diff tends to either miss category-specific issues or hallucinate generic advice. Splitting the review into specialist agents — each with a narrow, well-defined mandate and its own grounding tool — produces more concrete, defensible findings than one generalist reviewer prompt.
License
MIT