Run
Subagents and schedules
A subagent is a declared child agent with its own persistent thread, transcript, approvals, audits, usage, and model selection.
export const coder = app.agent({
name: "coder",
subagents: { reviewer, researcher },
});
Flary applies safe child, depth, step, and cost defaults. Add a delegation or limits block only
when the application needs different values.
A child can use another provider:
await thread.subagents.spawn({
agent: "reviewer",
task: "Review the current change.",
model: "anthropic/claude-sonnet",
workspace: "shared",
});
Parents, children, and siblings use durable mailboxes. A completed child sends a typed result with its summary, checkpoint, files, checks, usage, and errors. The root thread reserves and settles limits transactionally across the full tree.
Shared workspaces are the default for child agents. Possible writes are serialized. User-created thread forks use isolated workspace branches.
Durable schedules can start a function or agent command later. Schedule history includes attempts, retry state, pause, resume, cancellation, and the created run or thread reference.