Skip to content

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

docs(architecture): document backend transport layering and SDK dependency rules

Steven Enamakele19a838abf27
diff --git a/AGENTS.md b/AGENTS.md
index b86a50556c..030a887530 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -335,18 +335,33 @@ module release before migrating a host call to it.
## Backend API
-Backend calls use the vendored `tinyhumans-sdk`. Add missing backend routes to
-that SDK rather than recreating them in `crates/openhuman-core/src/api/`.
+The core does not depend on `tinyhumans-sdk`. It reaches the hosted backend
+only through the port `crates/openhuman-core/src/api/transport/`
+(`BackendTransport`, `BackendRequest`, `BackendTransportError`); the SDK-backed
+implementation is `crates/openhuman-tinyhumans` (`SdkBackendTransport`), which
+sits above `openhuman-embed` and is installed once per process
+(`openhuman_tinyhumans::install`, or `RuntimeBuilder` for library hosts, or
+`CoreBuilder::backend_transport`). A core with no transport installed runs
+agents, memory, tools and RPC without any TinyHumans connection and answers
+backend-touching calls with `BackendApiError::BackendUnavailable` /
+`BACKEND_UNAVAILABLE:`. Never add `tinyhumans-sdk` back to the core; the only
+crates allowed to depend on it are `openhuman-tinyhumans` and, until it is
+merged in, `openhuman-session`.
+
+Add missing backend routes to the vendored SDK (its unexposed-route registry
+is the route policy the transport enforces) and name them from the core;
+do not recreate route implementations in `crates/openhuman-core/src/api/`.
`crates/openhuman-core/src/api/` owns OpenHuman session-token lookup, base URL
-selection, transport configuration, and error classification. Authenticated
-`BackendOAuthClient` requests go through `authed_json`, whose private
-`finish_authed_json` (`crates/openhuman-core/src/api/rest.rs`) classifies
-transient transport failures and maps 401/404 responses to typed
-`BackendApiError` variants; `IntegrationClient::map_sdk_error`
+selection, attribution headers and client profiles (`headers.rs`), and error
+classification. Authenticated `BackendOAuthClient` requests go through
+`authed_json`, whose private `finish_authed_json`
+(`crates/openhuman-core/src/api/rest.rs`) classifies transient transport
+failures and maps 401/404 responses to typed `BackendApiError` variants;
+`IntegrationClient::map_transport_error`
(`crates/openhuman-core/src/integrations/client/errors.rs`) plays the same
-role for integrations. Route new SDK calls through those helpers instead of
-matching `tinyhumans_sdk::Error` by hand.
+role for integrations. Route new backend calls through those helpers instead
+of matching `BackendTransportError` by hand.
Every TinyHumans backend request must carry a sanitized `x-sdk-name`:
diff --git a/crates/openhuman-embed/README.md b/crates/openhuman-embed/README.md
index c946873036..4ee903c3fd 100644
--- a/crates/openhuman-embed/README.md
+++ b/crates/openhuman-embed/README.md
@@ -120,6 +120,17 @@ Layout under a runtime-owned root:
<root>/agents/<agent>/action/ default action_dir
```
+### Backend connection
+
+The core knows the hosted TinyHumans backend only through
+`BackendTransport` (re-exported here). `openhuman-embed` alone installs
+none: agents, memory, skills, tools and RPC run without any TinyHumans
+connection, and every hosted-backend surface (billing, `/agent-integrations/*`
+tools, channel relay, cloud voice) answers with a typed
+`BACKEND_UNAVAILABLE:` error. Use `openhuman-tinyhumans` — its
+`RuntimeBuilder` mirrors this one and installs the SDK-backed transport on
+`build()` — or pass your own to `RuntimeBuilder::backend_transport`.
+
### Authentication
Library mode has no user login. `RuntimeBuilder::api_key` installs a