DEV Community

Leego
Leego

Posted on

Splitting a Coding Task Across Specialized AI Agents with Human Approval

Introduction

Modern development workflows increasingly rely on large language models for code generation, review, and refactoring. Yet a single model often misses edge cases or introduces subtle bugs that a second pair of "eyes" would catch. Multi-agent AI orchestration addresses this by assigning distinct roles — architect, implementer, reviewer, cost-tracker — to different models within one shared session. VIBA provides a practical environment for this: you can run ChatGPT, Claude, Gemini, and other models side by side, give each a specific mandate, insert human approval gates, and observe per-agent cost in real time. The result is a collaborative loop that mirrors how human teams operate, but at the speed of inference.

Defining Roles for a Feature Implementation

Imagine you need to add a paginated, filterable API endpoint to an existing Node.js service. Instead of prompting one model to do everything, you decompose the work:

  • Architect (Claude 3.5 Sonnet): Designs the data schema, pagination strategy, and filter DSL. Outputs a Markdown spec.
  • Implementer (GPT-4o): Takes the spec and writes the Express route, validation middleware, and database queries.
  • Reviewer (Gemini 1.5 Pro): Scans the implementation for security issues, N+1 queries, and adherence to the spec.
  • Cost-tracker (any lightweight model): Logs token usage per agent and estimates total spend.

Each agent sees the previous agent's output in the shared session, so context flows naturally. You configure this in VIBA by creating a session, adding models, and assigning roles via a simple YAML block:

session: "paginated-api-endpoint"
agents:
  - name: architect
    model: claude-3.5-sonnet
    role: "Design schema, pagination, and filter DSL. Output spec.md."
  - name: implementer
    model: gpt-4o
    role: "Implement Express route per spec.md. Write tests."
  - name: reviewer
    model: gemini-1.5-pro
    role: "Review code for security, performance, and spec compliance."
  - name: cost-tracker
    model: gpt-4o-mini
    role: "Track tokens per agent and report estimated cost."
Enter fullscreen mode Exit fullscreen mode

Adding a Human Approval Gate

Automation is powerful, but certain decisions deserve human judgment — especially when the spec touches data contracts or external APIs. VIBA lets you insert an approval step between any two agents. In the example above, you might pause after the architect finishes the spec:

  1. Architect produces spec.md.
  2. Session pauses and notifies you (via UI or webhook).
  3. You review the spec, request tweaks, or approve.
  4. On approval, the implementer starts automatically.

This gate ensures that architectural drift is caught early, without slowing down the rest of the pipeline. You can also require approval before the reviewer's feedback is merged back to the implementer for a second pass.

Tracking Cost and Output Per Agent

Because each model has different pricing and latency characteristics, visibility into per-agent spend is essential for small teams. VIBA surfaces token counts and estimated cost in real time, so you can see, for instance, that the architect used 12k tokens ($0.036) while the implementer used 45k tokens ($0.135). This data helps you decide whether to swap a model for a cheaper alternative on repetitive tasks, or invest more tokens in the reviewer for critical paths.

The cost-tracker agent can also emit a summary at the end of the session:

Session: paginated-api-endpoint
Total tokens: 78,432
Estimated cost: $0.214
Breakdown:
  architect: 12,048 tokens ($0.036)
  implementer: 45,210 tokens ($0.135)
  reviewer: 18,720 tokens ($0.037)
  cost-tracker: 2,454 tokens ($0.006)
Enter fullscreen mode Exit fullscreen mode

Putting It Together: A Hypothetical Workflow

Here’s how the full loop might run for a two-person team:

  1. Kickoff: Developer creates the session from the YAML above, pushes the current repo snapshot to VIBA’s repo-testing environment.
  2. Architect phase: Claude produces spec.md. Developer reviews, adds a note about rate-limiting headers, approves.
  3. Implementation phase: GPT-4o writes the route, middleware, and unit tests. VIBA runs the test suite in the repo-testing sandbox; all pass.
  4. Review phase: Gemini flags a missing index on the filter column and suggests a composite index. Developer approves the fix.
  5. Second implementation pass: GPT-4o adds the migration and updates tests. Suite passes again.
  6. Cost summary: Cost-tracker emits the breakdown. Team sees the whole feature cost $0.21 and took 6 minutes of wall-clock time.
  7. Merge: Developer opens a PR with the generated commits, confident that multiple models have scrutinized the code.

This pattern — decompose, approve, iterate, measure — scales from a single endpoint to an entire feature branch. VIBA’s UI testing and beta testing agents can further validate the endpoint against staging traffic before merge.

Ready to orchestrate your own multi-agent workflow? Explore the platform at https://viba.guru.

See VIBA: https://viba.guru

Top comments (0)