Skip to content

Integrations ​

External APIs and credentials Brilliant apps use. Two paths today: managed OAuth / Composio toolkits (monday, Google, Jira, Salesforce, Xero, …) and custom API-key (direct) integrations. This page covers both. New here? Start with the Composio overview for dev leads. Spike-level Composio gotchas stay in-repo: gotchas/integrations.md. Playbook for the next provider: docs/new-integration.md (outside docs/plans/ so it survives when plans are deleted).

Glossary: a Connection is the tenant’s authorised link to one provider; “integration” usually means the provider definition. Auth-config ids for Composio live on Admin Config (COMPOSIO_AUTH_CONFIG_<PROVIDER>_{READ,FULL}), not in the secrets bundle.

Google Sheets (#651, on main via #649) ​

Status: on main since 2026-10-09 09:29 IDT. #651 first merged into the Docs branch 23 s after Docs had already been squashed into Drive, so it was stranded; it was re-landed in #649 as cherry-pick f0e4203b, and #649 merged to main (merge f96d8e18, by yoni-monday). Apps and agents can find spreadsheets, read and write ranges, and trigger workflows on new rows. Prod auth config status: see Google Drive.

TopicRule
Providergooglesheets, pin 20261001_00, adapter in google-providers.ts next to Gmail, Calendar, Drive and Docs. Skill googlesheets.md plus actions and workflow triggers (new rows, range changed).
AuthManaged Composio OAuth, scopes spreadsheets, drive, userinfo.email. Writes pause for approval in chat.
Config keyCOMPOSIO_AUTH_CONFIG_GOOGLESHEETS_FULL. A staging managed auth config exists but the setting is not set on staging yet. Prod: Pulumi.prod.yaml declares brilliant-prod-googlesheets-full, created only when the lead applies infra.yml (flagged “needs review”).
IdentityConnection label is the Google userinfo email (verified live on side env gdrive).
Proxy pathComposio’s root is sheets.googleapis.com/v4, so googleWorkspaceProxyPath(path, "/v4") strips a leading /v4; /drive/v3/... goes to Drive. Verified live: GET /v4/spreadsheets/{id} returned 200 with title and tab names.
Coverage58 tools: 22 read, 26 write, 10 destructive (2 via DESTRUCTIVE_OVERRIDES: find_replace, batch_update_values_by_data_filter). 16 polling triggers.
GotchaThe proxy validator rejects spaces and %20 in a Drive q query. Use + instead (skill examples updated).
Follow-ups#637, #644.

Composio / managed OAuth ​

Released Composio providers show in the studio picker and load their skill into coding + operational agents. Connect is Composio OAuth under a scoped Composio user id; Brilliant never stores the provider’s client secret.

BYO vs managed auth configs ​

KindWhenWhere credentials live
ManagedComposio ships a toolkit app (e.g. many Google / monday paths)Inside Composio’s managed app
BYO / custom OAuth2Composio has no managed app for that toolkit (e.g. Xero)Client id/secret only inside Composio; Brilliant stores only the auth config id

Always register the redirect as Composio’s v3 callback: https://backend.composio.dev/api/v3/toolkits/auth/callback.

Auth config keys and the Connect button ​

Per-env admin config keys follow COMPOSIO_AUTH_CONFIG_<PROVIDER>_{READ,FULL} (see Admin Config). A missing …_FULL (or the profile the UI needs) means the Connect button is missing on that environment — set staging and prod before expecting Connect there. Values override the Worker env / secrets path via CONFIG_KV.

Separate production Composio project (#564, merged) ​

Until this rollout finishes, production shares staging's Composio project key and auth-config ids. #564 (merged 2026-10-07 11:40 IDT by yoni-monday, merge 5ee2e972) declares a dedicated production Composio project in Pulumi without touching the running key. The code is on main, but prod is not switched yet. The first approved prod infra dispatch (run 37595291249, for 5ee2e972) failed during apply with HTTP 400 on COMPOSIO_AUTH_CONFIG_MONDAY_FULL; reconciliation afterwards found zero destination auth configs, zero managed Composio resources and no pending Pulumi operations, and the running prod key was not switched. A fresh dispatch after #568 (run 37597972955, for e6c8b3df) also failed, but got further: it created the six managed auth configs (Jira, Gmail, Google Calendar, Salesforce, HubSpot, Zendesk), while all four custom monday/Xero configs returned HTTP 400 (API code 10400). The real root cause was the request field name, fixed in #569 (see below). A fresh dispatch for #569's merge e0f2213d (run 37601257827) succeeded at 12:31 IDT, so all ten prod configs now exist. But the four custom monday/Xero configs were uploaded with Composio's masked secrets copied from GET, and a real Monday connect failed at token exchange with invalid_client / HTTP 401. #579 (see below) blocks masks and repairs those four configs in place with the original raw secrets. Running prod and staging stay on the shared project until steps 3 to 5 below are done; check that run and the Secrets/Config change before assuming prod uses its own project. Preview after reconciling the first failed state was still 10 creates, 135 unchanged, no updates/deletes/replaces; staging preview at #564 was 161 unchanged.

Whereinfra/pulumi/src/composio.ts, wired from infra/pulumi/index.ts; declared only on stacks with brilliant-infra:composio config (side envs return before provisioning).
WhatTen protected auth configs: Jira, Gmail, Google Calendar, Salesforce, HubSpot, Zendesk, monday (FULL/READ), Xero (FULL/READ). Staging's auth mode and OAuth scope sets are preserved; custom monday/Xero credentials keep their registered redirect URIs.
SecretsProject API key and OAuth credentials live only in KMS-encrypted Pulumi config. The stack exports only setting name to auth-config id (composioAuthConfigIds).
SafetyOperator attestation plus a key fingerprint guard against key mixups, but do not prove the project identity. Create is sent once; an ambiguous failure is not retry-safe, so list destination configs before retrying. Delete/replace is protected.

Rollout (prod):

  1. Merge after CI. Done 2026-10-07.
  2. Dispatch infra.yml on main for prod with normal infra-production approval (no allow-deletes bypass). Done: the first attempt (run 37595291249) failed on monday FULL, the second (run 37597972955, with #568) created the six managed configs, and the third (run 37601257827, with #569) created the four custom ones. Prod applies from CI, never a laptop.
    • Repair (#579): the four custom configs hold copied masks, not real secrets. Put the original raw secrets into KMS-encrypted prod Pulumi input, preview (must be 4 in-place updates, 0 creates/deletes/replaces, ids unchanged), then approve a fresh infra.yml apply on main. #579's PR comment reports that preview after state reconciliation: 4 updates / 141 unchanged, targeting only MONDAY_FULL, MONDAY_READ, XERO_FULL, XERO_READ.
  3. Read back all ten configs and compare auth mode, scheme, scopes and callback URIs with staging.
  4. Replace prod COMPOSIO_API_KEY and the matching COMPOSIO_AUTH_CONFIG_* settings together via the approved Secrets/Config workflow. Remember Admin Config ids override the deployed env vars.
  5. Verify a real authorized Monday OAuth connect, a safe read and a reconnect, then Xero separately. Config GET equality, enabled status and a mocked PATCH success are not proof; issue #577 stays open until the real provider check passes.

Gotchas: a new project key does not move existing connected accounts (prod had zero Composio connections at PR time), and copying an auth config does not make managed OAuth consent Brilliant-branded. Composio's GET returns scope arrays, but creation needs comma-separated credentials.scopes; an empty scope array must be left out, not sent blank (#568). Custom-auth creation sends camel-case authScheme, not the auth_scheme field GET returns, and managed creation sends no scheme field at all (#569); check the published client types rather than inferring create fields from GET. Never copy Composio-managed client id/secret, and never take custom client or signing secrets from a Composio GET: GET returns a mask (four characters, ..., four characters), not the secret (#579). GET /auth/session/info needs a user key, not a project key. Pulumi's dynamic provider can't run under Bun, so stack-level tests run under Node (test/composio-stack.node.ts). Full notes: repo gotchas/integrations.md.

Empty OAuth scopes are omitted (#568, merged) ​

Follow-up to #564 after its first prod apply failed. #568 (merged 2026-10-07 12:03 IDT by yoni-monday, merge e6c8b3df) changes how the Pulumi Composio provider (infra/pulumi/src/composio.ts) builds the create request for OAuth2 configs:

  • Empty scopes are left out. monday FULL reports scopes: [] when its scopes come from the Monday OAuth app, and the copy had turned that into scopes: "". Monday's toolkit docs say to leave the field unset in that case. Now an empty array or an exact empty string for scopes, optional_scopes or user_scopes is dropped from the request, so the app's own scopes stay in force.
  • Nonempty scope arrays become comma-separated strings with the same scope set, without changing the input. Arrays with blank entries or commas inside an entry, and whitespace-only strings, are rejected before any request is sent.
  • Everything else is preserved: custom client id/secret, use_oauth2_1, the webhook signing secret and oauth_redirect_uri. Non-OAuth credentials pass through unchanged. Keep use_oauth2_1 for monday, because legacy Monday OAuth 2.0 tokens expired on October 1, 2026.
  • Errors now include the provider's numeric API code (for example HTTP 400 (API code 10400)), still never the free-text response message or any credential value.

The PR called this the strongest supported hypothesis, not proof, and the prod retry (run 37597972955) showed the empty-scope change was not the root cause: the four custom configs still failed with HTTP 400 / code 10400. The scope handling above still stands; the actual fix is #569. Contract composio-auth-mode-and-scopes-preserved was updated to match, and infra/pulumi tests passed 109/0.

Custom auth uses authScheme (#569, merged) ​

Second follow-up to #564. #569 (merged 2026-10-07 12:22 IDT by yoni-monday, merge e0f2213d) fixes the create request the Pulumi Composio provider (infra/pulumi/src/composio.ts) sends to POST /auth_configs:

  • Root cause. The provider put the GET response's snake-case auth_scheme into the POST body. Composio's create request (published @composio/client 0.1.0-alpha.76, /api/v3.1/auth_configs, and the core SDK's AuthConfigs.create serializer) needs camel-case authScheme for use_custom_auth, and its managed branch has no scheme field. Managed configs tolerated the wrong field, so they were created, while every custom config was rejected with HTTP 400 / code 10400. The REST overview types auth_config as any, which hid the difference.
  • Fix. Custom creation sends authScheme (for example OAUTH2); managed creation (use_composio_managed_auth) sends no scheme field. Contract composio-auth-mode-and-scopes-preserved now says this explicitly.
  • Test. A fixture that mimics the vendor schema rejects a custom POST without authScheme with 400 / 10400. It failed before the fix and passes after; infra/pulumi tests pass 110/0.
  • Not changed: credentials and config inputs, API keys, dependencies, retries, and the six managed configs already created in prod (they are kept, not deleted or recreated). Running prod and staging are untouched.

Lesson: when building a Composio create request, check the published client's request types and the SDK serializer, not the GET response shape or the Python options. Also in repo gotchas/integrations.md.

Outcome: the fresh prod dispatch for e0f2213d (run 37601257827) succeeded and created the four custom configs, but with copied secret masks; see #579 for the repair.

Copied secret masks are rejected (#579, merged) ​

Third follow-up to #564, and a confirmed production bug. #579 (merged 2026-10-07 15:32 IDT by yoni-monday, merge fe6314ed) refs issues #577, #575 and #571.

What went wrong. After #569 the four custom monday/Xero prod configs were created and enabled, and their GET metadata matched staging, but a real Monday connection failed during token exchange with invalid_client / HTTP 401. Composio's GET and list return developer secrets masked as the first four characters, ..., and the last four. The Pulumi copy uploaded those masks as the secret, and the "verification" compared masks with masks, so it falsely reported the credentials matched. Composio's developer-secret masking policy means a GET can never give the secret back, and the connected-account masking flag does not change that. Never disable token masking to try to recover one. The six managed configs are not affected.

What the provider (infra/pulumi/src/composio.ts, new helper composio-credentials.ts) does now:

  • Masks are rejected before any create or credential update. The error names the field and reason only, never a value.
  • Legacy masks are grandfathered only when completely unchanged, as a no-op in check. A new or changed mask still fails, and other validation findings are never waived. This lets you repair one provider without resending another provider's masks.
  • In-place update only for secret values. A custom config's client_secret or webhook_signing_secret can change in place when project, key fingerprint, toolkit, name, scheme, mode, credential key set and client id are all identical. Anything else (client id, scopes, URIs, other credential settings, adding or removing fields, managed credentials) is still a protected replacement. A field that only sounds secret, like token_type or signing_algorithm, does not allow an update.
  • The repair is one PATCH to the known id with {type:"custom",credentials}, which must return success:true. It keeps the id and never POSTs, DELETEs, re-keys or unprotects. An ambiguous result needs reconciliation, not a retry.
  • Credential diffs are normalized, so [], empty and missing scopes no longer cause a spurious replacement.
  • Contracts: existing secret-output, fingerprint and no-retry contracts kept, plus new mask and update contracts. gotchas/integrations.md gained "OAuth client secrets from GET are masks, not recoverable credentials" and corrects the earlier claim that GET equality proves anything.

Tests. Mask and update-policy regressions failed before the fix. Standalone infra/pulumi typecheck is clean and its suite passes 128/0 (129 per a later PR comment). A full local root verify failed in control-plane/agents/dispatch and scripts/worker-boot checks; that was not investigated, so the PR does not claim a full local verify pass.

Rollout status. Per PR comments before merge (15:13 and 15:30 IDT), the original Monday client and signing secrets and the Xero client secret are now in prod Pulumi config as KMS-encrypted input only (Pulumi.prod.yaml), with client ids and every other input unchanged. The prod preview after state reconciliation was 4 in-place updates / 141 unchanged / 0 creates / 0 deletes / 0 replaces, touching only MONDAY_FULL, MONDAY_READ, XERO_FULL and XERO_READ. No staging or Worker secret sync is needed for this repair. At 15:33 IDT an infra dispatch for fe6314ed (run 37621779109) was in progress. The live PATCH response and a real authorized OAuth connect and read are still the rollout gates; check that run and #577 before assuming monday or Xero connects work in prod.

Lesson: for custom OAuth apps, get the raw client and signing secrets from the provider's own app or our secure store and keep them as encrypted input when uploading. Compare only non-secret metadata through GET, and prove credentials with a real connect. Don't regenerate a shared OAuth app secret without rotating staging and prod together.

Broker rules (all Composio providers) ​

  • mergeAdapterHeaders strips adapter- and caller-supplied headers alike, case-insensitively, then merges. Contract: adapter-headers-stripped-and-merged-case-insensitively (#313).
  • Provider rewrite runs before the approval gate for Composio connections (also moves Jira accessible-resources ahead of approval). Rewrite types live in rewrite.ts.
  • Experimental skills are dropped from agent bundles via isExperimentalSkillFile in bundle-skills.ts.

Xero (#313, merged) ​

Released Composio provider — same product pattern as Salesforce (#556): tenants see it in the studio picker; coding and operational agents load its skill.

TopicRule
AuthBYO / custom OAuth2 (Composio has no managed Xero app). Redirect: Composio v3 callback above.
Config keyCOMPOSIO_AUTH_CONFIG_XERO_FULL — must be set on staging and prod or Connect is missing. Client id/secret stay inside Composio only.
App ownershipdeveloper.xero.com app owned by the integrations team ([email protected]). Watch the 25-organisation cap for uncertified apps.
Per-customerEach customer connects their own org via Composio under their scoped user id; connection labelled with the org name.
Tenant routingReads default to the first ORGANISATION on the connection. Multi-org writes fail closed (400 listing orgs) without xero-tenant-id; the approval prompt names the org (POST … in <org>).
AdapterrewriteXero adds xero-tenant-id and Accept: application/json (without Accept, Xero returns XML).
Tool quirks (pin 20260721_00)XERO_GET_CONTACTS has no tenant arg — read contacts via the proxy. list_invoices / list_journals use tenantId; most others use tenant_id.
DestructiveDESTRUCTIVE_OVERRIDES tags five delete/void tools as destructive.
TriggersComposio publishes no Xero triggers → workflows use schedule + If-Modified-Since.
Landing12 suggestions (8 single-source + 4 pairings with Gmail / Outlook / monday / HubSpot).

Still open (ops): a human must finish Demo Company OAuth; xero fixture stays in skill-gaps.allow until the probe fixture is committed. Do not paste live sandbox ac_ / ca_ ids into public docs — set them via Admin Config / side-env secrets.

Next provider: follow docs/new-integration.md; also gotchas/integrations.md.

Google Drive, Docs and Sheets (#649, merged) ​

Status: merged to main 2026-10-09 09:29 IDT by yoni-monday (merge f96d8e18, 7 commits, +2292/−255, 60 files). #649 (retitled “Google Drive, Docs and Sheets integrations via Composio”) now ships all three Google Workspace providers: Drive (googledrive, pin 20261001_00), Docs (googledocs, 20261008_00, squash 93ccc955 from #650) and Sheets (googlesheets, 20261001_00, cherry-pick f0e4203b of #651). Apps and agents can search, read, export, upload, share and edit Drive files, Docs and Sheets; writes pause for approval in chat. Plan of record: docs/plans/googledrive.md.

Auth configs. Staging (managed, hand-created 2026-10-07): Drive, Docs and Sheets; moving them under Pulumi is #702. Prod: adopted by id (resolved 2026-10-10). On 2026-10-09 the three prod configs (COMPOSIO_AUTH_CONFIG_GOOGLE{DRIVE,DOCS,SHEETS}_FULL) were hand-created outside Pulumi (0 connected accounts), against prod-infra.md row 7, and #649 declared them as adopt: ac_…, which broke prod infra.yml with unknown keys: adopt. #760 (merged 2026-10-10 20:32 IDT, merge 99d7d5ed) landed #702's composio.ts adopt support, tests and gotcha unchanged, so prod Pulumi adopts the hand-made configs by id (3 adopted). Staging adoption stays in #702 until its projectId is attested.

Drive upload recipe (verified live 2026-10-09): a multipart upload through the Composio proxy stores the metadata JSON as the file content. Upload bytes with POST /upload/drive/v3/files?uploadType=media (real Content-Type), then PATCH /files/{id} with the name and addParents/removeParents.

TopicRule
AuthManaged OAuth (Composio's Google app), scopes drive and userinfo.email: full read and write to every file the user can open. Consent says "Composio"; there is no Brilliant Google app to own yet (that is #11, shared with Gmail and Calendar).
Config keyCOMPOSIO_AUTH_CONFIG_GOOGLEDRIVE_FULL only; there is no read profile, so a read request falls back to FULL. Per the PR, staging has a managed config but the key is not set on staging yet; prod's brilliant-prod-googledrive-full is declared in infra/pulumi/Pulumi.prod.yaml and exists only after the lead applies infra.yml (flagged for review). Until both are set, Connect is missing there.
Connection labelThe account email from GET /drive/v3/about?fields=user (googledriveSiteLabel).
Proxy pathComposio's Drive proxy root is already https://www.googleapis.com/drive/v3, so googleDriveProxyPath strips a leading /drive/v3 (otherwise /drive/v3/files becomes /drive/v3/drive/v3/files and 404s). Media uploads under /upload/drive/v3/... sit outside that root and go out as absolute URLs. Calendar now uses the same shared stripProxyRoot helper in provider-identity.ts.
Code layoutGmail, Calendar and Drive adapters live in the new apps/control-plane/src/integrations/google-providers.ts, moved out of providers.ts to stay under the 600-line ratchet.
Coverage (pin 20261001_00)105 tools: 48 read, 43 write, 14 destructive. Composio's destructiveHint already tags every delete, so no DESTRUCTIVE_OVERRIDES. list_files and parse_file are deprecated in favour of find_file and export_google_workspace_file; exports cap at 10 MB (Google).
Triggers7 polling triggers, spliced into composio-events.generated.ts without touching other providers' catalogs.
Skills and landingskills/integrations/references/googledrive.md (with Probe: lines) plus generated googledrive-actions.md, workflow skill and googledrive-events.md; 5 Drive suggestions.
SandboxGoogle has no Drive sandbox tenant. Any team Google account works through a side env's studio; never connect a customer's Drive for testing. Drive downloads and exports return full bodies, so never write a raw response to a fixture.

Verified on side env gdrive (never staging), per the PR: e2e-smoke 7/7; the probe GET /drive/v3/about?fields=user returned 200 through a signed agent turn (scripts/integrations/probe.ts itself gets 401 on canonical apps, #644); reads via integration_call and integration_run (googledrive.find_file) returned real files; a create-file request stopped at the approval prompt and nothing was created; a built app using integrations.forProvider("googledrive") rendered live recent files.

Follow-ups: #637 named integrations.googledrive accessors in the template SDK (skipped because packages/template forces a conductor image rebuild; forProvider works today) and #644 (probe.ts should sign agent requests).

Google Docs (#650, merged into #649’s branch) ​

Status: on main via #649 (merged 2026-10-09 09:29 IDT). #650 was merged 2026-10-09 08:11 IDT by yoni-monday (merge 93ccc955) into its base integration-googledrive, so the Docs code now rides inside #649 (still open) and reaches main only when #649 merges. Opened 2026-10-08 15:22 IDT by monday-sphera-ai[bot] (branch integration-googledocs). Second of three stacked PRs: Drive (#649) → Docs → Sheets. Rollout still pending: COMPOSIO_AUTH_CONFIG_GOOGLEDOCS_FULL is not set on staging, and prod's brilliant-prod-googledocs-full needs the lead to run pulumi preview (expected: one create) and then apply infra.yml. Adds Google Docs as a managed-OAuth Composio provider built the same way as Gmail, Calendar and Drive: apps and agents can find, read, create and edit Docs, and writes pause for approval in chat.

TopicRule
Providergoogledocs, pin 20261008_00, adapter in apps/control-plane/src/integrations/google-providers.ts (GOOGLE_TOOLKIT_VERSIONS / GOOGLE_PROVIDERS, next to Gmail, Calendar and Drive).
AuthManaged Composio OAuth (consent says “Composio”; a Brilliant-owned Google app is #11). Scopes documents, drive, userinfo.email; drive is what makes search, export and the Drive-backed tools work.
Config keyCOMPOSIO_AUTH_CONFIG_GOOGLEDOCS_FULL only (no read profile is provisioned). Staging has a managed auth config but the setting is not set on staging yet. Prod: Pulumi.prod.yaml declares brilliant-prod-googledocs-full, created only when the lead applies infra.yml (flagged “needs review” in the PR).
IdentityThe Docs API has no whoami, so the connection label is email from absolute https://www.googleapis.com/oauth2/v3/userinfo (fallback docs.google.com).
Proxy pathComposio’s root is docs.googleapis.com/v1, so googleWorkspaceProxyPath(path, "/v1") strips a leading /v1. /drive/v3/... (search, export) goes to the Drive host as an absolute URL with the same token. Sheets will reuse the helper with /v4.
Coverage48 tools: 9 read, 29 write, 10 destructive. 10 polling triggers (created, updated, deleted, keyword, placeholder filled, structure changed, word-count threshold, search match, page added, folder created). Comments live on Drive’s API (use googledrive); image URLs must be public; non-PDF export goes through Drive.
DestructiveDESTRUCTIVE_OVERRIDES.googledocs in scripts/gen-integration-actions.ts tags UPDATE_DOCUMENT_MARKDOWN (replaces the whole doc) and UPDATE_DOCUMENT_BATCH (deprecated twin of the already-destructive UPDATE_EXISTING_DOCUMENT).
File-size ratchetscripts/check-file-size.ts now skips *.generated.ts: composio-events.generated.ts passed 600 lines with the Docs triggers, and the ratchet is for hand-written code (split the generator, not its output).
Live testSide env gdrive (never staging). scripts/integrations/probe.ts answers 401 on canonical apps (#644), so the Probe: paths ran through a signed agent turn and returned 200 (redacted fixture scripts/integrations/fixtures/googledocs.json). Read turn used googledocs.search_documents and get_document_plaintext; a build turn rendered live data via integrations.forProvider("googledocs"). After review, proxied GET /v1/documents/{id} (Docs) and GET /v4/spreadsheets/{id} (Sheets) both returned 200, confirming the /v1 and /v4 strips; a :batchUpdate write stopped at the approval prompt.
GotchaThe proxy validator rejects spaces and %20 in a Drive q query; use + instead (verified live, now in the skill examples). Live connection rows are labelled with the account email because both managed configs grant userinfo.email.
Follow-ups#637 (named integrations.googledocs accessors in the template SDK; forProvider works today) and #644 (probe.ts should sign agent requests).

In-repo plan: docs/plans/googledocs.md (deleted when the release checklist is done). The Drive base it stacks on is Google Drive (#649, open) above; proxy-root rules for all Google toolkits are in gotchas/integrations.md.

Custom API-key integrations (direct) ​

Hand-filled from Settings → Integrations (studio form), or proposed by the coding agent (#369, merged 2026-10-03 — closes #349; follow-up #350). Same storage and proxy once connected. Plan of record in-repo: docs/plans/agent-custom-integrations.md. Code: apps/control-plane/src/integrations/custom*.ts, routes/integrations/, packages/db/src/schema-custom-integrations.ts.

Agent propose → key page → probe (#369, merged) ​

The coding agent can add an API that is not a built-in toolkit. Verified end-to-end on side env api-key-int (GIPHY). Flow:

  1. Agent finds the OpenAPI/spec (or asks the user for base URL + docs).
  2. Agent calls conductor tool integration_propose_custom → control-plane POST .../custom-proposals.
  3. Studio shows a chat connect card (link to the key page). The key is never typed in chat.
  4. User opens the control-plane key page, types the key, optional “make available to the whole team” (owners/admins only).
  5. Control plane claims the proposal (pending → submitting), then runs a GET probe with that key. Only on 2xx does it create the definition + connection and return connected.
  6. On connected, the tool syncs the skill file (or inlines the reference) before returning to the model.

Submitting the key on the control-plane page is the approval. The agent only proposes. The key path is browser → control plane → vault — never chat, websocket, conductor, or the model.

Who may propose / submit ​

PolicyDefaultEffect
Any tenant memberonMembers may propose and submit
custom_integration_settings.admin_onlyoffWhen on, only owners/admins may propose, open the page, or submit

Flag lives in custom_integration_settings (one row per tenant; absent = false), not on tenants. Studio: GET/PUT /tenants/:id/integrations/custom-policy { adminOnly } (read any member; write owner/admin). Settings → Integrations shows the admin-only toggle.

Scope of the connection ​

Who submitsDefault connection
MemberPersonal, bound to the current app (x-brilliant-app)
Owner / adminSame, plus optional checkbox → whole-team (workspace-scope)

Definition is tenant-wide immediately, labelled source: "agent" and “added by …”. Same slug or same base URL reuses an existing definition and only mints a new key page (existing: true).

Auth modes ​

authInFieldsNotes
header (default)authHeader, authTemplateSame rules as studio-created customs
queryauthParam (e.g. api_key)Fixed at creation. Proxy drops any caller value of that param (any case, path/query/action) then appends the vault key. Redacts raw / percent / form-encoded spellings in logs and echoed URLs. Needed for Giphy-style api_key=.

Spec / host confirmation ​

The agent passes the OpenAPI JSON inline (no control-plane outbound fetch). Control plane cross-checks baseUrl against servers[].url. Mismatch or no spec → hostConfirmedBySpec=false; the key page shows a plain warning that the address “matches / does not match the spec the agent provided” (self-attested: the agent supplies both host and spec). Chat card title is truncated, so the warning is only reliable on the page. With no spec, definition has notes and no actions.

Proposal lifecycle ​

Stored in custom_integration_proposals (TTL 30 min; newer proposal for same tenant+slug replaces older; proposals expire per proposer). Statuses:

StatusMeaning
pendingAwaiting key / still open (also after 401/403 probe — form re-renders; status route also reports submitting as pending)
submittingKey page claimed the proposal before probing (double-submit → one 200 Connected, one 410). A submitting row never expires; a request killed mid-submit can leave it stuck (#376) — a new proposal still works
connectedProbe 2xx; definition + connection exist; providerId = custom_<slug>
probe_failed404 / 5xx / refused or unreachable host; page 410s; agent must re-propose (httpStatus, hint). If a definition was created then the post-probe step fails, that definition is removed
expiredTTL
declinedCancel, poll timeout, or chat card auto-dismissed without a key → key page answers 410 so a late submit cannot create a definition the agent never heard of

Nothing is created on a failed probe. “Proposal exists but custom_<slug> unknown” is normal until submit succeeds.

Agent-written notes ​

Agent notes are seeded into every workspace in the tenant. The reference file labels them as a teammate agent’s words, caps and fences them, and heads the file with the slug (not the agent-chosen display name). Only studio-created definitions keep “Notes from your admin”.

Internal contract (ops-key routes) ​

Under /internal/workspaces/:wsId/integrations/custom-proposals, headers x-brilliant-app (folder name) and x-brilliant-actor (user id). The actor is checked for membership and admin-only — not the ops key.

  • POST → 201 { proposalId, connectUrl, host, authIn, authName, hostConfirmedBySpec, actionCount, existing } · 400 invalid_request · 403 forbidden_role | custom_integrations_admin_only · 503 when direct hatch off (directOff)
  • GET :proposalId → { status, providerId?, httpStatus?, hint? }

Conductor tool result to the model: only { providerId, status, skillPath? } or { status:"probe_failed", httpStatus, hint } — never key material. If a user pastes a key in chat, the agent must not use, repeat, or write it (server-side redaction is a follow-up).

Contracts to keep (@cc in plan): no definition/connection until probe succeeds; no key material in conductor responses; query-mode overwrite + redact; proposals stay tenant-scoped (custom-integration-tenant-scoped).

Studio UX gotchas (agent proposals) ​

  • Chat card is an <a> inside #question-… (conductor ui.select), not a <button>. Unanswered cards auto-dismiss after QUESTION_AUTO_ANSWER_SECONDS (default 300); tool returns declined. That must not stall the build: merged #380 (contract declined-connection-never-blocks) says Later / cancel / timeout / incomplete → continue on sample data without asking whether to proceed, note “isn’t connected yet” on the relevant plan.md section, and tell the user they can connect later. Same for blocked_by_admin (review fix; payloads returned, never thrown). Declines are successful results so integration errors stay red (contract declined-step-not-failed). See Control plane — Plan mode polish · question auto-answer.
  • Connect timing (#386 merged / #394 open, stacked on #380): ask connect while planning as a fixed skill step after Look (before propose_plan) — integration_connections → one integration_run per unconnected service from the first prompt / plan → integration_connections again. Control plane returns not_connected (connect card) before reading the action (authorizeIntegrationCaller first on POST /v1/integrations/:provider/run). Cards dock with plan questions while no plan is approved (pickDockedQuestion); composer text does not answer a docked connect card. Skipping continues planning (“Sample data for now, connect later”). Never prompt connect during build (agent writes no Connect to-do; studio hides any it does). After the build: Connect chips for every tool named on the first prompt’s connect line that still isn’t active (not only skipped cards); up to two tools get their own chip, three or more share one “Connect A, B and C” chip so Invite always fits, then at most one feature suggestion. Prompt-only no-connect-in-build guard — integration_run can still raise a card. See Control plane — Chat rhythm 2 · Plan mode fine-tuning.
  • Unconfirmed-host warning is on the key page (red, before typing), not in the truncated card title. Follow-up #377: host warning in the chat card, server-side host check, non-admin refusal live test.
  • Proposals are tenant-scoped: another tenant’s id → 404; page looks up only inside the signed-in user’s tenants.
  • A conductor deploy that evicts the turn mid-poll never runs the decline path, so the key page stays live until the 30 minute TTL.

Preview integration calls: who they're signed as (#807, merged 2026-10-12) ​

Server-side calls from a draft preview to POST /integrations/<provider>/proxy are now signed as the visiting builder, and work even when no builder turn is running. Before this, they failed with 403 integration_requires_active_turn outside a turn, and during a turn every visitor was signed as the turn's pinned builder (issue #804).

  • withPreviewContext mints a short-lived (≤30s) HS256 x-brilliant-context for the admitted builder; it now carries a ws: <environmentId> claim. The template integrations client forwards it.
  • previewVisitor() in services/conductor/src/workspace/preview.ts verifies it against BRILLIANT_TOKEN_KEY, requiring ws to match this environment and tenant to match the app's tenant. User tokens, other-environment or other-tenant contexts, wrong-key and expired contexts are refused with 403.
  • handleContainerIntegrationProxy (services/conductor/src/llm/brilliant-proxy.ts) signs as the visitor when present, else falls back to the running turn's builder (agent-run container code has no visitor).
  • Unchanged: the control plane still re-checks builder access per call, preview admission stays builder-only, the request keeps source: "coding_agent". as:"user" calls still return user_scope_unavailable (#526). Conductor-only deploy.
  • Source: PR #807. A live end-to-end check was not done at merge time.