Skip to main content
Glama

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.

Input Schema

NameRequiredDescriptionDefault
stepYesStep to execute (its script_path is run with Python from the project root)
waitNoWait for the run to finish (up to timeout_s)
paramsNoParams for this run; default: the last run's params, else the step's
timeout_sNoMax seconds to wait; the run keeps going after that
extra_argsNoExtra command-line arguments appended verbatim
parent_run_idNoRun this one branches from (default: newest succeeded run of an upstream step)

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.8.0

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full load and does well: it discloses that arbitrary script code is executed as a subprocess, that params are injected three different ways plus $MLTREE_PARAMS, and exactly what gets persisted (params, script snapshot, command, exit status, duration, log path, metrics). It does not state whether a run record is still written when the script fails or whether execution mutates project state beyond recording, which keeps it from a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core action is front-loaded in sentence one, and the following clauses are dense but information-bearing rather than filler. The long parenthetical enumerating param-passing styles is slightly cramped reading but not wasteful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 6-param mutating execution tool with no annotations, the description covers the mechanism, the side effects recorded, the log and metrics conventions, and even summarizes the return value (the run plus the tail of its log) despite an output schema existing. An agent has enough to call it correctly without opening anything else.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description genuinely adds semantics the schema lacks: it explains how `params` is transformed per script framework (argparse/click flags, positional sys.argv, hydra key=value, always $MLTREE_PARAMS JSON) and how metrics are detected from stdout or $MLTREE_METRICS_FILE. The remaining params (wait, timeout_s, extra_args, parent_run_id) are already well documented in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence gives a specific verb and resource: 'Execute a step's script as a subprocess and record it as a run automatically.' An agent knows exactly what happens (subprocess execution plus automatic run recording). It does not, however, explicitly contrast itself with nearby siblings like run_sweep or cancel_run, so it falls short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied by the mechanics described (params get passed as CLI flags, which presupposes a script that accepts arguments), but the description never states when to choose run_step over run_sweep, or what preconditions exist (step must exist, project must be initialized). No exclusions or alternatives are named.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.