Skip to content
GitHub (opens in a new tab)
AgentsScreen

Workflow builder

Build one workflow top to bottom: trigger, agents, actions, conditions and approvals.

What a screen is

A screen is a whole page exported from the kit, built only from kit components and tokens. Import it once, pass your data and callbacks, and render it as the page: it brings its own nav and <main>, and its loading and empty states are built in. A pattern is the copy-in version you own and change; a block is one area that sits inside your <main>.

When to use

  • people build or edit an automation that mixes a trigger, agents, actions, conditions, waits and approvals
  • the flow is a list from top to bottom with Yes and No paths, not a free-form canvas
  • you want the whole page done, with test run, needs setup, empty, loading and read-only, and only need to pass data and callbacks

When not to use

  • one agent run step by step after it ran — RunDetail or RunHandoffsScreen
  • an agent's plan for one task, to approve or change — PlanReviewScreen
  • a list of every workflow — compose a Table or ListView in a page
  • a free-form graph with loops and many joins — this screen only draws a list with Condition paths

Usage

One workflow's builder on one page: a trigger, agents, actions, conditions, waits and approvals, top to bottom. Add steps from the library or the + between steps, open one to set it up in the inspector, and move it with Move up and Move down or Alt+arrows. A Condition splits into Yes and No paths side by side. Each step says Configured, Needs setup or Error in a Badge with a word, and a warning Alert jumps to the steps that stop Publish. Test run shows the results step by step. Import it once and pass the workflow and your callbacks. Loading, a new workflow, read-only Live workflows and phones come with it.

<WorkflowBuilderScreen workflow={workflow} selectedStepId={stepId} onSelectStep={setStepId} onChange={save} onPublish={publish} onTestRun={startTest} testRun={testRun} onAction={(action, id) => handle(action, id)} onNavigate={(to, detail) => go(to, detail)} workspace={{ name: "Northwind" }} user={{ name: "Alex Morgan", email: "alex@northwind.example" }} />
import { WorkflowBuilderScreen } from "agentic-ds-kit";

export default function WorkflowPage({ workflow, testRun, loading }) {
  // The screen renders its own app nav and <main>: don't wrap it in another main.
  return (
    <WorkflowBuilderScreen
      workflow={workflow}                      // { id, name, status, savedAt, steps: [...] }
      loading={loading}
      readOnly={workflow.status === "live"}    // Live workflows are view only
      onChange={(next) => saveDraft(next)}     // every add, move, delete and field edit
      onPublish={() => publish(workflow.id)}
      onTestRun={() => startTest(workflow.id)}
      testRun={testRun}                        // { status, runId?, steps: [{ stepId, status, duration?, detail? }] }
      onAction={(action, id) => {
        if (action === "delete") deleteWorkflow(id);
        else if (action === "duplicate") duplicateWorkflow(id);
        else if (action === "version-history") openHistory(id);
      }}
      onNavigate={(to, detail) => {
        if (to === "run") router.push(`/runs/${detail.runId}`);                     // Run / Handoffs
        else if (to === "agent-permissions") router.push(`/agents/${detail.agentId}/permissions`);
        else router.push(`/${to}`);
      }}
      workspace={{ name: "Northwind" }}
      user={{ name: "Alex Morgan", email: "alex@northwind.example" }}
    />
  );
}

Props

WorkflowBuilderScreen props, from the screen contract.
PropTypeDefaultNotes
workflowobject—{ id, name, status: "draft" | "live" | "paused", savedAt, savedLabel?, steps: { id, type: "trigger" | "agent" | "action" | "logic", kind, name, summary?, status: "configured" | "needs-setup" | "error", error?, config?: Record<string, string | boolean>, permission?: "ask" | "risk" | "tell" | "run", branches?: { id, label, outcome: "yes" | "no", steps }[] }[] } The main path top to bottom; the first step is the trigger. kind is one of invoice-overdue, payment-failed, schedule (triggers), dunning, collections, refunds (agents), send-email, create-task, update-customer (actions), condition, wait, approval (logic). config keys by kind: days, segment; source, minAmount; cadence, time; instructions, notify (agents); to, template; title, assignee; field, value; field, operator, value; days, businessDays; approver, note. summary left out is written from config. savedAt is ISO 8601; savedLabel is the relative words, like 2 min ago. The screen keeps its own edits until this prop changes. Sample Northwind Failed payment recovery when omitted.
selectedStepIdstring—The step open in the inspector. Left out, the screen keeps it, with none open first. null closes it.
onSelectStepfunction—(id | null) => void. Configure on a step, a new step, a validation or test run jump, or null when the inspector closes.
onChangefunction—(workflow) => void. Every edit: a step added from the library or a + insert point, moved, duplicated, deleted or renamed, a field or permission changed. A step whose required fields are empty turns needs-setup; filled, configured. Save it and pass it back.
onPublishfunction—() => void. Publish when nothing needs setup. Otherwise Publish opens the first step that needs setup and a kit Toast says how many are left.
onTestRunfunction—() => void. Test run opens the test run panel; start a test and pass its progress as testRun.
onActionfunction—(action, id) => void. action is "duplicate" | "version-history" | "delete" from the header menu with the workflow id (delete after the AlertDialog), or "delete-step" with the step id after its AlertDialog.
onNavigatefunction—(destination, detail?) => void. destination is an app nav row ("overview" | "agents" | "runs" | "workflows" | "tools"), "workflows" from the breadcrumb, "agent-permissions" ({ agentId }: the step's agent kind) from an agent step, or "run" ({ runId }) from the test run's Open in Run / Handoffs.
validationarray—{ stepId, message }[] The steps that stop Publish, with what to do. Left out, every step whose status is not configured is listed with its error. Shown as a warning Alert (n steps need setup) with Set up next, which opens each step in turn, and Show all, which lists them under the Alert; each row opens its step.
testRunobject—{ status: "running" | "waiting" | "passed" | "failed", runId?, steps: { stepId, status: "done" | "running" | "approval" | "pending" | "failed", duration?, detail? }[] } The test run's results on the path it took, in order. Set or changed, the test run panel opens: an Alert with the outcome and an AgentTrail of the steps. runId shows Open in Run / Handoffs. The connectors on the path it took so far take the brand colour.
workspaceobject—{ name: string, icon?: KitIcon } App nav brand. Same shape as SettingsPreferencesScreen. Example workspace when omitted.
userobject—{ name: string, email?: string, src?: string } Account menu at the foot of the app nav (kit DropdownMenu: the avatar on the rail, the account card in the Drawer, both with src as the photo and an online presence mark; the menu holds View profile, Account settings, Documentation, Switch account with a sample second account, Add account and Sign out, all samples that only close the menu except Account settings, which goes to a Settings row when the screen has one). Same shape as SettingsPreferencesScreen. Example person when omitted.
loadingbooleanfalseThe header stays (Test run, Publish and the menu disabled); the library and the flow are Skeletons; main is aria-busy.
readOnlybooleanfalseView only, for a Live workflow: an info Alert says so, the library, insert points, step menus, Publish and Delete step go, Configure reads View and the inspector fields are disabled.
classNamestring—On the root layout-shell.

States

  • page: default, loading, empty, detail-open, needs-attention, test-run, live
  • step: configured (Badge Configured, success tone, CircleCheck), needs setup (Badge Needs setup, warning tone, CircleDashed; what is missing in words on the card), error (Badge Error, danger tone, CircleAlert; the reason in words on the card and a danger Alert in the inspector), selected (a brand ring, Configure pressed and aria-current=step)
  • workflow: draft (Badge Draft, neutral tone, FilePen), live (Badge Live, success tone, CirclePlay; read-only), paused (Badge Paused, neutral tone, CirclePause)
  • path: yes (Badge Yes, success tone, Check, then the path's label, above its column), no (Badge No, neutral tone, X, then the path's label, above its column), connector: a stem from the Condition card to a node, then a line that splits and drops into each path with rounded elbows; on the path a test run took, the brand colour (border-brand); aria-hidden
  • layout: library, flow and inspector side by side (--grid-breakpoint-lg and wider), flow and inspector; the library opens in a left Drawer from Step library (below --grid-breakpoint-lg), the flow alone; the nav, the library and the inspector or test run open in Drawers (below --grid-breakpoint-md), a Condition's paths stack when the flow column is narrower than about 38rem (layout-split); each path then gets a straight drop instead of the split

Accessibility

  • Renders its own main landmark named Workflow builder: the workflow name; the app nav is an aside named App. Don't wrap the screen in another main
  • PageHeader title is the page h1
  • The flow is an ordered list named with the workflow and its step count; each step's eyebrow says Step n and its type, and branch steps are in their own ordered list named Yes path or No path with the path's label
  • Each panel has an h2 in its header bar: Steps with the step count, Flow: the workflow name with the step and branch counts, and the open step's name (or Test run, or Step settings) with Close
  • Connector lines and the node are aria-hidden: the ordered lists and the path names carry the structure
  • Insert points are menu buttons named Add step after the step (after both paths for a Condition), or Add step to the Yes or No path when it is empty
  • Configure is named Configure and the step name, is aria-pressed when its step is open, and the open step's list item has aria-current=step
  • Alt+Up arrow and Alt+Down arrow move the focused step within its list; Move up and Move down are also in the step menu. Focus stays on the step and a polite live region says where it went
  • Opening a step moves focus to the inspector heading; closing it returns focus to that step's Configure. Below --grid-breakpoint-md the inspector is a kit Drawer
  • Status is a word beside an icon in a Badge, and needs setup and errors say what is wrong in words; never colour alone
  • Delete step and Delete workflow ask first in a kit AlertDialog
  • Adds, duplicates and deletes are said in a kit Toast (role=status, polite)
  • loading sets aria-busy on main
  • No motion of its own

Responsive

  • Wide (--grid-breakpoint-lg and wider): the app nav on the canvas, then layout-workspace--start-rail with three framed panels --grid-gutter-md apart: the library (--layout-sidebar), the flow (its canvas scrolls under its header bar; cards up to --grid-width-sm, centred) and the inspector (--layout-rail); each panel body scrolls on its own
  • Below --grid-breakpoint-lg: the library opens in a left kit Drawer from Step library in the flow's header bar, and the inspector panel shows only with a step or the test run open
  • Below --grid-breakpoint-md: the nav opens from an IconButton named Menu, and the inspector and test run open in a right Drawer that fills the screen below --grid-breakpoint-sm; the flow stays one column
  • A Condition's paths sit side by side (layout-split) and stack when the flow column is narrow
  • Dark mode follows the root theme; semantic tokens only

Do not

  • Do not copy the screen's parts into a local cousin; change it through its props or compose the kit pieces yourself
  • Do not wrap it in an app shell or another main
  • Do not add a second solid primary Button; Publish is the only one
  • Do not show a step's status by colour alone
  • Do not add a drag library or a free-form canvas; steps move with Move up, Move down and Alt+arrows
  • Do not use raw hex

Built from

  • Block
    →

    Run detail

    One agent run on one screen: clock, cost, pending approval and every step, all following the step you pick.

  • Screen
    →

    Run / Handoffs

    One multi-agent run as a whole page: a lane per agent, the handoffs between them, and the approval that needs you.

  • Screen
    →

    Plan review

    Approve an agent's plan before it runs, step by step, as a whole page.

  • Component
    →

    Table

    Simple semantic table for invoices, lists, and text rows, with optional sort, row menu, sticky header, loading, empty and error states, row dividers on or off, and one optional highlighted row.