Current persistent tasks started with an empty workspace, which blocked the first useful host-to-task workflow in the task roadmap. This change lets task creation start from a host directory or tar archive without changing the one-shot VM surfaces. Expose source_path on task create across the CLI, SDK, and MCP, add safe archive upload and extraction support for guest and host-compat backends, persist workspace_seed metadata, and patch the per-task rootfs with the bundled guest agent before boot so seeded guest tasks work without republishing environments. Also switch post--- command reconstruction to shlex.join() so documented sh -lc task examples preserve argument boundaries. Validation: - uv lock - UV_CACHE_DIR=.uv-cache uv run pytest --no-cov tests/test_vm_guest.py tests/test_vm_manager.py tests/test_cli.py tests/test_api.py tests/test_server.py tests/test_public_contract.py - UV_CACHE_DIR=.uv-cache make check - UV_CACHE_DIR=.uv-cache make dist-check - real guest-backed smoke: task create --source-path, task exec -- cat note.txt, task delete
4.8 KiB
4.8 KiB
Public Contract
This document defines the supported public interface for pyro-mcp 2.x.
Package Identity
- Distribution name:
pyro-mcp - Public executable:
pyro - Public Python import:
from pyro_mcp import Pyro - Public package-level factory:
from pyro_mcp import create_server
CLI Contract
Top-level commands:
pyro env listpyro env pullpyro env inspectpyro env prunepyro mcp servepyro runpyro task createpyro task execpyro task statuspyro task logspyro task deletepyro doctorpyro demopyro demo ollama
Stable pyro run interface:
- positional environment name
--vcpu-count--mem-mib--timeout-seconds--ttl-seconds--network--allow-host-compat--json
Behavioral guarantees:
pyro run <environment> -- <command>defaults to1 vCPU / 1024 MiB.pyro runfails if guest boot or guest exec is unavailable unless--allow-host-compatis set.pyro run,pyro env list,pyro env pull,pyro env inspect,pyro env prune, andpyro doctorare human-readable by default and return structured JSON with--json.pyro demo ollamaprints log lines plus a final summary line.pyro task createauto-starts a persistent workspace.pyro task create --source-path PATHseeds/workspacefrom a host directory or a local.tar/.tar.gz/.tgzarchive before the task is returned.pyro task execruns in the persistent/workspacefor that task and does not auto-clean.pyro task logsreturns persisted command history for that task untilpyro task delete.- Task create/status results expose
workspace_seedmetadata describing how/workspacewas initialized.
Python SDK Contract
Primary facade:
Pyro
Supported public entrypoints:
create_server()Pyro.create_server()Pyro.list_environments()Pyro.pull_environment(environment)Pyro.inspect_environment(environment)Pyro.prune_environments()Pyro.create_vm(...)Pyro.create_task(...)Pyro.start_vm(vm_id)Pyro.exec_vm(vm_id, *, command, timeout_seconds=30)Pyro.exec_task(task_id, *, command, timeout_seconds=30)Pyro.stop_vm(vm_id)Pyro.delete_vm(vm_id)Pyro.delete_task(task_id)Pyro.status_vm(vm_id)Pyro.status_task(task_id)Pyro.logs_task(task_id)Pyro.network_info_vm(vm_id)Pyro.reap_expired()Pyro.run_in_vm(...)
Stable public method names:
create_server()list_environments()pull_environment(environment)inspect_environment(environment)prune_environments()create_vm(...)create_task(...)start_vm(vm_id)exec_vm(vm_id, *, command, timeout_seconds=30)exec_task(task_id, *, command, timeout_seconds=30)stop_vm(vm_id)delete_vm(vm_id)delete_task(task_id)status_vm(vm_id)status_task(task_id)logs_task(task_id)network_info_vm(vm_id)reap_expired()run_in_vm(...)
Behavioral defaults:
Pyro.create_vm(...)andPyro.run_in_vm(...)default tovcpu_count=1andmem_mib=1024.Pyro.create_task(...)defaults tovcpu_count=1andmem_mib=1024.allow_host_compatdefaults toFalseoncreate_vm(...)andrun_in_vm(...).allow_host_compatdefaults toFalseoncreate_task(...).Pyro.create_task(..., source_path=...)seeds/workspacefrom a host directory or a local.tar/.tar.gz/.tgzarchive before the task is returned.Pyro.exec_vm(...)runs one command and auto-cleans that VM after the exec completes.Pyro.exec_task(...)runs one command in the persistent task workspace and leaves the task alive.
MCP Contract
Primary tool:
vm_run
Advanced lifecycle tools:
vm_list_environmentsvm_createvm_startvm_execvm_stopvm_deletevm_statusvm_network_infovm_reap_expired
Task workspace tools:
task_createtask_exectask_statustask_logstask_delete
Behavioral defaults:
vm_runandvm_createdefault tovcpu_count=1andmem_mib=1024.task_createdefaults tovcpu_count=1andmem_mib=1024.vm_runandvm_createexposeallow_host_compat, which defaults tofalse.task_createexposesallow_host_compat, which defaults tofalse.task_createaccepts optionalsource_pathand seeds/workspacefrom a host directory or a local.tar/.tar.gz/.tgzarchive before the task is returned.vm_execruns one command and auto-cleans that VM after the exec completes.task_execruns one command in a persistent/workspaceand leaves the task alive.
Versioning Rule
pyro-mcpuses SemVer.- Environment names are stable identifiers in the shipped catalog.
- Changing a public command name, public flag, public method name, public MCP tool name, or required request field is a breaking change.