Skip to main content

CLI Overview

The warp-md CLI is designed for AI agents first. Every command returns structured JSON output with stable exit codes, making it easy to integrate into automated workflows.

Command Structure

warp-md provides three types of commands:
warp-md <command> [options]              # Utility commands
warp-md run <config>                     # Config-based batch analysis
warp-md <analysis> --topology --traj ... # Single analysis commands

JSON Envelope Contract

All analysis commands (both run and single-analysis) emit JSON envelopes to stdout with a stable structure:

Success Envelope

{
  "schema_version": "warp-md.agent.v1",
  "status": "ok",
  "exit_code": 0,
  "run_id": "example-run",
  "output_dir": "outputs",
  "system": {"path": "topology.pdb"},
  "trajectory": {"path": "traj.xtc"},
  "analysis_count": 2,
  "started_at": "2026-03-03T10:00:00Z",
  "finished_at": "2026-03-03T10:05:30Z",
  "elapsed_ms": 330000,
  "warnings": [],
  "results": [
    {
      "analysis": "rg",
      "out": "outputs/rg.npz",
      "status": "ok",
      "device": "cuda:0",
      "chunk_frames": 500,
      "timing_ms": 1234,
      "artifact": {
        "path": "outputs/rg.npz",
        "format": "npz",
        "size_bytes": 4096
      }
    }
  ]
}

Error Envelope

{
  "schema_version": "warp-md.agent.v1",
  "status": "error",
  "exit_code": 3,
  "run_id": null,
  "output_dir": null,
  "system": null,
  "trajectory": null,
  "analysis_count": 0,
  "started_at": "2026-03-03T10:00:00Z",
  "finished_at": "2026-03-03T10:00:01Z",
  "elapsed_ms": 1000,
  "warnings": [],
  "results": [],
  "error": {
    "code": "E_ANALYSIS_SPEC",
    "message": "rdf.sel_a selection is required",
    "context": {"analysis": "rdf", "index": 0},
    "details": [
      {
        "type": "value_error",
        "field": "analyses.0.sel_a",
        "message": "rdf.sel_a selection is required"
      }
    ]
  }
}
schema_version
string
required
Schema version identifier (currently warp-md.agent.v1)
status
string
required
Execution status: ok, dry_run, or error
exit_code
integer
required
Exit code (0 = success, 2 = config validation, 3 = analysis spec, 4 = runtime, 5 = internal)
results
array
required
Array of completed analysis results with output paths and metadata
error
object
Error details (only present when status is error)

Exit Codes

CodeNameMeaning
0_EXIT_OKSuccess
2_EXIT_CONFIG_VALIDATIONConfig file validation failed
3_EXIT_ANALYSIS_SPECAnalysis specification error
4_EXIT_RUNTIME_EXECRuntime execution error
5_EXIT_INTERNALInternal error

Error Codes

CodeExit CodeMeaning
E_CONFIG_LOAD2Failed to load config file
E_CONFIG_VALIDATION2Config validation failed (schema mismatch)
E_ANALYSIS_UNKNOWN3Unknown analysis name
E_ANALYSIS_SPEC3Invalid analysis parameters
E_SYSTEM_LOAD4Failed to load topology/system
E_TRAJECTORY_LOAD4Failed to load trajectory
E_RUNTIME_EXEC4Analysis execution failed
E_OUTPUT_DIR4Failed to create output directory
E_ATLAS_FETCH4ATLAS download failed
E_INTERNAL5Internal/unexpected error

Config File Format

warp-md config files can be JSON or YAML:

Minimal Config

{
  "version": "warp-md.agent.v1",
  "system": {"path": "topology.pdb"},
  "trajectory": {"path": "traj.xtc"},
  "output_dir": "outputs",
  "analyses": [
    {"name": "rg", "selection": "protein"}
  ]
}

Full Config

{
  "version": "warp-md.agent.v1",
  "run_id": "prod-run-001",
  "system": {
    "path": "system.pdb",
    "format": "pdb"
  },
  "trajectory": {
    "path": "traj.xtc",
    "format": "xtc",
    "length_scale": 10.0
  },
  "device": "cuda:0",
  "chunk_frames": 500,
  "stream": "ndjson",
  "output_dir": "outputs",
  "analyses": [
    {
      "name": "rg",
      "selection": "protein",
      "mass_weighted": false,
      "out": "outputs/rg.npz"
    },
    {
      "name": "rmsd",
      "selection": "backbone",
      "reference": "topology",
      "align": true,
      "device": "cpu",
      "chunk_frames": 1000
    }
  ]
}
version
string
required
Schema version (use warp-md.agent.v1)
run_id
string
Optional run identifier for tracking
system
string | object
required
Topology file path or {path, format} object
trajectory
string | object
required
Trajectory file path or {path, format, length_scale} object
device
string
default:"auto"
Compute device: auto, cpu, cuda, or cuda:0
chunk_frames
integer
Default frames per processing chunk
stream
string
default:"none"
Streaming mode: none or ndjson
output_dir
string
required
Directory for output files
analyses
array
required
List of analysis specifications

Streaming Mode (NDJSON)

When --stream ndjson is enabled, warp-md emits real-time progress events to stdout (one JSON object per line):
warp-md run config.json --stream ndjson

Event Types

run_started
{"event": "run_started", "run_id": "example", "analysis_count": 3, "completed": 0, "total": 3, "progress_pct": 0.0}
analysis_started
{"event": "analysis_started", "index": 0, "analysis": "rg", "out": "outputs/rg.npz"}
analysis_completed
{"event": "analysis_completed", "index": 0, "analysis": "rg", "status": "ok", "timing_ms": 1234, "progress_pct": 33.333, "eta_ms": 2468}
run_completed
{"event": "run_completed", "final_envelope": {...}}
run_failed / analysis_failed
{"event": "run_failed", "final_envelope": {"status": "error", ...}}

Discovery Commands

Discovery commands help agents introspect available analyses and schemas:
# List available analyses
warp-md list-plans
warp-md list-plans --json
warp-md list-plans --format json --details

# Show config schema
warp-md schema --kind request
warp-md schema --kind result
warp-md schema --kind event

# Generate example config
warp-md example

# List water models
warp-md water-models --json

Usage Examples

Single Analysis

warp-md rg --topology protein.pdb --traj traj.xtc --selection "protein" --out rg.npz
Output:
{
  "status": "ok",
  "exit_code": 0,
  "results": [{"analysis": "rg", "out": "rg.npz", "status": "ok"}]
}

Batch Analysis with Streaming

warp-md run config.json --stream ndjson 2>progress.log
Stderr receives NDJSON events, stdout receives final envelope.

Dry Run

warp-md run config.json --dry-run
Validates config and shows what would run without executing analyses.

Debug Mode

warp-md rg --topology top.pdb --traj traj.xtc --selection "invalid" --debug-errors
Includes Python traceback in error envelope for debugging.

warp-md Command Reference

Complete reference for all warp-md commands and analysis types

warp-pack Reference

Molecule packing utility reference

warp-pep Reference

Peptide builder and mutation tool reference

Build docs developers (and LLMs) love