Skip to main content

kapi run

Run composed multi-tool flows or custom project flows. For single built-in tools, use the top-level tool commands directly (for example kapi translate, kapi exec qa).

Synopsis​

kapi run <flow-name> [flags]
kapi flows

Description​

kapi run executes a named multi-step pipeline. It reads a source, streams it through each tool, and writes the result to a sink.

  • Ad hoc, the sink is a file (-o).
  • Inside a project with no -o, the run is process-only: it commits results to the project store, and kapi merge writes the files.

Multiple input files can be processed in parallel. Use --explain to print the resolved source → sink without running.

Project-based flows: If a .kapi project exists (a kapi.yaml recipe found by walking up the tree), flows are loaded from inline flows: on the recipe and from the YAML files in the directory the recipe names with flows_dir:. This is the primary mode for the bowrain plugin.

Built-in composed flows: Multi-tool pipelines like translate-qa are available as built-in flows.

Single tools as top-level commands: Individual tools run directly as top-level commands: kapi translate, kapi pseudo-translate, kapi exec qa, kapi exec recycle, and so on.

Use kapi flows to see available flows, or kapi tools to see available tools.

Examples​

# Draft with AI (top-level tool command)
kapi translate -i input.html -o output.html --source-lang en --target-lang fr

# Draft then quality-check (composed flow)
kapi run translate-qa -i input.html -o output.html --source-lang en --target-lang fr

# Pseudo-translate for testing (top-level tool command)
kapi pseudo-translate input.html -o output.html --target-lang fr

# Process multiple files in parallel (top-level tool command)
kapi translate -i file1.html -i file2.html --source-lang en --target-lang fr -j 4

# Reuse from content memory (top-level tool command)
kapi exec recycle -i input.html -o output.html --source-lang en --target-lang fr

# Run quality checks (top-level tool command)
kapi exec qa -i translations.html -o check-report.html --target-lang fr

# Run a custom project flow
kapi run translate-review

# List available flows
kapi flows

# List available tools
kapi tools

Flags (kapi run)​

FlagShortDescription
--input-iInput file path(s); repeat for multiple files (required)
--output-oOutput file path (single-file mode); omit in a project for a process-only run to the store
--explainPrint the resolved source → sink bindings and exit without running
--format-fOverride input format detection
--encoding-eInput encoding (default: UTF-8)
--source-langSource language, BCP 47 (default: en)
--target-langTarget language, BCP 47 (required)
--concurrency-jMax parallel documents (0 = auto, 1 = sequential)
--providerAI provider; any the translate tool supports
--api-keyAPI key for the AI provider
--modelModel name
note

The --format, --encoding, --source-lang, and --target-lang flags are specific to kapi run and tool commands. They are not global flags.

Project-based flows​

In a project, create custom flows in a committed directory and name it in the recipe with flows_dir: flows:

# flows/translate-review.yaml
name: translate-review
description: Draft with AI then run the checks

steps:
- tool: translate
config:
provider: anthropic
model: claude-sonnet-5

- tool: qa
config:
checkDoubleSpaces: true
checkPatterns: true

- tool: term-check
config:
caseSensitive: false

The term step checks against the project's terms, which kapi store import reads into the project's store. --termstore overrides the terms store for a single run.

Run with:

kapi run translate-review

Project flows use the recipe's content collections and locale defaults, so you leave out --input, --output, --source-lang and --target-lang. A project run is process-only: results land in the project store, and kapi merge writes the target files.

Built-in composed flows​

Without a .kapi project, you can use built-in composed flows with explicit flags:

kapi run translate-qa -i input.html -o output.html --source-lang en --target-lang fr

Available built-in composed flows:

FlowDescription
translate-qaDraft then quality check with an AI provider
segmentationSplit source text into sentence segments

Top-level tool commands​

Single tools run directly as top-level commands:

CommandDescription
kapi translateDraft content with an AI provider
kapi pseudo-translateGenerate pseudo-translations for testing
kapi exec qaRun rule-based quality checks
kapi exec recyclePre-fill targets from content memory

Listing available tools​

kapi tools