run_step
Execute a pipeline step's script as a subprocess and automatically record params, command, logs, exit status, duration, and metrics for reproducible ML runs.
Instructions
Execute a step's script as a subprocess and record it as a run automatically.
Params are passed as CLI flags when the script uses argparse/click (or positionally for sys.argv scripts, or
key=value for hydra), and always as $MLTREE_PARAMS (JSON). Records params, script snapshot, command, exit status,
duration, log (.mltree/runs//log.txt) and metrics from MLTREE_METRIC name=value stdout lines or a JSON file
written to $MLTREE_METRICS_FILE / a declared metrics*.json output. Returns the run and the end of its log.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"step": "<step>"
},
"name": "run_step"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| step | Yes | Step to execute (its script_path is run with Python from the project root) | |
| wait | No | Wait for the run to finish (up to timeout_s) | |
| params | No | Params for this run; default: the last run's params, else the step's | |
| timeout_s | No | Max seconds to wait; the run keeps going after that | |
| extra_args | No | Extra command-line arguments appended verbatim | |
| parent_run_id | No | Run this one branches from (default: newest succeeded run of an upstream step) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||