A fully automated multi-agent code review pipeline. When a PR is submitted, a chain of AI agents reviews, fixes, tests, and ships the code — all coordinated through Janus.
The product agent publishes a code review task to Janus with the PR details:
client.publish_task({
"id": "pr-42-review",
"source_agent": "product",
"target_type": "mailbox",
"target_value": "review-agent-mb",
"envelope": {
"type": "code_review",
"payload": {
"pr_url": "https://github.com/org/repo/pull/42",
"repo": "org/repo",
"branch": "feature/new-auth",
"files": ["auth/service.go", "auth/handler.go"]
}
}
})
The review agent pulls the task, analyzes the diff for bugs and style issues, then publishes its findings to the next agent in the chain:
# Pull & start
result = client.pull_task("review-agent-mb", "reviewer")
client.start_task(result.task.id, result.lease.lease_id)
# Analyze code... (AI review logic)
# Publish result to code agent
client.publish_task({
"id": "pr-42-code-fix",
"source_agent": "reviewer",
"target_type": "mailbox",
"target_value": "code-agent-mb",
"envelope": {
"type": "code_fix",
"payload": {
"pr_url": "https://github.com/org/repo/pull/42",
"findings": [
{"file": "auth/service.go", "line": 42, "severity": "error", "message": "Missing input validation"},
{"file": "auth/handler.go", "line": 15, "severity": "warn", "message": "Unused parameter"}
]
}
}
})
# Acknowledge original task
client.ack_task(result.task.id, {"lease_id": result.lease.lease_id})
The code agent receives the findings, applies fixes, and publishes a new task for the test agent:
# Pull findings
result = client.pull_task("code-agent-mb", "coder")
client.start_task(result.task.id, result.lease.lease_id)
# Apply fixes via GitHub API...
# Publish to test agent
client.publish_task({
"id": "pr-42-test",
"source_agent": "coder",
"target_type": "mailbox",
"target_value": "test-agent-mb",
"envelope": {
"type": "test_run",
"payload": {
"pr_url": "https://github.com/org/repo/pull/42",
"commit_sha": "abc123"
}
}
})
client.ack_task(result.task.id, {"lease_id": result.lease.lease_id})
The test agent runs tests against the fixed code:
result = client.pull_task("test-agent-mb", "tester")
client.start_task(result.task.id, result.lease.lease_id)
# Run CI tests...
client.publish_task({
"id": "pr-42-deploy",
"source_agent": "tester",
"target_type": "mailbox",
"target_value": "deploy-agent-mb",
"envelope": {
"type": "deploy",
"payload": {
"pr_url": "https://github.com/org/repo/pull/42",
"tests_passed": true,
"coverage": 87.3
}
}
})
client.ack_task(result.task.id, {"lease_id": result.lease.lease_id})
The deploy agent merges and deploys the PR to production. Every step is audited and traceable through Janus.