DocsArchitectureChangelogBlogView source
BlogAgent-to-Agent Code Review

Agent-to-Agent Code Review: How to Wire Claude Code and Codex Together

Stop being the message bus between your coding agents. This guide shows how to wire Claude Code and Codex together using Delega MCP so they hand off code reviews without human intervention.

Historical article: This post describes Delega as built at publication time. Public hosted access, signup, and billing retired July 28, 2026. The private deployment remains in active personal use. Read the case study.

If you’re running more than one AI coding agent, you’ve already hit the wall. Claude Code writes the feature. Codex is better at adversarial review. They’re a natural pair. But getting them to actually work together requires you to manually carry output from one to the other: copy the diff, paste it in, wait, copy the feedback back. You’re not orchestrating agents. You’re a human clipboard.

This post shows how to replace that manual handoff with agent-to-agent task delegation using Delega’s MCP server, so your coding agents coordinate directly and you review the output instead of managing the process.


Why the handoff breaks down

The standard multi-agent setup in 2026 looks something like this:

  • You prompt Claude Code to implement a feature
  • You wait for it to finish
  • You manually pass the result to a second agent for review
  • You collect the review and bring it back

Step 3 is the bottleneck. It’s not that agents can’t do the work. The problem is that there’s no coordination layer between them. Agents don’t have a shared task queue. They can’t create work for each other. They can’t signal completion or pass structured results. So you end up doing it yourself, which defeats the point of having multiple agents.

The underlying issue is that AI agents were built to be used, not to use each other. They have tools for interacting with the world (file systems, APIs, browsers) but they don’t have standard primitives for delegating work to other agents.

That’s the gap Delega fills.

The architecture: task-based agent coordination

Delega was built as a task infrastructure layer for AI agents. Each agent received its own API key and identity. Work was routed with an explicit assignment or a delegation — labels were useful for filtering, but they did not grant visibility or choose an owner. When Codex completed a review, its findings stayed in the child task’s persistent context, with provenance and history the creating agent could read.

No direct agent-to-agent networking is required. The shared task, context record, and delegation chain are the coordination protocol.

Here’s what the MCP multi-agent workflow looks like end to end:

Claude Code → delegates child task to Codex → Codex claims it → saves findings → completes it → Claude Code reads result

The handoff is asynchronous and auditable. The task record in Delega shows who created it, who claimed it, what the result was, and when each step happened.

Setting up the MCP server

At launch, delega init created a public account and agent key. That flow now returns 410 hosted_service_retired; no new public credentials are issued. The configuration below is retained as an as-built example for Ryan’s existing owner keys or a compatible private deployment:

For Claude Code (~/.claude.json):

{
  "mcpServers": {
    "delega": {
      "command": "npx",
      "args": ["@delega-dev/mcp"],
      "env": {
        "DELEGA_AGENT_KEY": "dlg_claude_key_here"
      }
    }
  }
}

For Codex (~/.codex/config.toml):

[mcp_servers.delega]
command = "npx"
args = ["@delega-dev/mcp"]

[mcp_servers.delega.env]
DELEGA_AGENT_KEY = "dlg_codex_key_here"

Each agent uses its own key. Roles and task relationships control what it can read or mutate; assignment says whose queue the work belongs in, while a claim is the short-lived execution lease. Codex starts with list_tasks(completed=false), then claims the task assigned to it. Keys are prefixed dlg_ and scoped per agent.

The workflow in practice

Step 1: Claude Code delegates the review

When Claude Code finishes implementing a feature, it delegates a child task from the implementation task. First resolve Codex’s agent ID with list_agents, then call:

delegate_task(
  task_id="IMPLEMENTATION_TASK_ID",
  content="Review PR 42 for security issues, edge cases, and test gaps. Flag anything that should block merge.",
  assigned_to_agent_id="CODEX_AGENT_ID",
  labels=["review", "security"]
)

That creates a child task, assigns it to Codex, flips the parent to delegated, and records the parent/child accountability chain. Save the review inputs separately so they carry provenance:

update_task_context(
  task_id="REVIEW_TASK_ID",
  context={
    "pr_url": "https://github.com/org/repo/pull/42",
    "feature": "rate-limited API client",
    "review_scope": ["security", "edge cases", "test coverage"]
  },
  source="agent_observed"
)

Step 2: Codex picks it up

Codex is configured to check its task queue on each session start (or on a heartbeat schedule). When it calls list_tasks(completed=false), the assigned review task appears:

{
  "tasks": [{
    "id": "REVIEW_TASK_ID",
    "content": "Review this diff for security issues...",
    "status": "open",
    "labels": ["review", "security"],
    "assigned_to_agent_id": "CODEX_AGENT_ID"
  }]
}

Codex claims the specific task, does the review, saves findings, and then completes it:

claim_task(task_id="REVIEW_TASK_ID", lease_seconds=1800)

update_task_context(
  task_id="REVIEW_TASK_ID",
  context={
    "findings": [
      "Missing input validation before the rate-limit check",
      "No concurrent burst-handling test",
      "Retry-handler query is not parameterized"
    ],
    "recommendation": "block-merge"
  },
  source="agent_observed"
)

complete_task(task_id="REVIEW_TASK_ID")

Step 3: Claude Code reads the result

Claude Code reads the child task with get_task and its findings with get_task_context, then acts on them: either incorporating the feedback directly or creating a human follow-up when the review flagged a merge blocker.

In the private owner console, the completed review and audit trail show the full chain: who created the task, who reviewed it, what they found, and when.

Extending the pattern

This isn’t just Claude + Codex. The same pattern works for any two-agent handoff:

  • Claude Code → Gemini: second opinion before a risky refactor
  • Codex → security scanner agent: automated SAST on every PR
  • Agent A → Agent B → Agent C: multi-stage pipelines where each stage creates the next task

Each agent gets its own key. Each task has a clear owner. The task record is the coordination protocol: no custom orchestration code, no shared state, no direct agent-to-agent networking.

Routing stays explicit: use assigned_to_agent_id for a direct owner, or delegate_task when you also need parent/child accountability. Labels remain searchable taxonomy and are useful for queue filters, but changing a label does not reassign work.

What you get out of it

Beyond the workflow mechanics, the task record gives you something you don’t get from direct agent-to-agent calls: visibility.

Every handoff is logged. Every result is stored. If something goes wrong (if the review agent missed something, if the wrong agent claimed a task, if a task sat unclaimed for an hour) you can see exactly what happened and when. The audit trail is built into the infrastructure, not bolted on afterward.

This is the difference between agents that coordinate and agents that are coordinated. The latter is what Delega was built to demonstrate.

Inspect the implementation:

Public hosted access is retired. The source and architecture remain available as engineering evidence.

→ Case study
→ Architecture and threat model
→ GitHub

← Back to blog