Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(python): add README and restructure module layout

Steven Enamakelf2bab867c6dd
diff --git a/crates/openhuman-core/src/runtime/python/README.md b/crates/openhuman-core/src/runtime/python/README.md
index b2cfb0d9b6..424b22062d 100644
--- a/crates/openhuman-core/src/runtime/python/README.md
+++ b/crates/openhuman-core/src/runtime/python/README.md
@@ -1,7 +1,6 @@
# runtime/python
-The **Python interpreter client**, plus the process-launch helper for the
-long-lived Python children this core owns.
+The **Python interpreter client**.
## What moved out
@@ -11,27 +10,17 @@ selection, download, digest verification, extraction, atomic install,
cross-process install locking) are all in the `tinyruntime` module now, reached
through [`modules::runtime`](../../modules/runtime.rs).
-## What stayed, and why
-
-`process.rs` launches stdio Python children: the runtime Python server, and the
-stdio MCP servers. That is deliberately **not** the module's pooled execution:
-those children outlive a single job, speak their own protocols, and are owned by
-the subsystem that started them. The module resolves the interpreter; this core
-decides what to run with it.
-
## Key files
| File | Role |
| --- | --- |
| `mod.rs` | Export-focused: submodule decls and `pub use` re-exports. |
-| `bootstrap.rs` | The interpreter client. `PythonBootstrap` (`resolve`, `probe_installed`, `try_cached`, `spawn_stdio`), `ResolvedPython`, `PythonSource`. |
-| `process.rs` | `PythonLaunchSpec` and `spawn_stdio_process`: unbuffered stdio (`-u`), piped fds, `kill_on_drop`, and the Windows no-console flag. |
+| `bootstrap.rs` | The interpreter client. `PythonBootstrap` (`resolve`, `probe_installed`, `try_cached`), `ResolvedPython`, `PythonSource`. |
## Public surface
`PythonBootstrap::new(Arc<Config>)`, `.resolve() -> Result<ResolvedPython>`,
-`.probe_installed()`, `.try_cached()`,
-`.spawn_stdio(&PythonLaunchSpec) -> Result<tokio::process::Child>`, plus
+`.probe_installed()`, `.try_cached()`, plus
`ResolvedPython` (`python_bin`, `bin_dir`, `version`, `source`) and
`PythonSource`.
@@ -46,16 +35,12 @@ This module reads `config.runtime_python` (`enabled`, `prefer_system`,
- `crate::modules::runtime`: the module client this delegates to.
- `crate::config`: the settings each request carries.
-- `crate::inference::host_runtime::process_util`: the Windows no-console
- hook, shared with the other child-spawning paths.
External crates: `tinyruntime-bus`, `tokio`, `anyhow`, `tracing`. No HTTP
client, no archive crates, no `walkdir`, no `fs2`: those went with the pipeline.
## Used by
-- `crates/openhuman-core/src/runtime/python_server/`: resolves an interpreter, then spawns
- and supervises the long-lived model server with `spawn_stdio`.
- `crates/openhuman-core/src/tools/impl/system/{python_exec,shell}.rs`: hold an
`Arc<PythonBootstrap>`; `python_exec` calls `resolve()`, `shell` uses the
non-blocking `try_cached()` for `PATH` injection.
@@ -73,6 +58,5 @@ client, no archive crates, no `walkdir`, no `fs2`: those went with the pipeline.
- **The local cache is not redundant with the module's.** Only this one can
answer without awaiting, which is what lets the shell inject `PATH` without
blocking on a bus round trip.
-- **`spawn_stdio` is not pooled execution.** It exists for children that outlive
- a job. Inline Python code goes through `runtime::pool::python` instead, which
- routes to the module's warm workers.
+- Inline Python code goes through `runtime::pool::python`, which routes to the
+ module's warm workers.
diff --git a/crates/openhuman-core/src/runtime/python/mod.rs b/crates/openhuman-core/src/runtime/python/mod.rs
index 70fe16c24f..53e2ea4cc1 100644
--- a/crates/openhuman-core/src/runtime/python/mod.rs
+++ b/crates/openhuman-core/src/runtime/python/mod.rs
@@ -3,14 +3,7 @@
//! [`bootstrap`] is the client for the `tinyruntime` module: it asks for an
//! interpreter and adapts the answer. Discovery, selection, download, and
//! install all live in the module now.
-//!
-//! [`process`] stays here because it is not runtime management. It launches the
-//! long-lived stdio children this core owns — the runtime Python server, and the
-//! stdio MCP servers — which outlive a single job and speak their own protocols.
-//! The module resolves the interpreter; this core decides what to run with it.
pub mod bootstrap;
-pub mod process;
pub use bootstrap::{PythonBootstrap, PythonSource, ResolvedPython};
-pub use process::PythonLaunchSpec;
diff --git a/crates/openhuman-core/src/runtime/python/process.rs b/crates/openhuman-core/src/runtime/python/process.rs
deleted file mode 100644
index 0669f707da..0000000000
--- a/crates/openhuman-core/src/runtime/python/process.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-//! Python child-process launch helpers.
-//!
-//! Uses unbuffered stdio (`-u`) by default so line-oriented protocols such as
-//! MCP do not stall behind Python's output buffering.
-
-use std::collections::BTreeMap;
-use std::path::PathBuf;
-
-/// Launch spec for a Python stdio subprocess.
-#[derive(Debug, Clone)]
-pub struct PythonLaunchSpec {
- /// Absolute or caller-resolved path to the Python script.
- pub script_path: PathBuf,
- /// Positional arguments forwarded after the script path.
- pub args: Vec<String>,
- /// Optional working directory for the child process.
- pub cwd: Option<PathBuf>,
- /// Extra environment variables to set on the child process.
- pub env: BTreeMap<String, String>,
- /// Whether to pass `-u` for unbuffered stdio. Defaults to `true`.
- pub unbuffered: bool,
-}
-
-impl PythonLaunchSpec {
- pub fn new(script_path: PathBuf) -> Self {
- Self {
- script_path,
- args: Vec::new(),
- cwd: None,
- env: BTreeMap::new(),
- unbuffered: true,
- }
- }
-}
-
-#[cfg(test)]
-#[path = "process_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/runtime/python/process_tests.rs b/crates/openhuman-core/src/runtime/python/process_tests.rs
deleted file mode 100644
index 00d340a7f4..0000000000
--- a/crates/openhuman-core/src/runtime/python/process_tests.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-use super::*;
-use crate::runtime::python::bootstrap::PythonSource;
-
-// `apply_no_window` is a no-op off Windows, but exercising the spawn path
-// end-to-end keeps the GH-4814 CREATE_NO_WINDOW hook covered. `/bin/cat
-// <file>` prints the file and exits, so it stands in for the python child.