Skip to content

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

docs(credentials): document that API key now covers all backend callers

Steven Enamakel74adcffbf5e7
diff --git a/AGENTS.md b/AGENTS.md
index 5555740cf1..105751a3b3 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -359,6 +359,16 @@ sandboxing, timeouts, and progress events.
- Library mode has no user login: the runtime's API key rides managed
inference as `Authorization: Bearer` and backend REST as `x-api-key`
(`security::credentials::api_key`, `session_support::BackendCredential`).
+ Every backend caller resolves its credential through
+ `resolve_backend_credential` (or `backend_bearer_secret` for bearer-only
+ seams), never `get_session_token`, so the key covers integrations, voice,
+ embeddings, memory-host and socket calls too; only `/auth/*` session flows
+ need a signed-in user.
+ Every backend caller resolves its credential through
+ `resolve_backend_credential` (or `backend_bearer_secret` for bearer-only
+ seams), never `get_session_token`, so the key covers integrations, voice,
+ embeddings, memory-host and socket calls too; only `/auth/*` session flows
+ need a signed-in user.
- The core never obtains, validates, exchanges or refreshes a credential.
It takes one — a session JWT, an API key, or the offline local token —
through `auth.set_credential` (`security::credentials::ops::credential`)
diff --git a/crates/openhuman-core/src/security/credentials/README.md b/crates/openhuman-core/src/security/credentials/README.md
index 105a5b7377..e2cb5cf404 100644
--- a/crates/openhuman-core/src/security/credentials/README.md
+++ b/crates/openhuman-core/src/security/credentials/README.md
@@ -37,7 +37,7 @@ Credential management for the backend credential the core authenticates with and
- **`AuthService`** (`core.rs`) — `from_config`, `new`, `load_profiles`, `store_provider_token`, `set_active_profile`, `remove_profile`, `get_profile`, `get_provider_bearer_token`.
- **Constants** — `APP_SESSION_PROVIDER` (`"app-session"`), `DEFAULT_AUTH_PROFILE_NAME` (`"default"`), `COMPOSIO_DIRECT_PROVIDER` (`"composio-direct"`), `api_key::API_KEY_PROVIDER` (`"api-key"`).
-- **Credential kinds** — `session_support::CredentialKind {Session, ApiKey, Local}` (wire values `"session"`, `"api-key"`, `"local"`). `session_support::resolve_backend_credential` returns `BackendCredential::ApiKey` when a key is stored (before any session classification) and `BackendCredential::Session` otherwise; `BackendOAuthClient::authed_json` sends an API key as `x-api-key` and a session as `Authorization: Bearer`, while `OpenHumanBackendModel::resolve_bearer` sends the key as the bearer for managed inference. `has_backend_credential` is the boot-time "signed in?" question the scheduler gate asks; `SessionExpired` is ignored for an API-key runtime and for a local session.
+- **Credential kinds** — `session_support::CredentialKind {Session, ApiKey, Local}` (wire values `"session"`, `"api-key"`, `"local"`). `session_support::resolve_backend_credential` returns `BackendCredential::ApiKey` when a key is stored (before any session classification) and `BackendCredential::Session` otherwise; `BackendOAuthClient::authed_json` sends an API key as `x-api-key` and a session as `Authorization: Bearer`, while `OpenHumanBackendModel::resolve_bearer` sends the key as the bearer for managed inference. Every backend caller goes through it (integrations, voice, channels, webhooks, hosted proxies); bearer-only seams (connector proxy route, memory-host `SessionBearer`, the Socket.IO handshake) use `backend_bearer_secret`, which returns the key first and the stored session otherwise — the backend accepts a key as `Authorization: Bearer` by its `tiny_` prefix. Cloud embeddings mirror `resolve_bearer`. `has_backend_credential` is the boot-time "signed in?" question the scheduler gate asks; `SessionExpired` is ignored for an API-key runtime and for a local session.
- **Helpers** — `normalize_provider`, `default_profile_id`, `select_profile_id`, `state_dir_from_config`, `profile_id`.
- **Types** (`profiles.rs`) — `AuthProfile`, `AuthProfileKind` (`OAuth`/`Token`), `TokenSet`, `AuthProfilesData`, `AuthProfilesStore`.
- **Ops/RPC** (`ops`, re-exported as `rpc`) — `set_credential`, `clear_credential`, `store_session`, `clear_session`, `SetCredentialRequest`, `seed_api_key_from_env`, `seed_session_from_env`, `auth_get_state`, `auth_get_session_token_json`, `auth_create_channel_link_token`, `store_provider_credentials`, `remove_provider_credentials`, `list_provider_credentials`, `list_provider_credentials_by_prefix`, `oauth_connect`, `oauth_list_integrations`, `oauth_fetch_integration_tokens`, `oauth_fetch_client_key`, `oauth_revoke_integration`, `encrypt_secret`, `decrypt_secret`, `start_credential_gated_services`, `stop_credential_gated_services`.
diff --git a/crates/openhuman-core/src/security/credentials/api_key.rs b/crates/openhuman-core/src/security/credentials/api_key.rs
index 998716b213..d568101004 100644
--- a/crates/openhuman-core/src/security/credentials/api_key.rs
+++ b/crates/openhuman-core/src/security/credentials/api_key.rs
@@ -10,7 +10,10 @@
//! bearer, and `OpenHumanBackendModel::resolve_bearer` prefers this profile
//! over the app session;
//! * SDK REST clients send it as `x-api-key` — `BackendOAuthClient` and
-//! `IntegrationClient` pick the header from [`BackendCredential`].
+//! `IntegrationClient` pick the header from [`BackendCredential`];
+//! * bearer-only callers (cloud STT and embeddings, the connector proxy
+//! route, the memory host, the Socket.IO handshake) send it as
+//! `Authorization: Bearer <key>`, which the backend accepts by prefix.
//!
//! The key lives in the same auth-profile store as the app session (the
//! parent of `config.config_path`), under its own provider id, so a runtime
diff --git a/crates/openhuman-embed/README.md b/crates/openhuman-embed/README.md
index 3cca3715d9..bccda2356d 100644
--- a/crates/openhuman-embed/README.md
+++ b/crates/openhuman-embed/README.md
@@ -139,7 +139,23 @@ managed inference then sends it as `Authorization: Bearer <key>` to the
TinyHumans OpenAI-compatible endpoint, backend REST calls send it as
`x-api-key`, and the scheduler gate treats the runtime as signed in. No
`/auth/me` round trip, no session JWT, nothing to expire. An agent that names
-its own `Provider` (BYOK) never touches the key. `HarnessBuilder::session`
+its own `Provider` (BYOK) never touches the key.
+
+The key covers every hosted feature the core reaches: managed inference, cloud
+embeddings, voice (STT, TTS, the realtime voice agent), web search, media
+generation, the Jev ranker, Composio and the other `/agent-integrations/*`
+tools, channel delivery, webhooks, and the Socket.IO connection. Callers that
+can only send a bearer (the vendored STT and embedding clients, the connector
+module's proxy route, TinyCortex's Composio sync) send the key as
+`Authorization: Bearer`, which the backend accepts because it recognises the
+`tiny_live_` / `tiny_test_` prefix. What a key may reach is decided by its
+scopes on the backend: `inference`, `voice`, `search`, `media`, `storage`,
+`account` and `connections` (Composio). A key minted through the grant flow
+omits `connections` unless it is asked for; a missing scope answers `403`.
+Only the session-bound `/auth/*` flows (OAuth connect, channel link tokens,
+login tokens) still need a signed-in user.
+
+`HarnessBuilder::session`
remains for hosts that drive backend features on behalf of a signed-in user;
the core stores that session as handed over (`auth.set_credential`) and never
validates it — obtaining and validating a JWT is the host's job (see
@@ -230,11 +246,6 @@ are documented rather than hidden; each is a candidate follow-up in the core.
`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
- ever reads the app-session JWT (`api::jwt::get_session_token`), never the
- runtime's API key. A library runtime that authenticates with only
- `.api_key(...)` gets no integration tools at all rather than the key
- being sent as the wrong header.
Other invariants worth knowing before wiring any entry point:
diff --git a/gitbooks/developing/architecture/agent-harness.md b/gitbooks/developing/architecture/agent-harness.md
index f27b56d707..bcbb38986d 100644
--- a/gitbooks/developing/architecture/agent-harness.md
+++ b/gitbooks/developing/architecture/agent-harness.md
@@ -71,8 +71,11 @@ Authentication in library mode is the TinyHumans API key
runtime's `config.toml`. Managed inference sends it as a bearer to the
OpenAI-compatible endpoint; backend REST calls send `x-api-key`; there is no
session JWT and nothing to expire. Agents that name their own `Provider`
-(BYOK) never touch it. Backend features that need a signed-in user still
-take `HarnessBuilder::session`.
+(BYOK) never touch it. The key covers every hosted feature, subject to its
+backend scopes: inference, embeddings, voice, search, media, Composio and the
+other integrations, channels and the socket. Only the session-bound `/auth/*`
+flows (OAuth connect, channel link tokens) still take
+`HarnessBuilder::session`.
`Workspace::Inherit` together with `Provider::inherit()` and no API key is
deliberately not library-routed inference. It borrows the installed