Skip to main content
Use the Kapso CLI to keep workflows and functions in a local repository. You can edit the generated definition.json directly, or use @kapso/workflows to author the workflow in JavaScript or TypeScript. The Platform API stores workflow definitions as JSON with snake_case config keys. The JavaScript library uses idiomatic camelCase inputs and compiles them to the same JSON shape before kapso push.

Start a local repo

kapso link binds the current directory to one Kapso project. kapso pull downloads source files for workflows and functions.

Repository layout

After pulling, the repo includes project binding metadata and one directory per source object.
Commit the files you want to version. Keep .kapso/remote-map.json in shared repos because it stores the last pulled remote state for dirty-file and stale-update checks.

Choose JSON or code

Both paths are supported:
  • Edit definition.json when you want the exact Platform API graph payload.
  • Edit workflow.js or workflow.ts when you want a boring code API for constructing the graph.
  • Keep or ignore generated definition.json as a team decision. The CLI works either way.
kapso pull creates workflow.js next to definition.json when no workflow source file exists. After you edit that source file, future pulls preserve it and update only the remote-owned JSON/YAML files.

Build with code

Build the workflow JSON before pushing:
If a pulled workflow.js file is unchanged, kapso push uses workflow.yaml and definition.json. Once you edit workflow.js or add workflow.ts, kapso push compiles that source before uploading.

Push changes

Preview changes before writing to Kapso:
Push one workflow:
Push one function:
Push everything in the local repo:
Workflows and functions are matched by slug. If a remote object with the same slug exists but your repo does not have a pull baseline, run kapso pull first.

Node reference

Each node has a stable id, a type, and optional display/position options. Edges reference node IDs.
The table below shows the library shape and the Platform API node_type. Use rawConfig on typed nodes when you need an extra Platform API field that the library has not modeled yet:

References by slug

Local source should use stable slugs where possible:
  • Function nodes use functionSlug.
  • Function decision nodes use functionSlug.
  • Agent function tools use functionSlug.
  • Call workflow nodes use workflowSlug.
During kapso push, the CLI resolves those slugs to remote IDs before calling the Platform API. Direct Platform API requests should use function_id and workflow_id.

API definition shape

A workflow definition is a graph:
When using the Platform API directly:
  • Use snake_case config keys.
  • Use GET /workflows/{workflow_id}/definition to read the expanded graph.
  • Use PATCH /workflows/{workflow_id} to update metadata and graph collections.
  • Include the latest lock_version to avoid overwriting remote changes.
  • The update response returns workflow metadata, not the expanded definition. Refetch the definition when you need the saved graph.
Example update:
Inside definition, nodes and edges are replacement sets when present. If you send only one node in definition.nodes, every other node is removed. Omit definition.nodes or definition.edges when you want that collection to remain unchanged.

Sync behavior

The CLI protects local and remote work during sync:
  • kapso pull refuses to overwrite dirty local remote-owned files.
  • kapso pull --diff shows blocked incoming diffs without writing files.
  • kapso pull --overwrite replaces local edits in remote-owned files with the remote version.
  • kapso pull preserves authored workflow.js and workflow.ts files.
  • kapso push checks the last pulled remote version before updating existing objects.
  • Remote-only workflows and functions are reported, not deleted.
  • Local-only workflows and functions are created on push.

Build with AI

The setup block above installs the Kapso agent skills. For AI-assisted edits, point your coding assistant at the workflow directory and ask it to edit workflow.js or workflow.ts. Kapso docs are available to AI tools through the MCP endpoint: