FACTORY is a reusable swarm engine you drop into your own app.
Bring the AI subscription you already pay for, or host open models on your own GPUs.
Try it · Bring your own AI · Go big · Full guide
npm install https://github.com/flujo-app/FACTORY/releases/download/v0.12.0/flujo-factory-0.12.0.tgzimport { Factory } from 'flujo-factory';
const factory = new Factory('team.sqlite');
factory.createSwarm({
mission: 'Build a landing page',
agents: [
{ id: 'builder', role: 'developer' },
{ id: 'reviewer', role: 'verifier' },
],
});
factory.startLiteWorker({ provider: 'claude', prompt: 'Work on the Factory board' });That's a team. Claude Code opens in your terminal on your normal login, sees the shared job board and gets to work. Change 'claude' to 'codex' to use Codex instead.
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.
Your agents, your choice of brain. Switching is one setting.
| 💳 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 running, nothing when idle | Whatever that server costs |
| Your code goes to | That AI company | Nowhere. It stays in your account | That server |
| Setup | Sign in once | One function call | One setting |
🖥️ 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 gives your agents the address and key.
import { ModalSelfHostedModel } from 'flujo-factory';
const model = new ModalSelfHostedModel({ directory: '/private/model' });
await model.deploy({ profile: 'qwen' });
factory.startLiteWorker({
provider: 'claude',
modelProvider: model.endpoint(),
providerKey: await model.key(),
});When you're done, await model.retire() deletes it all. More on self-hosting →
On RunPod instead, for example on RunPod credits: new RunPodSelfHostedModel({ directory }) with your key in RUNPOD_API_KEY, then the same calls. 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 weights disk, about $22 a month, until you retire it. How to start and stop it →
🔌 Use any server
factory.startLiteWorker({
provider: 'claude',
modelProvider: {
id: 'my-server',
envKey: 'MY_MODEL_KEY',
baseUrls: ['https://models.example.com/v1'],
apis: ['anthropic'],
model: 'my-model',
},
providerKey: process.env.MY_MODEL_KEY,
});The same idea, on as many cloud machines as you want. 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 });🐳 Or on your own computer, with Docker
The same fleet in local containers: no cloud account, no extra setup 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: 3,
agentsPerMachine: 4,
}, { prebuild: true });🧚 Or 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,
});| agents on 10 cloud machines in one real run |
agents sharing one GPU in one real coding run |
of GPU time for that run 2 hours 18 minutes |
| 🗂️ A shared job board Agents claim work, so two never pick up the same job. |
✅ Independent review One agent builds, another checks. Work only counts once it passes. |
| ♻️ Survives crashes Restart any time. A job that was already sent is never sent twice. |
💰 Budgets Give each agent a share. It can't hand out more than it has. |
| 🤖 Your choice of worker Claude Code, Codex or FLUJO, on your PC or in the cloud. |
🧩 Use it your way From your code, from the command line, or as an MCP tool for other agents. |
- Budgets are bookkeeping. They limit what FACTORY hands out. They don'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.
- Not on npm yet. Install from GitHub Releases, as shown above.
- In the cloud you can lock agents down with
sandbox: 'workspace-write'. See the guide. - Give every agent more tools with
mcpServersin a fleet plan: MCP servers in each container or on the network, with their keys kept out of logs. See the guide. - Your own instructions replace the built-in ones, including how to use the shared job board. See the guide.
Full SDK guide · Self-hosted models · Reviewed workflows · Early pilot notes
Part of the FLUJO family. MIT licensed, including commercial use.