Skip to content
New — orchestrate a team of Mel agents from your terminal. Learn more about orchestrating Mel agents
← All guides

Guides · AI coding agents

How to run several AI agents at once

By Lalla Asmaa Alaoui, founder of Mel · Updated

The simplest way is to give one task to a team of agents that splits the work: a lead agent plans, and other agents build and test, each in its own pane. If you run separate agents by hand instead, give each one its own git worktree so they never edit the same files at the same time.

There are two different things people mean by "several agents". One is several independent tasks in parallel, each with its own agent. The other is one big task split between coordinated agents. The steps below cover both.

Option 1: several independent tasks, by hand

  1. Pick tasks that do not overlap. Two agents editing the same file at the same time will undo each other's work. Good pairs: a bug fix and a docs update, or two features in different folders.
  1. Create one worktree per task. A worktree is a second checkout of the same repository, on its own branch, in its own folder.
git worktree add ../myapp-search -b agent/search
git worktree add ../myapp-docs -b agent/docs
git worktree list

On Windows, the same commands work in Command Prompt, PowerShell and Git Bash.

  1. Install dependencies in each worktree. Each folder is a full checkout, so it needs its own node_modules, virtual environment or build output.
cd ../myapp-search && npm install
  1. Open one terminal per worktree and start an agent in each. Use separate tabs or split panes. Give each agent a self-contained task with a clear finish line, such as "the command npm test passes".
  1. Watch for clashes on shared resources. Two dev servers cannot use the same port, and two test runs may share a database. Give each worktree its own port, for example PORT=3001 in one and PORT=3002 in the other.
  1. Review and merge one at a time.
cd ../myapp
git diff main...agent/search
git merge agent/search
  1. Clean up.
git worktree remove ../myapp-search
git branch -d agent/search

Option 2: one task, a coordinated team

Running agents side by side leaves you as the coordinator: you split the work, pass information between them and check that the parts fit. A coordinated team does that part for you.

  1. Describe the whole task once, with what "done" means.
  2. A lead agent plans the split: which files each worker owns, what the shared interfaces are, and how each part will be checked.
  3. Workers build and test their parts in parallel.
  4. The lead checks the combined result with the real diff, build and tests, and reports back.
  5. You review the final diff and commit.

A team costs more steps, and so more model usage, than one agent. Use it for many-step work such as a feature across several files, a refactor or a migration, not for a one-line fix.

Doing it with Mel

Mel does both.

A team of agents. Type /orchestrate-agent in the prompt, then describe the task. A lead agent splits the work, and workers each open in their own pane, so you can click into any of them and watch it live. Before any worker starts, Mel shows a confirmation card with the proposed team, which you can edit or reject. The lead does not write code itself: it plans, assigns, reads results and checks the real changes on disk before it summarises. Lead and workers share the project's memory, so a decision one agent makes is visible to the others.

Claude Code and Codex as workers. Type /orchestrate-cli instead, and the workers are coding agents you already use, such as Anthropic's Claude Code or OpenAI's Codex, running in Mel panes. You need those tools installed and signed in.

Separate tasks, side by side. Each pane in Mel hosts its own agent conversation. Split with ctrl+D and start one in each. For isolation, track your repo from the + menu ("Track this repo"), then use + → Worktree to create a checkout on a new branch, with one agent per worktree tab.

Know how approvals work in a team run. Team runs start in Mel's hands-off mode, and Claude Code or Codex workers start in their own auto-approve modes, so no worker stalls on a prompt nobody is watching. The confirmation card before workers start always stays, and in Mel's hands-off mode some actions, such as a command that cannot be undone, still need your yes. Start team runs from a clean git tree on their own branch. The code review panel (ctrl+shift+=, or cmd+shift+= on macOS) shows the team's combined changes in one place.

FAQ

Can I run two AI coding agents on the same repo? Yes, but give each its own worktree or branch, or have them coordinated by a lead agent. Two uncoordinated agents in one folder will overwrite each other.

What is a git worktree? A second working folder for the same repository, on its own branch. Create one with git worktree add ../folder -b branch.

Is a team of agents better than one agent? For big, many-step tasks, often yes: each agent gets a smaller brief and separate roles check the work. For small tasks, one agent is faster and uses less.

Does running several agents cost more? Yes. Every agent's steps use model tokens. Check usage after your first team run to see what a typical task costs.

Can Claude Code run inside Mel? Yes. Type claude in a Mel pane to use it directly, or let a Mel lead agent start Claude Code or Codex workers with /orchestrate-cli.

Facts checked on Oct 25, 2026.

Claude Code and Codex are trademarks of their owners. Mel is not affiliated with or endorsed by Claude Code, Codex, Anthropic or OpenAI.

Mel – the agentic terminal · openmel.dev. A multi-agent, multi-model AI terminal for Mac, Windows, Linux and VS Code. Free with your own API key.

Lalla Asmaa Alaoui
Written by
Lalla Asmaa Alaoui
Founder & CEO of Mel

Lalla is a hands-on tech founder, agentic infrastructure architect and the vision behind Mel.

Follow on LinkedIn

Get started

Try the agentic terminal.

The Mel terminal is free to download, no account needed. The AI agent is free on your own provider key — 1,500 hosted-AI credits a month on Pro.