Imperative agent workflows
Sandboxed coding-agent workflows as plain TypeScript. Dispatch them, run them on a schedule, and watch them land in the web UI.
bunx @frebreco/factory initWorkflow
A workflow is just an async function.
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
Workflows dispatch manually or on a cron schedule — same run, same event log, same UI either way.
Agents
Point ctx.agent() at a prompt and factory runs it in its own sandboxed environment — no per-agent setup.
Validation
Checks run after every step on their own — or drop into the sandbox yourself and run the test suite by hand.
Turn the workflow above into a pull request.
bunx @frebreco/factory init