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.7.1/flujo-factory-0.7.1.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 | 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 →
🔌 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 });| 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.
Full SDK guide · Self-hosted models · Reviewed workflows · Early pilot notes
Part of the FLUJO family. MIT licensed, including commercial use.