Define a connector
connectors/hubspot.ts
integration slug selects which system to connect; config is a typed, per-integration shape (run cargo-ai cdk types to type it against your workspace). The connector handle carries deferred tokens — hubspot (the handle), hubspot.datasetUuid — that you pass into models and other resources.
Secrets vs. config
Usesecret() for credentials and env() for non-secret config you want tracked:
secret() vs env() rules and the CARGO_* variables the CLI reads.
OAuth and existing connectors
Some integrations authenticate via OAuth in the browser rather than a static key. Adopt an already-connected instance by slug instead of re-creating it:connectors/openai.ts
adopt: true links an existing connector (e.g. one authorized through an
OAuth flow in the workspace) rather than creating a new one. A later
destroy releases adopted connectors instead of deleting them.Using a connector
Once defined, a connector powers three things:- Data models source from its dataset — see Models and Extractors.
- Workflows call its actions via
integrations.<slug>.<action>()— see Workflows. - Agents invoke its actions via
connectorActions— see Agents.
cargo-ai connection integration get <slug> (or generate typed editor autocomplete with cargo-ai cdk types).
From the CLI
Using the UI
In the web app, go to Settings → Integrations → Add connection, pick the integration, and complete the auth flow (API key or OAuth). Connectors created in the UI can be adopted into code withadopt: true.
Slug rules
Connector slugs aresnake_case (my_source) and validated at define time, so a bad slug fails in plan rather than mid-deploy.
