Skip to main content
This is the canonical workflow manual. The API is experimental. Read the execution contracts for current persistence, visibility, and compatibility guarantees.

Purpose and scope

An EDSL workflow coordinates work performed by people, language-model agents, or a mixture of both. It decides who receives each task, when a task becomes available, which earlier answers it may observe, how results are combined, and what happens after failures or restarts. The workflow layer is deliberately separate from delivery. Humanize can create private surveys, send invitations, and collect responses. A simulated inbox can deliver the same work to EDSL agents. The workflow coordinator remains the authority that decides what becomes ready next. This manual describes the implementation in edsl.workflows. It covers:
  • dependency graphs and work-item lifecycles;
  • participant selection, fan-out, and fan-in;
  • typed answer, output, and submission references;
  • serializable conditions and deterministic derived values;
  • bounded repeat blocks;
  • visibility and anonymity boundaries;
  • shared-state reads and writes;
  • human delivery and LLM simulation;
  • durable retries, leases, and process recovery;
  • SQLite persistence and DAG visualization; and
  • reusable design patterns and current limitations.
The workflow API is experimental. The serialized form and behavior described here are the current implementation, not a promise of permanent compatibility. The detailed recovery, visibility, and migration guarantees are documented in Workflow and shared-state execution contracts.

CLI commands

The ep workflow namespace manages research-task gates. The respondent orchestration API described here has its own ep orchestration namespace. It accepts a portable WorkflowExperiment JSON file. Create the bundle in Python and save it with experiment.save("experiment.json"):
validate checks the workflow, participants, state maps, and executor bindings. inspect reports participants, steps, question names, dependencies, assignments, state-map IDs, and executor routing. Both commands return the standard JSON envelope and make no model calls. run requires an output directory. It writes the pinned experiment.json, workflow.sqlite, one SQLite file per state map, and completion.json when the run reaches a declared pause or completion. Start with a new output directory. For recovery, use the same experiment, output directory, and --instance-id with --resume; the default instance ID is experiment. The pinned definition must match the original run. Repeat --responses when resuming a replay-driven run. Omitting it on resume switches back to the configured executors and can make provider calls or leave human work without an answer source. Without --responses, configured LLM executors may call model providers. To replay answers without model calls, pass a JSON array like this (or wrap it in {"responses": [...]}):
Replay rows identify the workflow step and participant and provide that step’s answer object. Each assigned LLM or human task needs a matching row; scripted executors use the answers configured in the experiment. Human executors need replay rows because the CLI does not configure a Humanize delivery adapter. --instance-id selects the durable workflow instance, and --resume recovers an existing one. ep orchestration run --help lists every option. For real human participants, use start and sync. This mode currently requires every participant to resolve to the human executor and to have a non-empty email trait. start initializes a fresh run but sends no invites; sync dispatches ready Humanize surveys, imports completed responses, then dispatches any newly unlocked work:
Run sync again to collect later responses and send newly ready tasks. Configure Expected Parrot authentication before syncing. status reports item IDs, participants, step names, item states, and the event count. start requires a new or empty output directory and records a pinned experiment plus run manifest.

The central idea

A workflow turns a declarative graph into durable, respondent-specific work: The key invariant is:
Delivery systems do not decide workflow order. They deliver ready work and return answers. Only the coordinator evaluates dependencies and conditions.
This separation allows the same definition to run with real respondents during fieldwork and with LLM respondents during design, testing, and stress analysis.

Who performs the work?

The workflow definition says who is eligible for a step by selecting a participant role. It does not currently say whether that participant is a person or an LLM. That choice belongs to execution: This neutrality is useful: one serialized protocol can be rehearsed with LLMs and later deployed unchanged to people. It also means that diagrams in this manual mark the execution path, not a property embedded in HumanStep. Diagrams label human and simulated respondents explicitly. Performer routing is declared separately from the scientific workflow:
The plan round-trips through to_dict() and from_dict(), requires exactly one matching binding per participant, and lets WorkflowSimulation select distinct answerers by executor kind. Production still needs an adapter registry that dispatches the human bindings to Humanize and persists the resolved executor on each attempt. Step metadata may describe the intended performer for diagrams, but it is not the routing authority.

Waiting for optional work

Normal after= dependencies propagate a predecessor’s skip. Use after_settled= when a downstream step must wait for optional work but should still run if that work is skipped:
Both dependency modes wait for the predecessor to settle under its completion policy, including accepted responses still committing. A successful quorum supersedes outstanding unaccepted assignments; it is not a branch skip. Only after= propagates a genuine predecessor skip to the consumer.

A first workflow

Suppose one person proposes a weekend activity and a second person approves it.
The second task is not merely listed after the first in Python. Its serialized definition contains an explicit dependency on propose. The question also contains a typed reference to the proposal answer. Participants are ordinary EDSL agents whose traits determine their roles:

Launch and complete work

Use a SQLite store for durable local execution. A stable scientific seed makes workflow chance expressions reproducible independently of the generated instance ID.
An idempotency key identifies one immutable response. Repeating the same submission is safe; reusing the key with different content is an error. Inspect the completed instance and its assignments:
This walkthrough submits scripted answers locally; it makes no model or Humanize calls. Each launch() creates a new instance. The response keys include the work item ID, so rerunning the walkthrough in the same database is safe. To continue an existing instance after a restart, save its instance_id, reopen the same store, and restore and recover instead of calling launch() again.

Manual chapters