runspec
Write runspec.toml. Get a real CLI. Your CLI is also an agent tool.
A single TOML interface specification for anything runnable. Define your
arguments once, get a fully validated CLI with --help, structured logging,
and MCP-ready tool schemas — without writing argument-parsing code.
runspec 0.11.0 (Python) · runspec-node 0.10.0
Install
pip install runspec
Requires Python 3.10+. Zero runtime dependencies on Python 3.11+; on 3.10
the only dependency is the tomli backport.
npm install runspec-node
Requires Node 18+. One runtime dependency: smol-toml (TOML parsing).
Define your interface
Put runspec.toml inside your package directory, alongside the code it
describes. The same file works for both languages:
# greet/runspec.toml
[greet]
description = "Greet someone from the command line"
autonomy = "autonomous"
[greet.args]
name = {type = "str"}
loud = {default = false}
times = {default = 1}
The section name [greet] is what users type on the command line. Your entry
point name must match — that's how runspec links the spec to your code.
Use it in your runnable
from runspec import parse
def main():
args = parse()
message = f"Hello, {args.name}!"
if args.loud:
message = message.upper()
for _ in range(args.times):
print(message)
import { parse } from 'runspec-node';
function main(): void {
const args = parse();
let message = `Hello, ${args.name}!`;
if (args.loud) message = message.toUpperCase();
for (let i = 0; i < (args.times as number); i++) console.log(message);
}
main();
That's it. runspec handles the rest.
What you get
For developers building a CLI:
--helpgenerated from your spec — no help text written- Type coercion — args arrive as native types, no casting
- Validation — missing required args, bad choices, out-of-range values surface as clean, human-first errors
- Inference —
typeandrequiredare inferred from defaults andoptionswhere possible - Subcommands and groups — exclusive, inclusive, at-least-one, exactly-one, conditional
- Built-in
--debugflag, file rotation, sensitive-data redaction — just add[config.logging]; see Logging runspec initscaffolds a complete project —pyproject.toml, package layout, a working code stub
For agent tooling (free):
- MCP / OpenAI / Anthropic tool schemas —
runspec local --format mcp - Live MCP stdio server —
runspec serveexposes every installed runnable as an agent tool - Autonomy control — declare
autonomous/confirm/supervised/manualper runnable or per argument - Remote execution —
runspec jumpruns tools on[config.jump-hosts]over SSH+MCP; see Jump Hosts
Built with runspec
Both runspec and runspec-node define their own CLI in runspec.toml. The
help output you get from runspec --help, the argument validation, the
schemas at runspec local --format mcp — all of it goes through the same
parser your CLI uses. The bundled specs live at:
packages/python/runspec/runspec/runspec.tomlpackages/node/src/runspec.toml
See CLI Reference for the full command surface and a walkthrough of the dogfooding.
Next
- Quickstart — zero to a working CLI in five minutes
- Format Reference — every field, every option
- Python Library —
parse(),RunSpec,Arg, custom types - Node Library —
parse(),ParsedArgs,getLogger, custom types - CLI Reference —
runspec init,local,serve,jump - Logging —
[config.logging], rotation, redaction, extras - Agent Integration — MCP schemas, autonomy, agent-aware output
- Jump Hosts — remote execution over SSH+MCP