Imperative agent workflows

factory

Sandboxed coding-agent workflows as plain TypeScript. Dispatch them, run them on a schedule, and watch them land in the web UI.

Read the docsbunx @frebreco/factory init

Workflow

A workflow is just an async function.

workflows/hello-world.ts
import { defineWorkflow, Schema } from "@frebreco/factory";
export default defineWorkflow("hello-world", {
input: Schema.Struct({
task: Schema.String,
}),
output: Schema.Struct({
prUrl: Schema.NullOr(Schema.String),
}),
run: async (ctx, input) => {
// Run a sandboxed agent
await ctx.agent("implement", `Implement the following task: ${input.task}`);
// Create a PR
const writeBack = await ctx.writeBack({
branch: "factory/hello-world",
commitMessage: `${input.task}\n\nAutomated by the factory 'hello' workflow.`,
prTitle: input.task,
prBody: `Opened by factory.\n\nTask: ${input.task}`,
});
return { prUrl: writeBack.prUrl };
},
});

Dispatch

Run it now, or run it on a schedule.

Workflows dispatch manually or on a cron schedule — same run, same event log, same UI either way.

Agents

Any coding agent, one prompt away.

Point ctx.agent() at a prompt and factory runs it in its own sandboxed environment — no per-agent setup.

Validation

Validation isn't only automatic.

Checks run after every step on their own — or drop into the sandbox yourself and run the test suite by hand.

Stop prompting.
Start shipping.

Turn the workflow above into a pull request.

Read the docsbunx @frebreco/factory init