TKR: Tierkreis CLI Tool¶
Tierkreis includes a comprehensive command-line interface to manage workflows, workers, and other aspects of your project. This document provides a complete reference for all available commands and options.
Overview¶
The main tkr command has three primary subcommands:
init— Initialize and manage Tierkreis project resourcesrun— Execute workflow graphsserve— View persisted workflows without executing them
Use --help on any of the commands for a quick overview, or consult the sections below for detailed information about each command.
tkr init¶
Initialize and manage Tierkreis project resources. The init command has three subcommands: project, worker, and stubs.
tkr init project¶
Sets up a new Tierkreis project and manages project-wide options. Make sure to set up a Python project first using uv init.
Usage:
uv run tkr init project [OPTIONS]
Description: This command initializes the directory structure for a Tierkreis project, including directories for graphs and workers. You can customize the default locations for these resources.
Options:
Option |
Type |
Default |
Description |
|---|---|---|---|
|
PATH |
|
Root directory for the project |
|
PATH |
|
Location where workflow graphs are stored |
|
PATH |
|
Location where worker implementations are stored |
|
PATH |
|
Where workflow checkpoints are saved. Also sets the |
Examples:
# Initialize with default directories
uv run tkr init project
# Use custom directories
uv run tkr init project \
--project-directory ./my-project \
--graphs-directory ./my-graphs \
--worker-directory ./my-workers
# Set a custom checkpoint directory
uv run tkr init project \
--default-checkpoint-directory /data/checkpoints
# Persist checkpoint directory (add to shell config file, e.g., ~/.bashrc or ~/.zshrc)
export TKR_DIR=/data/checkpoints
tkr init worker¶
Generate a new worker template. Workers are independent units that provide tasks to graphs.
Usage:
uv run tkr init worker -n WORKER_NAME [OPTIONS]
Description:
Creates a new worker with boilerplate code.
By default, it generates a Python worker with a fixed project structure.
Use --external to generate an example typespec file instead for non-Python workers.
Options:
Option |
Type |
Default |
Description |
|---|---|---|---|
|
STRING |
— |
Name of the worker to create |
|
PATH |
|
Override the default worker directory |
|
FLAG |
False |
Generate an external (non-Python) worker with IDL file |
Examples:
# Create a Python worker
uv run tkr init worker -n my-worker
# Create with custom directory
uv run tkr init worker -n alternative-worker --worker-directory ./custom_workers
# Create an external (non-Python) worker
uv run tkr init worker -n external-worker --external
tkr init stubs¶
Generate the API files for workers using uv.
The APIs provide the task names during graph construction
Usage:
uv run tkr init stubs [OPTIONS]
Description:
Scans the worker directory and generates python stub files (api.py) for type hints and IDE autocomplete.
This is required after creating or modifying worker interfaces.
Options:
Option |
Type |
Default |
Description |
|---|---|---|---|
|
PATH |
|
Directory to search for workers |
|
PATH |
|
Output location for generated API stubs (relative to worker directory) |
Warning
Changing the api file name might break your worker. Use only when appropriate.
Examples:
# Generate stubs with defaults
uv run tkr init stubs
# Generate stubs for workers in custom directory
uv run tkr init stubs --worker-directory ./custom_workers
tkr run¶
Execute a workflow graph with specified inputs and configuration.
Usage:
uv run tkr run [OPTIONS]
Description:
Runs a Tierkreis workflow graph. By default, it loads the graph from ./tkr/graphs/main.py:workflow and reads inputs from workflow_inputs.json.
You can specify a different graph location or load from a JSON file, and provide inputs either as a JSON file or as binary files with key-value pairs.
Use --profile NAME to select a resource profile for named execution contexts.
Without this option, the runtime’s default profile selection is preserved.
Use --timeout SECONDS to change the completion wait limit (default: 30 seconds);
the value is an integer number of seconds. A wait timeout does not cancel the run.
Pending telemetry is flushed before the CLI exits, including after failures.
uv run tkr run -g my_project.graphs.he:workflow -i he_input.json \
--config runtime.toml --profile local --timeout 86400 -o
Graph Specification:
You can specify the graph in two ways:
Module path (default):
module.path:function_nameExample:
examples.hello_world:hello_graphExample:
./my_graphs/workflow.py:my_workflow
Serialized graph file: Use
-f/--from-fileto load a graph
Input Specification:
You can provide inputs in two ways:
JSON file (default): A single
.jsonfile containing input values
Example:
workflow_inputs.jsone.g.
{ "value": 1 }
Binary files: Key-value pairs where
keyis the input port name andpathis a file containing binary data
Example:
port1:input1 port2:input2e.g.input1contains
b"1"
Options:
Option |
Type |
Default |
Description |
|---|---|---|---|
|
STRING |
|
Load graph from Python module or file |
|
PATH |
— |
Load a serialized graph from a file |
|
LIST |
|
One JSON file, |
|
FLAG |
False |
Print the outputs of the top-level graph node |
|
STRING |
— |
Workflow name (for identification in logs) |
|
PATH |
discovered default |
Runtime TOML configuration |
|
{CRITICAL, FATAL, ERROR, WARN, WARNING, INFO, DEBUG, NOTSET} |
WARNING |
Set logging level |
|
FLAG |
False |
Enable verbose output |
Installed subprocess workers are discovered as tkr-<worker-name>-worker.
Alternative commands, executors, asset stores, and resource profiles belong in
the runtime configuration; see Executors.
Examples:
# Run with all defaults
uv run tkr run
# Loads from ./tkr/graphs/main.py:workflow and workflow_inputs.json
# Print outputs to console
uv run tkr run -o
# Same as above but displays the workflow outputs
# Run a specific graph
uv run tkr run -g my_module.workflows:main_workflow
# Load graph from file
uv run tkr run -f my_graph.json
# Provide custom inputs as files containing binary values e.g. b"5"
uv run tkr run -i value:input count:count
# Run with custom configuration
uv run tkr run \
-g examples.quantum:circuit \
-i inputs.json \
--config ./tierkreis.toml \
--name "quantum-run-001" \
-o -v
What happens:
The graph is loaded from the specified location
Inputs are loaded from the specified files
The graph is saved and executed by the Rust runtime
If
-ois specified, outputs are printed to consoleState and assets are stored according to the runtime configuration
tkr serve¶
View persisted Tierkreis workflows without starting or resuming execution.
Usage:
uv run tkr serve [OPTIONS]
Description:
Launches the Rust visualization server using the discovered runtime configuration.
The server opens the configured persistent SQLite database and asset storage;
it does not initialize executors or run the orchestrator. In-memory runtime
state is rejected because it cannot contain persisted runs. An explicit
runtime_state.url takes precedence over DATABASE_URL, matching tkr run.
Relative configuration paths resolve from the current working directory.
Options:
Option |
Type |
Description |
|---|---|---|
|
IP ADDRESS |
Bind address; defaults to |
|
INTEGER |
HTTP port; defaults to |
|
PATH |
Runtime TOML file; defaults to standard configuration discovery |
|
FLAG |
Show help message |
Examples:
# Start the visualization server (interactive web UI)
uv run tkr serve
# Use an explicit configuration and port
uv run tkr serve --config runtime.toml --port 3001
# Bind on a coordinator's network interface (secure access externally)
uv run tkr serve --host 0.0.0.0
Access the UI:
After running uv run tkr serve, the server starts at http://localhost:3000.
Open this URL in your web browser to access the visualization.
The viewer has no authentication; use loopback binding or an authenticated tunnel.
More info on the visualizer page.