Skip to content
flujo-appPublic

About

A reusable swarm engine for your app. Run a team of AI agents on your own subscription or self-hosted models.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

239 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FACTORY, the swarm engine for your app. Your subscription, your own GPUs or any server flow into FACTORY and power your team of agents.

Your AI agent runs a whole team of AI agents.

Connect FACTORY to Claude Code or Codex, then say what you want done.
Your agent puts a team together, a lead with nine agents or more, hands out the work and keeps watch.
Work only counts once a second agent has checked it. Watch every agent live in herdr.

Latest release MIT license Node 22.17 or newer, or 24 or newer

Try it  ·  Watch it in herdr  ·  How it works  ·  Bring your own AI  ·  Go big  ·  Full guide


herdr showing a FACTORY team of ten at work: the sidebar lists FACTORY · lead building book, eight builders building or handing in their chapters, and the reviewer reviewing chapter 1; each agent has its own pane with its live steps
A real run, not a mock-up. One plain request to Claude Code; it set up a lead, eight builders and a reviewer, and herdr shows every one of them at work. The run's record.


Try it in a minute

1. Install FACTORY and connect it to your agent.

npm install -g flujo-factory
claude mcp add factory -- factory-mcp team.sqlite

Using Codex? codex mcp add factory -- factory-mcp team.sqlite. Each release is also on GitHub Releases, with checksums.

Workers sign in the way claude and codex do in your terminal. If Claude Code workers can't sign in, run claude setup-token and add -e CLAUDE_CODE_OAUTH_TOKEN=<the token> to the claude mcp add line. More on signing in.

2. Ask your agent.

Use FACTORY to build my bakery's website with a team of ten: a lead who splits the work and puts the site together, eight builders who make one page each, and a reviewer who checks every page and the finished site.

That's all. Your agent uses the tools FACTORY gives it to:

  1. set up the team: a lead, eight builders and a reviewer, in one go;
  2. write the job for the lead: what to make, and what counts as done;
  3. start all ten at once, each as its own Claude Code or Codex on your computer, each tied to its own name;
  4. keep watch: the lead splits the job, hands each builder a page and waits; the reviewer checks every page as it comes in, and anything sent back goes to its builder again; once all pages are accepted, the lead puts the site together and hands in the whole, and the job only counts as done when the reviewer accepts that too.

A small job? Ask for "one builder and one reviewer" instead. Bigger? Ask for more builders, or a lead per part.

Ask for "Codex" and the workers run on Codex instead. Ask your agent how it's going at any time.

Warning

Workers can read, change and run anything on the computer they're on, with no permission prompts. Start them in a folder or machine you're happy to hand over.


Watch your team in herdr

herdr is a terminal app that shows many coding agents side by side, with a sidebar that tells you which one is working, waiting or needs you. FACTORY puts every agent of your team there, under its own name, with the job it is on:

  • The workers your agent starts. Run Claude Code in a herdr pane and ask as above. Every worker it starts gets a pane of its own in a FACTORY team tab, showing what it does step by step, as in the picture at the top.
  • Workers you start yourself. Run factory-lite claude team.sqlite --agent builder-1 "Work on the board" in a herdr pane.
  • Docker and cloud fleets. Run factory-herdr fleet ./private/fleet in a herdr pane: one pane per agent, one tab per machine, on your own computer or on Fly.io.

herdr following a FACTORY Docker fleet: one tab per machine, one pane per agent with its turns, and every agent of the fleet in the sidebar
A real Docker fleet of two machines, each with a lead and nine Claude Code agents, followed live with factory-herdr fleet.

In the sidebar each agent reads FACTORY · builder-3 instead of plain "Claude", and herdr's alerts tell you when one finishes or needs you. To see each agent's job under its name (building chapter-3, handed in chapter-3, reviewing chapter-3), as in the pictures, add this to herdr's config.toml:

[ui.sidebar.agents]
rows = [["state_icon", "agent"], ["state_text"]]

That line is optional. Nothing else to set up, and no change to herdr; outside herdr nothing changes. With Codex as your agent, run factory-herdr team team.sqlite in a herdr pane once Codex has started the workers (and again after it starts more): Codex passes its tools only a few settings, so the workers cannot open their panes by themselves. A fleet shows what its watcher (fleet.supervise()) records; with none, add --observe docker. Needs FACTORY 0.16 or later. More in the guide.


How it works

🗂️ One shared job board
A small file in your folder. Agents take work from it, so two never do the same job. Everything is saved as it happens, so you can stop and pick up again later.
🪪 One name per worker
Each worker's connection to the board lets it take, hand in and review work only as itself, and the reviewer can't be the builder. Workers still have full access to their computer: this keeps honest agents in their lanes, it is not a lock against a hostile one.
🧭 Leads split big jobs
A lead hands each builder a piece and waits. Once every piece is accepted, it puts them together and hands in the whole, which is checked again. Builders and the reviewer stay on call until the lead's job is done.
✅ Work counts after review
A task is done only when its reviewer accepts it, and any checks you asked for (commands that must pass, which your agent runs on exactly the files that were handed in) have passed. How review works.
😴 Waiting is free
A worker with nothing to do waits without using your AI plan, wakes up when there is new work for it, and stops by itself when its team is done.
👀 Watch it live
Every agent in its own herdr pane, with its state and job in herdr's sidebar: the ones your agent starts, the ones you start, and whole fleets.

1 request

was enough for Claude Code to set up a team of ten (a lead, eight builders and a reviewer) and get a small book written, every chapter reviewed and the whole put together
in a real run, under three minutes from start to finish

100

agent sessions on 10 cloud machines
in one real run; it was a scale test, and no finished change is credited to the team

Bring your own AI

Your agents, your choice of brain. Your agent picks it when it starts a worker.

💳 Your subscription 🖥️ Your own GPUs 🔌 Any server
Runs on Claude Code or Codex Qwen or Nemotron on your Modal account, Nemotron on RunPod GPUs Anything that speaks the OpenAI or Anthropic API
You pay The plan you already have From about $4.84 an hour while it runs (Modal list price: the GPU with its reserved CPU and memory), nothing when idle Whatever that server costs
Your code goes to That AI company Only your own Modal or RunPod account That server
Setup Sign in once Two commands One small file
🖥️ Host your own model

Needs Python with pip install modal, and a signed-in Modal account. FACTORY sets up the GPU server, checks it works, and writes down its address. Your agent can run these for you:

factory-selfhost deploy --dir ./private/model --profile qwen
factory-selfhost endpoint --dir ./private/model --out endpoint.json

Then tell your agent to start the workers with endpoint.json. The key stays in an environment variable that the file names. factory-selfhost retire --dir ./private/model deletes it all. More on self-hosting →

On RunPod instead, for example on RunPod credits: add --cloud runpod and your key in RUNPOD_API_KEY. It starts Nemotron on a B300 (or a B200 or H200 when none is free), and the pod switches itself off after 8 idle minutes. A stopped pod only costs its disk, about $22 a month, until you retire it. How to start and stop it →

🔌 Use any server

Describe the server in a small file, put its key in the environment variable the file names, and tell your agent to start the workers with it:

{
  "id": "my-server",
  "envKey": "MY_MODEL_KEY",
  "baseUrls": ["https://models.example.com/v1"],
  "apis": ["anthropic"],
  "model": "my-model"
}

Go big

The same idea on many machines at once: whole fleets of teams in the cloud on Fly.io, on Fly.io Sprites, or in Docker on your own computer. Each machine runs a lead with its agents, so agentsPerMachine: 10 is a lead and nine on every machine. Today a fleet starts from a short script, which your agent can write and run for you; watch it with factory-herdr fleet. Fleet tools for your agent, like the ones above, are planned (#46).

☁️ On Fly.io

Needs a Fly.io account and flujo-cloud.

import { FactoryCloudLiteFleet, ClaudeSubscriptionBroker } from 'flujo-factory';

const fleet = new FactoryCloudLiteFleet({
  directory: '/private/fleet',
  flujoCloudPath: '/path/to/flujo-cloud',
  auth: new ClaudeSubscriptionBroker({ tokenFile: '/private/claude-token' }),
});

await fleet.deploy({
  runId: 'launch',
  app: 'my-swarm',
  goal: 'Fix every open bug',
  workerProgram: 'claude',
  machines: 10,
  agentsPerMachine: 10,
}, { image, bundlePath });
🐳 In Docker on your own computer

No cloud account, nothing to set up beyond Docker. prebuild: true sets the workers up once, so every container starts in seconds. A model server on your own computer (Ollama, LM Studio) works too. How it works.

import { FactoryDockerLiteFleet, ClaudeSubscriptionBroker } from 'flujo-factory';

const fleet = new FactoryDockerLiteFleet({
  directory: '/private/fleet',
  auth: new ClaudeSubscriptionBroker({ tokenFile: '/private/claude-token' }),
});

await fleet.deploy({
  runId: 'launch',
  app: 'my-swarm',
  goal: 'Fix every open bug',
  workerProgram: 'claude',
  machines: 2,
  agentsPerMachine: 10,
}, { prebuild: true });
🧚 On Fly.io Sprites, with no image to build

A Sprite is a ready-made Linux computer with Node, git and Claude Code already on it. One Sprite per machine, the board on the first one, and only a Sprites token from the Fly dashboard. Sprites stay awake while the workers run and pause when the fleet stops. How it works.

import { FactorySpriteLiteFleet, ClaudeSubscriptionBroker } from 'flujo-factory';

const fleet = new FactorySpriteLiteFleet({
  directory: '/private/fleet',
  tokenFile: '/private/sprites-token',
  auth: new ClaudeSubscriptionBroker({ tokenFile: '/private/claude-token' }),
});

await fleet.deploy({
  runId: 'launch',
  app: 'my-swarm',
  goal: 'Fix every open bug',
  workerProgram: 'claude',
  machines: 3,
  agentsPerMachine: 10,
});

Prefer to write the code yourself?

Everything your agent does is also a few lines of JavaScript. A team of ten:

import { Factory, FactoryWorkflow } from 'flujo-factory';

const factory = new Factory('team.sqlite');
const builders = Array.from({ length: 8 }, (_, i) => ({ id: `builder-${i + 1}`, role: 'developer', parentId: 'lead' }));
factory.createSwarm({
  mission: 'Build my bakery website',
  agents: [{ id: 'lead', role: 'coordinator' }, ...builders, { id: 'reviewer', role: 'verifier', parentId: 'lead' }],
});

const board = new FactoryWorkflow(factory.database);
board.createTask({
  taskId: 'site', assignee: 'lead', reviewerId: 'reviewer',
  problem: 'Build a bakery website: one page per builder, then put the site together.',
  acceptance: 'Eight pages that read well on a phone, linked from one home page.',
  verificationPolicy: { mode: 'review-only', reason: 'Design is a judgment call.' },
});
board.close();

for (const agentId of ['lead', ...builders.map(builder => builder.id), 'reviewer']) await factory.workers.start({ agentId });

There is a command line too (factory, factory-lite, factory-herdr). Full guide →


Good to know

  • After a crash, nothing is quietly done twice. FACTORY writes down every outside action before it starts it. If a crash leaves one unclear, it is flagged for you to check instead of being repeated. It cannot undo what an outside service already did.
  • Budgets are bookkeeping. You can give each agent a share of a budget, and FACTORY won't hand out more than the total. It doesn't stop your provider from charging you, so set limits there too.
  • Check your AI plan's terms before running lots of agents on one subscription.
  • In the cloud you can lock agents down with sandbox: 'workspace-write'. See the guide.
  • Give every fleet agent more tools with mcpServers in a fleet plan. See the guide.

Learn more

Your agent runs the team  ·  Full SDK guide  ·  Self-hosted models  ·  How review works

Part of the FLUJO family. MIT licensed, including commercial use.

About

A reusable swarm engine for your app. Run a team of AI agents on your own subscription or self-hosted models.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages