Workflows
Deterministic, chat-built automations. Glossary: Glossary. Plan: docs/plans/workflows-v1.md. ADR: docs/decisions/workflows-runtime.md.
Model
- Definition: vibe-style JSON (
trigger,variables,steps,functions) with steps narrowed toaction|set|if|forEach|wait|try - Compiler — pure package (ported from vibe, narrowed)
- Interpreter — one Cloudflare Workflow instance per Run; Functions run in
@cloudflare/codemodesandbox with shareddb/integrations/appconnectors - Version pins each Run; Timeline is Brilliant’s Postgres projection, not CF engine history
- Principal = creator; Grants fixed at Enable from creator’s existing access
- Charge unit:
actionStep attempt; control flow /waitfree
Triggers (shared platform)
One Trigger system, two consumers (Workflow Runs and Agent turns), separate quotas:
- Schedules — tenant scheduler DO +
cronerfor IANA zones - App events — D1 outbox table
_brilliant_events+ workspace events DO (idempotent Run ids). Studio Data tab hides_brilliant_eventsfrom its collection list (#307); see Control plane — What the Data tab lists. - Composio / integration webhooks — per-tenant inbox DO
- Manual “run”
Authoring UX
Builder chat tools + workflows skill; Studio Canvas is auto-laid-out and read-only for structure.
Feature flag gate (#505, merged)
On main since 2026-10-06 (yoni-monday, merge 4d2fcd0d). Workflows sits behind the workflows platform flag (boolean, default off for everyone), set per tenant or user in Admin Feature Flags.
- UI: without the flag, the Workflows settings section and the mobile More sheet's Workflows row are hidden. A direct link to
/settings/workflows*shows a "not available" notice instead of mounting the page and its data fetches. - Session API: every session-authenticated route in
workflows.tsandworkflows-connections.tsreturns403 {error:"feature_disabled"}unless the flag is exactlytrue(fails closed). The creator-or-admin mutation check (workflow-mutate-requires-creator-or-admin) only applies once the flag lets the request through. - Builder API (conductor): the internal
/internal/workspaces/:wsId/workflows*routes inworkflows-internal.ts, which conductor's coding-agent tools call to create, edit, test-run, and enable workflows from chat, are gated too, withrequireFlagForTenant("workflows", …)keyed on the workspace's tenant. An unflagged tenant can't get a new or newly enabled workflow through chat. - Still running: the
internalGuardengine routes inworkflows-engine.ts(fire, timeline, charge). A workflow enabled before the flag was turned off keeps firing on schedule. The line is execution versus building, not backwards compatibility. - Not yet verified live on staging when it merged.
Code locations
- Service:
services/workflows - Shared package:
packages/workflows - Codemode:
packages/codemode
Related
- Admin Feature Flags (
workflowsflag) · Glossary · Capability model · Template AppRpc
App editor skips /workflows while the flag is off (#964, merged)
#964 (merged 2026-10-15 15:28 IDT by yoni-monday, merge ab7c1b11, head 286e595a) closes a hole left by #505.
Problem: the app editor mounted useWorkspaceWorkflows on every app page and polled GET /workflows?limit=100 once a second during a turn. That route returns 403 {error:"feature_disabled"} unless the workflows flag is on, so a disabled account hammered the API in a loop.
Behaviour on main:
| Surface | Flag off | Flag on |
|---|---|---|
App editor (useWorkspaceWorkflows) | Idle: no mount fetch, no turn poll, empty list, ready immediately | Lists GET /workflows?limit=100 on mount; polls during a turn so a workflow created mid-turn can be selected; refreshes when a turn ends |
| Settings › Workflows | Still FlagGatedPage (hidden / "not available"; no page mounts) — unchanged from #505 | Loads the index as before |
Hook: apps/control-plane/web/src/components/workflows/use-workspace-workflows.ts (reads useFlag("workflows")). Tests: use-workspace-workflows.test.tsx.
See also Troubleshooting — feature_disabled loop on /workflows, Admin Feature Flags.