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
- 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.
- 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 listOn Windows, the same commands work in Command Prompt, PowerShell and Git Bash.
- 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- 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 testpasses".
- 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=3001in one andPORT=3002in the other.
- Review and merge one at a time.
cd ../myapp
git diff main...agent/search
git merge agent/search- Clean up.
git worktree remove ../myapp-search
git branch -d agent/searchOption 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.
- Describe the whole task once, with what "done" means.
- A lead agent plans the split: which files each worker owns, what the shared interfaces are, and how each part will be checked.
- Workers build and test their parts in parallel.
- The lead checks the combined result with the real diff, build and tests, and reports back.
- 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.
- How to create and switch branches in git
- How to write a task for a coding agent
- How to review an AI agent's code changes
- What is a multi-agent terminal?
- Mel vs Claude Code
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 is a hands-on tech founder, agentic infrastructure architect and the vision behind Mel.
Follow on LinkedIn