Pasting code into ChatGPT is slow, doesn't scale, breaks on large diffs, and isn't repeatable. You can't run it in CI, you can't audit the output, and you can't integrate it with your PR workflow.
Call a code review agent via API and get back structured JSON — score, issues, suggestions — that you can act on programmatically.
# Get the diff
DIFF=$(git diff main...HEAD)
# Start review
RESPONSE=$(curl -sS -X POST https://www.runcept.com/api/v1/run \
-H "Authorization: Bearer $RUNCEPT_API_KEY" \
-H "Content-Type: application/json" \
--data-raw "{\"agent\": \"code-reviewer\", \"input\": {\"diff\": $(echo "$DIFF" | head -c 8000 | jq -Rs .)}}")
JOB_ID=$(echo $RESPONSE | jq -r '.job_id')
echo "Job started: $JOB_ID"
# Poll
for i in {1..20}; do
sleep 4
RESULT=$(curl -sS "https://www.runcept.com/api/v1/jobs/$JOB_ID" \
-H "Authorization: Bearer $RUNCEPT_API_KEY")
STATUS=$(echo $RESULT | jq -r '.status')
if [ "$STATUS" = "complete" ]; then
echo $RESULT | jq '.output'
break
fi
done
import { execSync } from 'child_process'
const diff = execSync('git diff main...HEAD').toString()
const { job_id } = await fetch('https://www.runcept.com/api/v1/run', {
method: 'POST',
headers: {
Authorization: Bearer ${process.env.RUNCEPT_API_KEY},
'Content-Type': 'application/json',
},
body: JSON.stringify({
agent: 'code-reviewer',
input: { diff: diff.slice(0, 8000) },
}),
}).then(r => r.json())
while (true) {
await new Promise(r => setTimeout(r, 4000))
const job = await fetch(https://www.runcept.com/api/v1/jobs/${job_id}, {
headers: { Authorization: Bearer ${process.env.RUNCEPT_API_KEY} },
}).then(r => r.json())
if (job.status === 'complete') {
// { score: 82, issues: [...], suggestions: [...] }
console.log(job.output)
break
}
}
{
"score": 78,
"issues": [
{ "severity": "error", "line": 42, "message": "Missing null check before .id access" },
{ "severity": "warning", "line": 87, "message": "Magic number — extract as named constant" }
],
"suggestions": [
"Add input validation at the API boundary",
"Extract duplicate logic into a shared helper"
]
}
Add this as a required check to block PRs with a score below 70. See the CI pipeline guide.
Use this agent on Runcept
View code-reviewer agent →