Workflows (beta)
A workflow is automation in Kenso: one trigger, a list of steps and limits. With the CLI you keep a workflow as a JSON file in your folder or repo: write it, check it, push it to the draft, test the draft, publish the version you tested, and run it on records with a credit cap and a results file.
The commands are beta: they show where your workspace has the workflows feature. Help hides them until your workspace has it; kenso --help --all-commands shows them. kenso workflows test and kenso workflows run also need workflows_runtime. Without it test stops with runtime_off (exit 4), "Workflows cannot run in this workspace yet.", with no retry, and a run that kenso workflows run starts stays queued, which --wait reports at its timeout.
| Command | What it does |
|---|---|
workflows init [name] | Write a new workflow file, blank or from a template, and a kenso.json |
workflows pull <workflowId> | Write a saved workflow's definition to a file and bind the file |
workflows check <file> | Validate the file and estimate one record; saves nothing |
workflows push <file> | Create the workflow or save the file to its draft; with --publish, publish it |
workflows test <file> | Run the saved draft once on one record |
workflows diff <file> | Compare the file with the published version or the draft |
workflows schema | Print a JSON Schema for workflow files, for editors |
workflows run <file or id> | Run the published workflow on ids or a CSV, estimate first |
workflow-runs logs <runId> | One row per step of a run: status, credits, error |
The other workflow commands are generated from the API, one per route: kenso workflows publish, unpublish, get and list, kenso workflow-versions, kenso workflow-runs list, get, cancel, restart, retry and replay, kenso workflow-templates and kenso workflow-step-types. kenso <command> --help shows their flags.
The file
A workflow file is one JSON object in the kenWorkflow: "1" format, named <name>.workflow.json:
{
"kenWorkflow": "1",
"name": "Qualify accounts",
"description": "Scores each account against a simple ICP.",
"trigger": { "type": "trigger.manual@1", "with": { "recordType": "account" } },
"steps": [
{ "id": "qualify", "type": "ai.qualify@1", "with": { "criteria": "B2B SaaS, 50+ people", "tier": "cheap" } }
],
"limits": { "creditsPerMonth": 100, "creditsPerRun": 5, "runsPerDay": 50, "atLimit": "ask" }
}The format (trigger, steps, references, formulas, limits) is the workflows skill's references/definition-format.md. kenso workflows schema prints a JSON Schema (draft 2020-12) of the file with each step type's inputs, for an editor, offline; the server's validate stays the authority. kenso workflow-step-types get prints one step type's inputs and an example.
kenso workflows schema --out workflow.schema.json
kenso workflow-step-types get --type ai.qualify@1
kenso mcp call load_skill --args '{"name":"workflows","reference":"references/definition-format.md"}'kenso.json
kenso.json binds workflow files to workflow ids and pins the folder's workspace. init, pull and push write it; you rarely edit it by hand.
{
"workspaceId": "3047",
"profile": "client-a",
"workflows": { "workflows/qualify.workflow.json": 412 }
}- All three keys are optional.
workspaceIdis a string of digits.profileis a profile name.workflowsmaps a path relative tokenso.json(forward slashes) to a workflow id. One file holds one workflow and one workflow is bound to one file: binding a second isalready_bound(exit 7). Other keys are kept when the CLI rewrites the file. - The CLI looks for it from the current folder up to the first folder that holds
.git, else up to your home folder, never above it; for a command given a file, from that file's folder. It skips akenso.jsonanother user owns, or that anyone can write or sits in a folder anyone can write (such as/tmp): another user could have put it there to pick your workspace. A skipped file is named on stderr, andinit,pull,pushorrunon a workflow file beside it stops withfolder_file_untrusted(exit 2) instead of reading or writing over its bindings. Some mounts show every file as anyone's to write (WSL/mnt/c, SMB, exFAT): keep workflow files on a Linux folder there. - The workspace is
--workspace, elseKENSO_WORKSPACE_ID, elsekenso.json, else the profile's. The profile is--profile, elseKENSO_PROFILE, elsekenso.json, else the active profile.kenso.jsonnever changes the API URL or the key. - A file command run in another workspace than the one
kenso.jsonnames stops withworkspace_mismatch(exit 2): its workflow ids belong to that workspace. - It never holds a key or an API URL. A file with
apiKey,key,token, a value starting withkenso_, orapiUrlisfolder_file_invalid(exit 2), "kenso.json never holds a key or an API URL: remove <name>.", and nothing reads it. Invalid JSON, or a key of the wrong type, is the same error with the path and the key. kenso whoamiandkenso auth statusprintworkspaceSource(flag,env,folder,profileornone) and, forfolder,folderFile.
kenso whoami -o jsonThe first run
From a template to records:
kenso workflow-templates list
kenso workflows init qualify --template <templateKey>
kenso workflows push qualify.workflow.json
kenso workflows check qualify.workflow.json --mode publish
kenso workflows test qualify.workflow.json --record account:<accountId>
kenso workflows push qualify.workflow.json --publish --expected-hash <definitionHash>
kenso workflows run qualify.workflow.json --ids ids.txt --dry-run
kenso workflows run qualify.workflow.json --ids ids.txt --max-credits 10 --yesFill the template's <fill in: ...> placeholders and set limits in the file before the first push. check --mode publish names everything publish would refuse, with a fix for each issue.
The commands
init
kenso workflows init qualify --template <templateKey> --dir workflowsWrites <name>.workflow.json: the template's definition with --template, else a blank definition with trigger.manual@1 and no steps. Writes kenso.json with the resolved workspace when no folder file is found. It never replaces a file (file_exists, exit 7), sends no request without --template, and creates nothing in Kenso. Prints {file, template, folderFile, folderFileCreated, workspaceId}.
pull
kenso workflows pull 412 --out qualify.workflow.jsonWrites the draft's definition (else the published one; --published takes the published one) to --out or <slug of the name>.workflow.json, with 2-space indents and a final newline, and binds the file in kenso.json. An existing file is replaced only when kenso.json binds it to this workflow (else file_exists, exit 7). When the workflow is bound to another file already, the new file is an unbound copy. Prints {file, workflowId, draftVersion, draftHash, publishedHash, status}.
check
kenso workflows check qualify.workflow.json --mode publishSends the file as the definition to validate (saving nothing) and to the estimate for one record. Prints {valid, issues, perRecord, draftHash, inSync, next}: each issue has path, code, message, fix and severity; perRecord is {expectedCredits, maxCredits}; draftHash is the saved draft's hash, and inSync says whether the file equals that draft. Exit 0 when valid, 5 when not. --mode draft (the default) checks structure, schemas, references and formulas; --mode publish also checks limits, secrets and connected apps. An unbound file is workflow_not_bound (exit 2), "check needs a workflow id: a draft runs nothing and costs nothing.", with next: kenso workflows push <file>.
push
kenso workflows push qualify.workflow.json --note "Raise the size floor"
kenso workflows push qualify.workflow.json --dry-runAn unbound file creates the workflow and binds the file. A bound file is saved to the draft when it differs from it, on top of the draft version just read; an identical file saves nothing. Prints {workflowId, saved, draftVersion, draftHash, published, status, next}. --dry-run prints wouldSend: which of create, update and publish it would send. --publish publishes after the save, and --expected-hash goes with it (see The hash rule).
test
kenso workflows test qualify.workflow.json --record account:<accountId> --wait 50Runs the saved draft once on one record: --record <type:id> (person:812; the types are account, person, lead and place), else the newest record of the trigger's type. --wait is the seconds the API waits for the run, 0 to 50 (50 by default). AI and data steps run for real and are charged; sends and CRM writes are simulated. A file that differs from the draft is refused (draft_out_of_sync, exit 7, next: kenso workflows push <file>). Prints {testPassed, timedOut, definitionHash, publishPassRecorded, run: {id, status, creditsCharged}, hint, next}; after a pass, next is the publish command with --expected-hash <definitionHash>. Exit 1 when the test did not pass.
diff
kenso workflows diff qualify.workflow.json --against draftCompares the file with the published version (the default; the draft when nothing is published) or with the draft. Prints {against, same, nameChanged, triggerChanged, limitsChanged, stepsAdded, stepsRemoved, stepsChanged} with step ids. Exit 0 either way.
schema
kenso workflows schema --out workflow.schema.jsonPrints, or writes to --out, the JSON Schema of a workflow file. It needs no sign-in and no network, and --out replaces only a schema it wrote.
The hash rule
definitionHash is computed by the server for a saved draft and leaves plain out; the CLI never computes one. When the CLI compares a file with a saved definition, it compares them as JSON with keys sorted at every level: whitespace and key order never count.
- Publish needs a passed test on the draft's hash. Without one the CLI stops with
test_required(exit 7), "Publish needs a passed test on this exact draft.", andnext: kenso workflows test <file>. --expected-hash <hash>makes push compare the draft's hash after the save with the value. A mismatch ishash_mismatch(exit 7), "The draft's hash is <actual>, not <expected>.", and nothing is published; the saved draft stays. Pass the hashkenso workflows testprinted.- Under a coding agent,
--publishwithout--expected-hashis refused (usage_error, "an agent publishes only the version it tested: pass --expected-hash"). A person at a terminal may publish without it. - The gap. The publish route takes no hash, so a save that lands between the CLI's hash check and the publish call can be published. The server's
version_conflicton a concurrent save and its rule that publish needs a passed test bound it. - A save that meets a newer draft is
version_conflict(exit 7), "Someone saved this workflow since you read it.", withnext: kenso workflows diff <file> --against draft. - A definition the server refuses on save or publish is
invalid_definition(exit 5) with its issues (path,code,message); on a publish,nextiskenso workflows check <file> --mode publish, which adds afixto each.
Run on records
kenso accounts list --limit 50 -o ids > ids.txt
kenso workflows run qualify.workflow.json --ids ids.txt --dry-run
kenso workflows run qualify.workflow.json --ids ids.txt --max-credits 10 --wait --out results.csv --yes
kenso workflows run 412 --file people.csv --record-type person --dry-run- Target. A number is a workflow id. A file must be bound in
kenso.jsonand equal to the published version, elseunpublished_changes(exit 7), "This file differs from the published version.", withnextnaming the push that publishes it (with--expected-hashwhen the saved draft holds the file). A workflow that is not live isinvalid_state(exit 7) withnext: kenso workflows publish --workflow-id <id>. Nothing publishes by itself. - Record type is the trigger's (
trigger.manual@1takes itswith.recordType);--record-type(account,person,leadorplace) overrides it. A trigger that names no record type needs the flag (not_runnable_on_records, exit 2). - Input.
--idsis one id per line (-reads stdin).--fileis a CSV: with anidcolumn, those ids; without one and with record typeperson, each row is matched or created as a person in chunks of 200, with the columnskenso people importaccepts and no email finding. Any other record type without anidcolumn isids_required(exit 2), which nameskenso contacts importorkenso accounts import. Duplicated ids run once. A saved list runs through a workflow whose trigger istrigger.saved_list@1ortrigger.csv@1;--listis not a flag. - Dry run.
--dry-run, and a run without--yes, estimate per chunk of up to 1,000 records, start nothing, and print{dryRun, workflowId, records, recordType, credits: {needed, available, sufficient}, perRecord, expectedCredits, cap, next}.neededis the estimate's maximum andavailablethe workspace's balance. A value that could not be read isnull, and the plan addsestimateErrororbalanceErrorwith the reason. A CSV without ids is estimated on its row count and creates no person. - Confirmation. Without
--yes, a person at a terminal is asked once with the plan on screen. Under a coding agent the command prints the plan and stops, withnextnaming the same command with--yes. --max-credits <n>is enforced by the CLI; the server is sent no cap. The ceiling per record is the definition'slimits.creditsPerRunwhen set (cap.kind: "hard"), else the estimate's maximum per record (cap.kind: "estimate"). The CLI starts the firstfloor(n / ceiling)records and reports the rest asnot_startedwith reasonover --max-credits. The plan and the summary printcap: {maxCredits, kind, perRecord, willStart, notStarted}. A cap below one record's ceiling starts nothing:cap_too_low(exit 6), withnextnaming the smallest cap that starts one record. A workspace out of credits starts nothing either (out_of_credits, exit 6).--waitfollows each started run, up to 8 reads at a time, until it leavesqueued,runningandwaiting, or--timeout(90s, 10m, 1h; default 30m) passes. A run stillwaitingat the timeout is reported aswaiting.--timeoutgoes with--wait.--out <results.csv>(needs--wait) writes one row per input record when the batch ends:row, id, status, runId, runStatus, creditsCharged, missReason, error, then one column per step id holding that step's output as compact JSON. The path is checked before the first request: its folder must exist, and an existing file is refused (file_exists, exit 7) unless it is this run's own.- Summary. One JSON object with
records,started,deduplicated,notStarted,succeeded,failed,waiting,missed(reason to count),creditsCharged("pending"without--waitor while runs are open),cap,resultsCsv,appUrl(the workflow's page in the app, in the run's workspace:https://app.ken.so/<workspaceId>/workflows/<id>) andnext, and the same counts on one stderr line. With--wait, a run that failed makesnextitskenso workflow-runs logs <runId>. - Never twice. A run is known by its input file's content, the workflow it resolves to and the workspace, not by how the command was typed:
ids.txt,./ids.txtand a copy of the file are one input, and so are a bound file and its workflow id. The same run again starts nothing and answers from the finished run's folder withalreadyDone: true; with--waitand--outit reads that run's runs and writes the results file. A run on that input that would start records differently (another--max-credits, or a people file whose matches changed) is refused withalready_started(exit 7) once the earlier run sent starts:not-started.txtin its folder holds the ids it did not start, andnextruns only those. A run on that input that another kenso process is running now isrun_in_progress(exit 7).
The run folder
Each applied run writes a run folder (~/.kenso/runs/<id>) that records every chunk's response, as every batch command does: see Batch runs. kenso runs resume <runId> never resends a chunk it has an answer for. A chunk that was sent and has no recorded answer is not resent either: resume stops with chunk_outcome_unknown (exit 5), the chunk's first and last row, and next: kenso workflow-runs list --workflow-id <id> --created-after <chunk start time>, so you can see what started.
kenso runs resume <runId>
kenso workflow-runs list --workflow-id 412 --created-after 2026-11-21T10:00:00ZRead a run
kenso workflow-runs logs <runId>
kenso workflow-runs logs <runId> --step qualify --fullOne row per step run in start order: {nodeId, stepType, status, attempt, startedAt, endedAt, ms, credits, error}, NDJSON when piped. --step keeps one node; --full adds each step's input, output and attempts. A header line on stderr gives the run's status, workflow, record and the credits it charged, and needs attention: <reason> when one is set. A failed run ends with next: kenso workflow-runs restart --run-id <id> --dry-run, because retry refuses a run that has ended.
Step outputs are kept 7 days
A succeeded run's step outputs are dropped 7 days after it finishes, unless the workflow keeps success details. --out writes them when the batch ends, so run with --wait --out when you need the results later.
Exit codes
| Exit | When |
|---|---|
| 0 | Done. For run, every record started and, with --wait, none failed |
| 1 | test: the test did not pass |
| 2 | Usage: workflow_not_bound, folder_file_invalid, folder_file_untrusted, workspace_mismatch, not_runnable_on_records, ids_required, or --publish without --expected-hash under a coding agent |
| 4 | test: runtime_off, the workspace cannot run workflows yet |
| 5 | check found the file not valid, the server refused a definition (invalid_definition), run has records that failed, were not found or were not started, or resume met chunk_outcome_unknown |
| 6 | run: the cap started nothing (cap_too_low), or the workspace is out of credits |
| 7 | A conflict: file_exists, already_bound, draft_out_of_sync, hash_mismatch, test_required, version_conflict, unpublished_changes, invalid_state, an existing --out file, or a run on an input an earlier run started (already_started) or another process is running (run_in_progress) |
Every error is one JSON line on stderr with code, message, hint and next: see Output and errors.