Browse documentation

Run

Subagents and schedules

Delegate durable work across providers and run it now or on a schedule.

A subagent is a declared child agent with its own durable 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.

Thread schedules submit an agent message once, at an interval, or with the supported UTC cron patterns. Each firing saves its message before dispatch and uses a stable submission key. If a Worker restarts or loses the runtime’s acceptance reply, it retries that same message and key. Editing or deleting the schedule affects future firings; it does not change already claimed work.

Schedule history shows admission status, dispatch attempts, the next retry time, and the last dispatch error. A runtime outage keeps the firing pending with exponential backoff, capped at five minutes. An uncertain acceptance keeps the thread’s export fence closed until recovery resolves it. Claims created before this recovery support that lack their original message appear as outcome_unknown and need operator resolution; Flary does not guess their request from a schedule that may have changed.

The generated host supports one-time triggers, intervals of at least one second, and UTC cron patterns for minutes and hours using a fixed value, *, or */n. Day, month, and weekday fields must be *. This is not a general cron or timezone engine.