The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs(client): add README for client integration
Steven Enamakelc1e383a52ef4
diff --git a/crates/openhuman-core/src/integrations/client/README.md b/crates/openhuman-core/src/integrations/client/README.mdnew file mode 100644index 0000000000..9f17083290--- /dev/null+++ b/crates/openhuman-core/src/integrations/client/README.md@@ -0,0 +1,44 @@+# client++`IntegrationClient`: the shared HTTP client every integration domain uses to+talk to the OpenHuman backend's `/agent-integrations/*` routes. Composio,+task sources, and file storage all build one of these rather than making+their own backend calls, so auth, egress policy, error classification, and+budget gating live in one place instead of being copied per domain.++## Key files++| File | Role |+| --- | --- |+| `construct.rs` | The `IntegrationClient` type and its constructors. Holds the backend URL, the app-session auth token, a separate `reqwest::Client` for downloads, and a lazily-fetched pricing cache. Also sanitizes a misconfigured `backend_url` that carries an inference-style path (issue #2075). |+| `requests.rs` | Outbound request plumbing: route guards (refusing intentionally unexposed routes such as `webhooks`/`admin`), egress disclosure and enforcement, budget gating, and the JSON verb methods (`post`/`get`/`patch`/`delete`/`upload_multipart`). |+| `download.rs` | Raw-bytes download support. The file-storage download route 302-redirects to a presigned S3 URL; `get_bytes` reads `Content-Type` and `Content-Disposition` off the response since the JSON envelope helpers do not carry them. |+| `budget_gate.rs` | Refuses `/agent-integrations/*` calls once the account's AI credits are exhausted, so a tool call never burns a backend round trip the backend would reject anyway. Reads `GET /teams/me/usage` through `BackendOAuthClient` with a one-minute failure backoff to avoid flooding Sentry on a persistent outage. |+| `pricing.rs` | The pricing cache on `IntegrationClient` plus `pricing_for_config`, which short-circuits to empty pricing in Composio direct mode (no backend session exists to serve `/agent-integrations/pricing` there). |+| `errors.rs` | Backend error classification: extracting a readable detail from an error body, and handling the session-JWT 401 to session-expiry recovery path. |++## How auth works++Every request carries the app-session JWT as its `Authorization: Bearer`,+resolved through `crate::api::jwt::get_session_token`, the same token+billing, team, webhooks, and memory all use. A `401` from an+`/agent-integrations/*` route is therefore unambiguous: it means that JWT+has expired, been revoked, or been rotated server-side, never a+third-party integration's own auth failure. `errors.rs` maps that case to+session-expiry recovery.++## How it fits++JSON traffic rides the process-wide `BackendTransport`+(`crate::api::transport`); `IntegrationClient` does not open its own+connections for anything but downloads. Domain code (`integrations::composio`,+`integrations::task_sources`, `integrations::file_storage`) builds one client+per call site through `crate::integrations::build_client` and calls its verb+methods directly rather than reaching for `BackendOAuthClient` or a raw+`reqwest` call.++## Where to look next++See [`../README.md`](../README.md) for the integrations domain overview, and+`crate::integrations::client::map_transport_error` for how a transport+failure becomes a typed error other domains match on.