factory

Imperative agent workflows

Sandboxed agent workflows as plain TypeScript.

Run a schedule, monitor in the web UI

Read the docsbunx @frebreco/factory init
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 };
},
});

Workflows

Plain async TypeScript over a run context — ctx.agent, exec, writeBack, assert, output. No step graph, no DSL.

Server

factory serve gives you HTTP + SSE, run admission and lifecycle, automatic dispatch, and sqlite persistence.

Web UI

A React SPA to watch runs land: the event log, per-step transcripts, write-backs, and manual dispatch.