Osy#the first language built for agents
Agents firstAgentic appsWorkflowsDurable Execution — built inSecurityTestingThe editorThe UI modelOne program

Reference

Workflow

38 pages.

Automatic durability (steps you do not have to write)

Any call that leaves the platform — an outbound client call, an external service — is made a durable step by the compiler. In a workflow, a…

Workflows (the run that outlives the request)

A `workflow` is a run that survives the process it started in — it parks, waits days for a person or a timer, and resumes in a later deployment. The…

Workflows that outlive the code that started them

A workflow run can be waiting for days while you deploy past it a dozen times. This is how the platform decides where such a run IS in terms the new…

Acting on an inbox row (deposit, claim, release)

Answer a queued slot from the row itself. The event is named at the call site because a queue's rows are heterogeneous — which slot a row is, and so…

Assign — handing a slot to a named colleague

Give a slot to somebody else. Claiming takes work for yourself and releasing puts it back in the pool; assigning is the third move — a hand-over. It…

Assigned / Finished (milestones)

A milestone puts an SLA on a slot's progress — Assigned (someone must PICK IT UP within Within) and Finished (it must be SATISFIED within Within)…

Backoff (retry policy)

A retry policy as a value: how long to wait before the next attempt. Three shapes say how the wait GROWS — `Fixed` (the same wait every time)…

Callback URLs — letting an outsider complete one slot

Mint a single-use link that completes exactly one waiting slot, for a third party who has no account and cannot sign in. The link is the permission:…

Candidates (slot)

Declares WHO may hold or satisfy a `subscribe` slot. `Candidates` is one expression surface that dispatches on its return type: a `principal => bool`…

Correlation — finding a run by a business key

Let an inbound event find its run by a key the sender already knows — a tracking number, an invoice reference, an external id — when the sender has…

Flow metrics — how long an item took, and how much was waiting

Wall-clock lead time for a run, split into the part somebody was working it and the part it sat waiting — plus where that time went, state by state…

For(entity).Audit

Reads a running instance's lifecycle timeline — every transition, claim, deposit, reminder and refusal as an WorkflowAuditEntry you can filter and…

Migrating runs that are still in flight

A deploy that renames or removes a workflow state leaves runs parked in it with nowhere to stand. A workflow migration says, per state, what happens…

Parallel legs (start several, then wait for them)

Start several pieces of work at once, each with its own compensation, and wait for them together. Writing `saga.Run("step", ...)` WITHOUT `await`…

Raising a workflow event

Raise a typed event on the run bound to an entity, from anywhere — an ordinary server function, a webhook handler, a signup step. Two spellings do…

Remind (milestone reminders)

A reminder scheduled off a milestone. Its SCHEDULE is config in the header parens — `After` is the first fire (once, at `enter + After`), and the…

Requires — named preconditions, and the live checklist

Named conditions that must hold before something may happen, declared on a state or on a slot — and readable as a live checklist so a screen can show…

ServiceHours (SLA-accrual windows)

A schedule the SLA clock accrues within — the platform WALKS its weekly windows (and holiday exceptions) to advance ticks and compute deadlines. The…

Step labels (naming a child run so it survives a new version)

Every child workflow you AWAIT carries a label — a literal string you choose, naming that step. Awaiting parks the run, sometimes for days, which is…

Tracks and Initial (the field a workflow drives)

Names the enum field a workflow owns and the state a run starts in. No application code may write that field, and when the workflow autostarts it…

Transitions — where this item may go next

One row per move this instance can make right now, with each arm's guard evaluated against it. A board offers only the lanes a card may actually…

Wall-time clocks (Accrues = false)

A timer that measures REAL time instead of SLA time. Written as a block on any clock-declaring setting — `Expire`, `Deadline`, a milestone's…

What a workflow body may write

A workflow body runs on a system data context, so its writes are NOT gated by the entity's `security {}` block. The person who raised the event is…

When a child is cancelled or fails

A workflow you waited for can end badly — cancelled, or failed. `catch` is how you handle it; not catching it is how you let it travel onward, and…

Workflow.BeginSaga (a compensating saga scope)

Open a saga scope that couples each forward step with its compensation. `await saga.Run("step", step, () => Undo(…))` runs a child-workflow step and…

Workflow.Inbox<T> (what is waiting for me)

The current principal's queue: every slot they can act on, across every run of every workflow that tracks T. Rows carry the tracked entity typed, so…

Workflow.Once (run a step at most once)

Run something at most once per workflow run, however many times the surrounding code re-executes. The first execution runs the step and records its…

Workflow.Retarget (re-base the SLA clocks)

Re-evaluates every SLA clock's budget on the current run against the now-updated entity, so a mid-run change to the SLA terms (e.g. re-grading a…

Workflow.Run (start a workflow)

Start the workflow bound to an entity's type, on that entity. Bare — `Workflow.Run(order)` — is fire-and-forget: start it and carry on. Awaited —…

Workflow.Work<T> (everything outstanding) and its SLA numbers

Every live slot of every run tracking T, whoever holds it — the unfiltered sibling of Workflow.Inbox. Rows carry Budget, Elapsed and Remaining for…

Workflow.WorkByItem<T> (one row per item — the board read)

One row per tracked ENTITY, where `Workflow.Work<T>()` is one per SLOT. A board, a queue and a "my work" screen are all per item: an item with three…

[Authorize] (event)

Gates WHO may raise a workflow event. `[Authorize]` on an event is a `principal => bool` predicate over the acting principal and `this.Item`; a…

complete when (a state's own completion condition)

Declare, once on a state, the condition under which that state is finished and where the run goes next. It is re-checked after anything happens in…

dynamic fan-out (foreach over a runtime collection)

A `subscribe … foreach` over a RUNTIME entity collection expands into one wait slot per element of the collection, resolved at state entry. Each…

enter and exit (a state's arrival and departure hooks)

Run code when a run arrives in a state, and when it leaves. enter may redirect the run somewhere else; exit may not, because by the time it runs the…

fan-out (foreach subscribe)

One `subscribe` declaration that expands into MANY parallel wait slots — one per element of a collection. A fan-out over a literal enum list makes…

slot dependencies (After / When / Pending)

Per-slot ordering and conditioning. `After = [A, B]` holds a slot CLOSED (status `Pending`, no clock) until every named sibling slot is satisfied…

subscribe

Declares that a workflow state waits on an event, and configures the wait — who may hold it, who may hand it on, whether it is armed at all, and what…