Skip to content

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

docs: connect the hosted library recipe to TinyHumans

lord_Tyrion8f26e9025408
diff --git a/crates/openhuman-embed/README.md b/crates/openhuman-embed/README.md
index c36f711b09..7322fb9cb1 100644
--- a/crates/openhuman-embed/README.md
+++ b/crates/openhuman-embed/README.md
@@ -59,11 +59,22 @@ The library API. Initialize one runtime (features, services, backend URL,
the TinyHumans API key), then instantiate agents on it, each fully described
and independent of the others:
+For hosted TinyHumans inference and services, use
+[`openhuman_tinyhumans::RuntimeBuilder`](../openhuman-tinyhumans/README.md),
+which binds the backend transport during startup. The
+[minimal library recipe](../../docs/library-minimal-recipe.md) covers the
+dependency and feature selection. The plain embed builder supports standalone
+hosts with their own providers; hosted requests require an installed transport
+and otherwise return `BACKEND_UNAVAILABLE:`.
+
```rust,no_run
-use openhuman_embed::{Access, AgentSpec, McpServer, Provider, Runtime, Workspace};
+use openhuman_tinyhumans::{
+ embed::{Access, AgentSpec, McpServer, Provider, Workspace},
+ RuntimeBuilder,
+};
# async fn demo() -> Result<(), Box<dyn std::error::Error>> {
-let runtime = Runtime::builder()
+let runtime = RuntimeBuilder::new()
.workspace(Workspace::dir("/var/lib/my-product/openhuman"))
.api_key("th_live_…") // the only credential in library mode
.build()
@@ -245,7 +256,7 @@ are documented rather than hidden; each is a candidate follow-up in the core.
- `autonomy.auto_approve` / `auto_approve_all` and the memory guard's
autonomy tier come from the runtime's boot config (`security::live_policy`),
- not the agent's. Path and command policy *do* use the agent's own tier.
+ not the agent's. Path and command policy _do_ use the agent's own tier.
- The approval gate is on or off process-wide; parked approvals are not
labelled with the agent id. A per-agent "no approvals" is `Access::full()`,
whose `TrustedAutomation` origin the gate honours per turn.
@@ -259,7 +270,7 @@ are documented rather than hidden; each is a candidate follow-up in the core.
registry; `[[mcp_client.servers]]` declared through `AgentSpec::mcp` are
per agent. The host-seeded documentation server is visible to every agent.
- `install_skill` / `create_skill` still write to `~/.openhuman`. With
- `include_user_skills(false)` (the default) an agent does not *discover* the
+ `include_user_skills(false)` (the default) an agent does not _discover_ the
operator's skills, but an install by the agent lands there.
- One API key (or session) is shared by all agents.
- `IntegrationClient` (backend-proxied Composio/search/media tools) only
@@ -276,7 +287,7 @@ Other invariants worth knowing before wiring any entry point:
auth profiles and the keyring file resolve beside `config_path`, so a
workspace-only override reads the operator's real credentials. `Runtime`
and `Harness` set both for `Workspace::Ephemeral` and `Workspace::Dir`.
-- A turn runs under the access tier *and* the turn origin. `Access::full()`
+- A turn runs under the access tier _and_ the turn origin. `Access::full()`
sets both (`AutonomyLevel::Full` plus a `TrustedAutomation` origin);
`Access::readonly()` and `Access::supervised()` set no origin and leave the
approval gate on.
diff --git a/docs/library-minimal-recipe.md b/docs/library-minimal-recipe.md
index 9720d3aa30..bc60feb736 100644
--- a/docs/library-minimal-recipe.md
+++ b/docs/library-minimal-recipe.md
@@ -12,20 +12,32 @@ execution.**
## The build command
-Opencompany recipe (production embed — no benchmark/harness code):
+OpenCompany's hosted-backend recipe:
```bash
cargo build --release \
- -p openhuman-embed \
+ -p openhuman-tinyhumans \
--no-default-features --features "skills,flows"
```
+Use the same feature selection in the embedding application's manifest:
+
+```toml
+[dependencies]
+openhuman-tinyhumans = { git = "https://github.com/tinyhumansai/openhuman", default-features = false, features = ["skills", "flows"] }
+```
+
+`openhuman_tinyhumans::RuntimeBuilder` installs the SDK-backed transport and
+registers the hosted controllers when it builds the runtime. This connects the
+API key to managed inference, integrations, channel relay and cloud voice when
+their feature and runtime gates are enabled.
+
- To build the profiling harness against the same recipe, add the dev-only
`rss-bench` feature and the two bench bins:
```bash
cargo build --release \
- -p openhuman \
+ -p openhuman-cli \
--no-default-features --features "rss-bench,skills,flows" \
--bin library-profile --bin rss-bench
```
@@ -40,10 +52,13 @@ Cargo features **and** the runtime's `DomainSet` (the builder's default does)
if any agent will declare servers or skills.
```rust,no_run
-use openhuman_embed::{Access, AgentSpec, Runtime, Workspace};
+use openhuman_tinyhumans::{
+ embed::{Access, AgentSpec, Workspace},
+ RuntimeBuilder,
+};
# async fn demo() -> Result<(), Box<dyn std::error::Error>> {
-let runtime = Runtime::builder()
+let runtime = RuntimeBuilder::new()
.workspace(Workspace::dir("/var/lib/opencompany/openhuman"))
.api_key(std::env::var("TINYHUMANS_API_KEY")?)
.build()
@@ -58,52 +73,76 @@ println!("{}", worker.run("Start the job.").await?.reply);
# }
```
+### Choosing the backend layer
+
+Use `openhuman_tinyhumans::RuntimeBuilder` for a host that uses the hosted
+TinyHumans backend. The builder forwards the embedding options and binds the
+transport before startup, as shown in its [compiled quick-start
+example](../crates/openhuman-tinyhumans/src/lib.rs).
+
+Use `openhuman_embed::Runtime::builder()` for a standalone host with its own
+inference provider and local tools. Agent turns, local memory operations and
+enabled skills and flows remain available through their configured providers.
+An API key on that builder stores a credential; the host must also supply a
+backend transport to reach TinyHumans. Backend requests otherwise return
+`BACKEND_UNAVAILABLE:`, and the hosted `billing`, `team`, `referral` and
+`announcements` controllers are absent.
+
+For a connected host that manages its own RPC catalog, set
+`.hosted_controllers(false)` on the TinyHumans builder to skip hosted controller
+registration. `.domains(DomainSet::embedded())` keeps the `hosted` domain gate
+off, so it also excludes those controllers from dispatch. The backend transport
+still serves agent and integration requests in either configuration.
+
## Keep / drop table
-The single `default` list this session was written against no longer exists.
-There are two sets now (`crates/openhuman-core/README.md`, "Feature flags"): **Contrib** is
-`[features] default`, what a bare `cargo check` compiles; **Product** is
-`scripts/ci/product-features.txt`, what the desktop app ships. Both columns
-below are current. `desktop-automation` has since been removed from the tree
-altogether, hence the dashes; `tui` is in neither set.
-
-Note how much of this recipe the contributor set already gives you for free —
-`voice`, `web3`, `meet` and `tui` are default-OFF today. The Decision column
-still records what a **library host** wants, which is the thing this document
-is actually for.
-
-| Gate | Contrib | Product | Decision | Why | Deps shed |
-| --- | :---: | :---: | :---: | --- | --- |
-| `skills` | ON | ON | **KEEP** | python/js `SKILL.md` execution is a stated opencompany use case | none (surface/prompt/startup only) |
-| `flows` | ON | ON | **KEEP** | saved-workflow (`flows_create`+`flows_run`) runs are a stated use case | — (adds `tinyflows`, `jaq-*`, `rhai`; see cost note) |
-| `voice` | OFF | ON | **DROP** | STT/TTS/dictation/podcast — a headless host does no audio I/O | `hound`, `lettre` |
-| `web3` | OFF | ON | **DROP** | crypto wallet / swap / x402 machine payments — not an opencompany path | `bitcoin`, `curve25519-dalek` |
-| `media` | ON | ON | **DROP** | `media_generate_*` image/video tools — surface-only | none (backend-proxied) |
-| `meet` | OFF | ON | **DROP** | Google-Meet join/live-STT/TTS bot — no headless use | none |
-| `mcp` | ON | ON | **DROP** | MCP stdio/HTTP server + Smithery registry (~20k LOC, ~19 tools) — a library host is not an MCP host | none (hand-rolled over tokio/reqwest/axum) |
-| `desktop-automation` | — | — | **DROP** | AX / `computer` tool family drives a **local desktop UI** — meaningless headless | `uiautomation` |
-| `tui` | OFF | — | **DROP** | `openhuman tui`/`chat` terminal UI — no terminal in a library host | `ratatui`, `crossterm`, `unicode-width` |
-
-**Non-default optional features** (`browser-native`/`fantoccini`, `whatsapp-web`,
-`e2e-test-support`, `rss-bench`, `rss-bench-dhat`) are all default-OFF, so a
-`--no-default-features` build never links them unless explicitly added. None are
-needed for opencompany; `rss-bench`/`rss-bench-dhat` are dev/benchmark-only.
+The table below records the July 2026 recipe, before the backend extraction in
+#6362. **Contrib** refers to the recorded `[features] default` set; **Product**
+refers to the recorded desktop feature set. Use
+`crates/openhuman-core/README.md` and `scripts/ci/product-features.txt` for the
+current sets. The dashes reflect gates outside the recorded set.
+
+In that contributor set, `voice`, `web3`, `meet` and `tui` were default-OFF.
+The Decision column records the domains needed by the headless library host.
+
+| Gate | Contrib | Product | Decision | Why | Deps shed |
+| -------------------- | :-----: | :-----: | :------: | --------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
+| `skills` | ON | ON | **KEEP** | python/js `SKILL.md` execution is a stated opencompany use case | none (surface/prompt/startup only) |
+| `flows` | ON | ON | **KEEP** | saved-workflow (`flows_create`+`flows_run`) runs are a stated use case | — (adds `tinyflows`, `jaq-*`, `rhai`; see cost note) |
+| `voice` | OFF | ON | **DROP** | STT/TTS/dictation/podcast — a headless host does no audio I/O | `hound`, `lettre` |
+| `web3` | OFF | ON | **DROP** | crypto wallet / swap / x402 machine payments — not an opencompany path | `bitcoin`, `curve25519-dalek` |
+| `media` | ON | ON | **DROP** | `media_generate_*` image/video tools — surface-only | none (backend-proxied) |
+| `meet` | OFF | ON | **DROP** | Google-Meet join/live-STT/TTS bot — no headless use | none |
+| `mcp` | ON | ON | **DROP** | MCP stdio/HTTP server + Smithery registry (~20k LOC, ~19 tools) — a library host is not an MCP host | none (hand-rolled over tokio/reqwest/axum) |
+| `desktop-automation` | — | — | **DROP** | AX / `computer` tool family drives a **local desktop UI** — meaningless headless | `uiautomation` |
+| `tui` | OFF | — | **DROP** | `openhuman tui`/`chat` terminal UI — no terminal in a library host | `ratatui`, `crossterm`, `unicode-width` |
+
+The historical recipe also left optional `browser-native`/`fantoccini`,
+`whatsapp-web`, `e2e-test-support`, `rss-bench` and `rss-bench-dhat` off.
+Check the selected host crate's current feature list before adding optional
+domains. `rss-bench` and `rss-bench-dhat` remain development profiling features.
## Measured results
-All numbers gathered on this branch, Apple-Silicon macOS, `--release` profile
+These are historical measurements from the July 2026 feature-shed work,
+before the backend extraction in #6362. They describe the earlier core build;
+measure the current `openhuman-embed` and `openhuman-tinyhumans` builds separately
+when sizing a deployment. The hosted layer adds the SDK transport and hosted
+controllers, so these figures serve as a dated reference.
+
+All numbers were gathered on Apple-Silicon macOS, `--release` profile
(`optimized + debuginfo`). "default" = the prior 2026-07-21 session baselines in
[`docs/library-benchmarking.md`](library-benchmarking.md); "pure slim" =
`--no-default-features --features rss-bench` (drops everything). Both slim numbers
-were reproduced on this machine and match the prior doc exactly (68.4 MiB).
+matched the prior document's 68.4 MiB baseline in that measurement session.
### Binary size
-| Build | Features | Unstripped | Stripped |
-| --- | --- | ---: | ---: |
-| default | (all gates) | 115.9 MiB¹ | — |
+| Build | Features | Unstripped | Stripped |
+| ------------------- | -------------- | ------------: | ------------: |
+| default | (all gates) | 115.9 MiB¹ | — |
| **library-minimal** | `skills,flows` | **~81.1 MiB** | **~60.4 MiB** |
-| pure slim | (none) | 68.4 MiB | 51.0 MiB |
+| pure slim | (none) | 68.4 MiB | 51.0 MiB |
¹ from the prior session (unstripped, same profile). library-minimal bins measured
directly: `rss-bench` 81.1 MiB, `library-profile` 83.0 MiB unstripped (the extra
@@ -114,20 +153,20 @@ matches the `rss-bench` figure — the bench feature adds negligible code.
narrower code-paging surface (the dominant cold-turn RSS factor per the prior
session's executable-paging finding).
- **library-minimal vs pure slim: +12.7 MiB unstripped / +9.4 MiB stripped — all
- of it `flows`.** `cargo tree` confirms the delta is `rhai 1.25` + `rhai_codegen`
- + `jaq-core/std/json` + `tinyflows`; `skills` sheds **zero** deps (its value is
- tool-surface/prompt/startup, not size). `flows` is by far the most expensive
- domain we *keep* — see follow-up #2.
+ of it `flows`.** At the time, `cargo tree` attributed the delta to `rhai 1.25`,
+ `rhai_codegen`, `jaq-core/std/json` and `tinyflows`; `skills` shed **zero** deps
+ (its value is tool-surface/prompt/startup, not size). `flows` was the most
+ expensive retained domain — see follow-up #2.
### Per-scenario RSS (5 fresh-process repeats, median, `OPENHUMAN_PROFILE_FORCE_UTC=1`)
-| Scenario | minimal settled | minimal retained Δ | default settled² | default retained² | Δ settled |
-| --- | ---: | ---: | ---: | ---: | ---: |
-| `agent-turn` (cold, 1 turn) | 44.0 MiB | 26.6 MiB | 47.6 MiB | 29.5 MiB | **-3.6 MiB** |
-| `subagents` (cold, 2 children) | 44.5 MiB | 27.1 MiB | 48.0 MiB | 29.9 MiB | **-3.5 MiB** |
-| `workflow` (`flows_create`+`flows_run`) | 46.2 MiB | 26.0 MiB | 50.9 MiB | 29.9 MiB | **-4.7 MiB** |
-| `memory-ingest` (100 msgs) | 24.7 MiB | 8.8 MiB | 25.8 MiB | 9.3 MiB | **-1.1 MiB** |
-| `long-agent` (10 turns) | 46.4 MiB | 2.9 MiB | — (25-turn: 65.8 MiB) | — | n/a³ |
+| Scenario | minimal settled | minimal retained Δ | default settled² | default retained² | Δ settled |
+| --------------------------------------- | --------------: | -----------------: | --------------------: | ----------------: | -----------: |
+| `agent-turn` (cold, 1 turn) | 44.0 MiB | 26.6 MiB | 47.6 MiB | 29.5 MiB | **-3.6 MiB** |
+| `subagents` (cold, 2 children) | 44.5 MiB | 27.1 MiB | 48.0 MiB | 29.9 MiB | **-3.5 MiB** |
+| `workflow` (`flows_create`+`flows_run`) | 46.2 MiB | 26.0 MiB | 50.9 MiB | 29.9 MiB | **-4.7 MiB** |
+| `memory-ingest` (100 msgs) | 24.7 MiB | 8.8 MiB | 25.8 MiB | 9.3 MiB | **-1.1 MiB** |
+| `long-agent` (10 turns) | 46.4 MiB | 2.9 MiB | — (25-turn: 65.8 MiB) | — | n/a³ |
² default column from `docs/library-benchmarking.md` (2026-07-21). Those medians
may not have used `OPENHUMAN_PROFILE_FORCE_UTC=1`, so treat the Δ as approximate
@@ -139,7 +178,7 @@ absolute settled figures aren't comparable. The low 2.9 MiB retained Δ confirms
per-turn growth plateaus (matches the prior "not linear" observation).
**Takeaway (consistent with the prior session):** compile-time gates shrink the
-*binary* substantially (-30%) but move *settled RSS* by only ~3-5 MiB per
+_binary_ substantially (-30%) but move _settled RSS_ by only ~3-5 MiB per
scenario. Most of the RSS story is initialization + allocator high-water, not
linked code size. The binary/code-paging win is the primary reason to prefer this
recipe; the RSS win is real but secondary.
@@ -147,13 +186,13 @@ recipe; the RSS win is real but secondary.
## What is functionally absent in this build
Summarized from the per-gate comments in `crates/openhuman-core/Cargo.toml`. Dropped domains fail
-*closed and cleanly* — controllers become unknown-method, tools are simply absent
+_closed and cleanly_ — controllers become unknown-method, tools are simply absent
from the tool list (not degraded to runtime errors), CLI subcommands report a
build-fact error:
- **voice/audio:** voice + audio controllers unregistered (unknown-method over
RPC, absent from `/schema`); `audio_generate_podcast` tools absent; `openhuman
- voice` returns "voice disabled".
+voice` returns "voice disabled".
- **web3:** wallet / web3 / x402 controllers unregistered; swap/bridge/dapp agent
tools absent; the x402 402-retry path returns unpaid; tinyplace on-chain
payments degrade to graceful "wallet disabled" errors (tinyplace comms +
@@ -174,8 +213,9 @@ Everything the opencompany use cases need remains: the agent harness + turn
runner, subagent delegation (`spawn_parallel_agents`), the Memory v2 host
(engine binding, sources, conversations, context + secret/PII scrubbing), threads, config,
security policy, provider routing/inference, `skills` (SKILL.md discovery/install
-+ node/python execution + `run_workflow`/`await_workflow`), and `flows` (saved
-graph create/run/schedule + `workflow_builder`/`flow_discovery` agents).
+
+- node/python execution + `run_workflow`/`await_workflow`), and `flows` (saved
+ graph create/run/schedule + `workflow_builder`/`flow_discovery` agents).
## Test verification
@@ -209,14 +249,14 @@ The repo convention (the `[features]` policy comments in `crates/openhuman-core/
`library-minimal = ["skills","flows"]` alias would be convenient, but it:
- duplicates the `default` list's maintenance burden — a new default-ON gate that
- opencompany *should* pick up would silently be missing from a frozen alias
+ opencompany _should_ pick up would silently be missing from a frozen alias
(the exact failure mode the "no meta-feature" rule exists to avoid), and
- hides the subtractive intent behind a name, making the drop set invisible at
the call site.
**Recommendation: document the explicit list (this file), do not add the alias.**
If maintainers later decide an alias is worth it, the minimal-drift option is to
-express it *subtractively* in tooling rather than as a frozen additive list —
+express it _subtractively_ in tooling rather than as a frozen additive list —
but that is a follow-up decision, not part of this recipe.
## Follow-up shed list (ranked)
@@ -237,19 +277,18 @@ prioritization.
headless library host wanted to shed anyway.
2. **Split `rhai` out of the `flows` gate.** `flows` is the most expensive domain
- we *keep* (+12.7 MiB, dominated by `rhai 1.25` — a full scripting engine).
+ we _keep_ (+12.7 MiB, dominated by `rhai 1.25` — a full scripting engine).
`rhai` arrives only via `tinyagents/repl`, which powers the `.ragsh`
language-workflow tool (`rhai_workflows`). If opencompany needs `tinyflows`
saved-graph runs but **not** the `.ragsh` rhai tool, splitting `rhai_workflows`
into its own sub-gate would reclaim most of that 12.7 MiB while keeping the
flows graph engine. Currently all-or-nothing.
-
-4. **`reqwest` dual TLS backends.** The root `reqwest` enables both `rustls-tls`
+3. **`reqwest` dual TLS backends.** The root `reqwest` enables both `rustls-tls`
**and** `native-tls` — two full TLS stacks linked simultaneously. A headless
host on a known target could pick one, shedding the other.
-5. **Node/Python runtime bootstrap deps** (`tar`, `xz2`+liblzma, `zip`, `flate2`).
+4. **Node/Python runtime bootstrap deps** (`tar`, `xz2`+liblzma, `zip`, `flate2`).
Only needed if `skills`/`flows` actually execute node/python workloads; kept
here because `skills` is on. If a deployment runs only pure-LLM skills, these
archive/decompression deps become sheddable.