Skip to main content
The LarkCI CLI lets you create workflows, invoke them, poll for results, and retrieve execution logs from your terminal or CI pipeline.

Installation

Requires Node.js 18 or later. Run directly with npx:
npx -y larkci@latest workflows invoke --all --wait
Or install globally:
npm install -g larkci@latest

Authentication

Set your API key as an environment variable:
export LARKCI_API_KEY=your-api-key
The CLI also supports a .env file in the current directory. You can pass the key inline with the --api-key flag on any command. Get your API key from the dashboard.

Global options

FlagDescription
--api-key <key>API key (overrides the LARKCI_API_KEY env var)
-V, --versionDisplay the CLI version
-h, --helpDisplay help for any command

Commands

Create a workflow

larkci workflows create --name "login-flow" --description "Test the login process end-to-end"
FlagRequiredDescriptionDefault
--name <name>YesWorkflow name
--description <text>YesWorkflow description
--mode <mode>Noai_driven or deterministicai_driven
--secret-contexts <names...>NoSecret contexts to attach
larkci workflows create \
  --name "checkout-flow" \
  --description "Test the full checkout process" \
  --mode deterministic \
  --secret-contexts production staging

Archive a workflow

larkci workflows archive <workflow_id>
Archived workflows are hidden from the default list and cannot be invoked until unarchived.

Unarchive a workflow

larkci workflows unarchive <workflow_id>
Restores an archived workflow so it appears in the list and can be invoked again.

List workflows

larkci workflows list
FlagDescriptionDefault
--limit <n>Max workflows to return (1–100)10
--offset <n>Number of workflows to skip0

Invoke workflows

Run one or more workflows and optionally wait for them to finish. Either --workflow-ids or --all is required.
larkci workflows invoke --all --wait --timeout 300
larkci workflows invoke --workflow-ids wf_abc123 wf_def456 --wait --timeout 300
FlagDescription
--workflow-ids <ids...>IDs of the workflows to invoke
--allInvoke all workflows
--waitBlock until every execution finishes
--timeout <seconds>Maximum wait time in seconds (default: 600, requires --wait)
--verbosePrint verbose output including logs

Exit codes

CodeMeaning
0All workflows passed
1One or more workflows failed
2Timed out waiting for results
3Unexpected error

List executions

larkci workflows executions list <workflow_id>
FlagDescriptionDefault
--limit <n>Max executions to return (1–100)10
--offset <n>Number of executions to skip0

Get execution details

larkci workflows executions get <workflow_id> <execution_id>

Get execution logs

larkci workflows executions logs <workflow_id> <execution_id>

Cancel a running execution

larkci workflows executions cancel <workflow_id> <execution_id>

List secret contexts

larkci secret-contexts list
Returns all secret context names and metadata for your account. Does not return secret values.

Get a secret context

larkci secret-contexts get <context>
Returns the context name and the list of key names stored in it. Does not return secret values.

Create or replace a secret context

larkci secret-contexts create --context production --secret username=admin --secret password=s3cret
FlagRequiredDescription
--context <name>YesName of the secret context
--secret <key=value>YesSecret key-value pair (repeat for multiple values)
larkci secret-contexts create \
  --context staging \
  --secret api_key=sk_test_abc123 \
  --secret username=testuser \
  --secret password=testpass

Delete a secret context

larkci secret-contexts delete <context>
Deletes a secret context. Workflows referencing it lose access.

Examples

# Create a workflow
larkci workflows create --name "signup-flow" --description "Test user signup"

# List your workflows
larkci workflows list --limit 20

# Archive a workflow
larkci workflows archive wf_abc123

# Unarchive a workflow
larkci workflows unarchive wf_abc123

# Invoke a workflow without waiting
larkci workflows invoke --workflow-ids wf_abc123

# Invoke and wait with a 5-minute timeout
larkci workflows invoke --workflow-ids wf_abc123 --wait --timeout 300

# Invoke all workflows and wait with verbose logs
larkci workflows invoke --all --wait --verbose

# List recent executions
larkci workflows executions list wf_abc123

# Check execution status
larkci workflows executions get wf_abc123 exec_xyz789

# Fetch execution logs
larkci workflows executions logs wf_abc123 exec_xyz789

# Cancel a running execution
larkci workflows executions cancel wf_abc123 exec_xyz789

# Override API key inline
larkci --api-key sk-test-key workflows invoke --workflow-ids wf_abc123

# Store credentials for a secret context
larkci secret-contexts create --context production --secret username=admin --secret password=s3cret

# List all secret contexts
larkci secret-contexts list

# View the keys stored in a secret context
larkci secret-contexts get production

# Delete a secret context
larkci secret-contexts delete production

CI pipeline usage

The --wait flag makes the CLI well-suited for CI pipelines. The command blocks until every workflow finishes and exits with a non-zero code on failure. For full CI setup instructions, see CI integration.