Bruin Cloud integration
Bruin Cloud integration connects a local Bruin project to hosted projects, pipelines, runs, agents, dashboards, data apps, and data connections. The bruin cloud command uses the Bruin Cloud API for management and execution. The Bruin Cloud database adapter and agent query API also let cloud services reach data through the connection system.
System boundary
The integration has two related roles. The API client gives the CLI a way to inspect and change Cloud resources. The database-facing paths turn Cloud credentials or agent connections into controlled data access. Cloud remains the system that stores project state and runs work.
This diagram shows how a local project reaches Cloud through management commands or a data connection.
flowchart LR
P[Local Bruin project]
C[.bruin.yml and environment]
K[Cloud API token]
CLI[bruin cloud commands]
DB[Bruin Cloud connection]
AQ[Agent read-only query]
API[Bruin Cloud API]
RUN[Cloud projects, runs, agents, data apps, and data services]
P --> C
C --> K
K --> CLI
K --> DB
CLI --> API
DB --> API
AQ --> API
API --> RUN
The integration does not copy Cloud state into the local project. It sends requests to Cloud and presents the returned resource data or operation result to a person or to another command. Data app source files are the exception in workflow terms: the CLI can pull a Cloud app into a local editing folder and push selected changes back.
This page is a child of Platform services. See CLI command workflows for broader command flow. See Connection configuration for local connection setup. See AI workflows for AI-related project setup, Inference operations for hosted model execution, and Secrets management for secret storage and resolution.
Authentication and configuration
Authentication uses a bearer token for Cloud API access. Configuration can keep the token in the project connection model or provide it at command time. A local act-as session is another token source for commands that must use an agent's permissions.
Credential sources
The fully qualified API client in home/…/api.go uses the token supplied when the client is created. The CLI resolves that token in this order:
- The
--api-keyflag or itsBRUIN_CLOUD_API_KEYenvironment source. - An active
bruin cloud act-assession. - The
bruinCloud connection resolved from the repository .bruin.yml. - The token saved by
bruin cloud loginin the operating system credential store.
An explicit API key or BRUIN_CLOUD_API_KEY therefore overrides an act-as session. A command fails before it calls Cloud when none of these sources provides a token. See Secrets management for the wider rules for storing and resolving project secrets.
References: cmd/cloud_auth.go• L35-86 cmd/cloud_act_as.go• L155-181 cmd/cloud_act_as_test.go• L230-259
Team and project scope
Cloud tokens have a current team scope. A command can override that scope with --team, using the company prefix returned by bruin cloud teams list. BRUIN_CLOUD_TEAM supplies the same flag value.
The CLI can also store one default team in cloud.default_team. A command uses that value when it has no --team value. If authentication comes from a global Cloud login, its saved team can supply the final fallback. An act-as session is pinned to the team in that session. If no team value exists, the request omits the team header and Cloud resolves the team from the token.
All runnable Cloud commands receive the team option. The local config, login, and logout commands do not act on a team and therefore do not use it. This keeps team selection consistent across resource families while preserving commands that manage local authentication or settings.
Most pipeline commands also need a project ID. The CLI accepts an explicit --project-id. When it is omitted, it can select the only project visible to the token. It stops and asks for an explicit ID when the token can access more than one project.
References: cmd/cloud.go• L61-91 cmd/cloud.go• L178-210 cmd/cloud.go• L228-246 cmd/cloud_auth.go• L89-100 cmd/cloud_act_as.go• L142-168 cmd/cloud_auth.go• L31-86 cmd/cloud_test.go• L89-149 cmd/cloud_test.go• L200-317 cmd/cloud_test.go• L405-440 cmd/cloud_act_as_test.go• L230-276
Project connection model
The project configuration names the Cloud connection type bruin. Its sensitive api_token field serves both the database-facing adapter and the CLI fallback. A minimal project can use a connection such as the one in templates/…/.bruin.yml.
connections:
bruin:
- name: bruin-cloud-default
api_token: "${BRUIN_CLOUD_API_KEY}"
The connection name identifies a configuration entry. It does not select a Cloud project or team. Those are request scopes controlled by command flags, the saved default team, and the token's Cloud permissions.
Project initialization can merge connection placeholders from a template into the central .bruin.yml. This keeps a generated project wired to the services declared by its starter template instead of leaving that configuration inside the template directory.
References: pkg/…/connections.go• L2074-2080 pkg/…/manager.go• L157-160 pkg/…/cloud.go• L12-60 templates/…/.bruin.yml• L1-10 cmd/init_template_test.go• L115-148
Service endpoint selection
The client uses the production Cloud API by default. BRUIN_CLOUD_BASE_URL can point the client to another compatible service. This supports local test servers and controlled alternate environments without changing command behavior.
References: pkg/…/api.go• L18-60 pkg/…/api_test.go• L14-20
Agent impersonation
The bruin cloud act-as workflow lets a user run later Cloud commands with an agent's permissions. It uses the user's global login to request a short-lived agent token, stores the session in the local credential store, and renews it near expiry. The session is bound to its Cloud API destination and team so a command cannot silently use the agent against another environment or team.
If the global login lacks permission to act as agents, an interactive terminal can re-authenticate the global login and retry. Machine-readable output does not open a browser. It returns the re-authentication guidance instead.
The workflow has three states:
| Action | Effect |
|---|---|
bruin cloud act-as --agent-id <id> | Start or replace the local agent session. |
bruin cloud act-as | Show the active session and its expiry. |
bruin cloud act-as --stop | Clear the session and return commands to the user's login. |
An API key supplied by the flag or BRUIN_CLOUD_API_KEY still wins over the session. A session that expires or loses access ends with an error rather than silently switching to a different team. Global logout also clears the act-as session. If another command stops or replaces a session while renewal is in progress, the newer state remains in force.
References: cmd/cloud.go• L31-42 cmd/cloud_act_as.go• L31-139 cmd/cloud_act_as.go• L155-234 cmd/cloud_act_as_test.go• L146-227 cmd/cloud_act_as_test.go• L278-407
API client behavior
The API client is the shared boundary between Bruin Cloud resources and callers such as the CLI. It adds authentication and optional team scope to each request. It returns typed data for stable resources and preserves raw JSON where Cloud owns a changing data shape.
Request and response contract
Requests use JSON when they carry a body. Successful responses are decoded into resource values or raw JSON. HTTP error responses become an APIError with the status code and any field-level messages supplied by Cloud. This gives CLI workflows a single error form while keeping the upstream reason visible.
The client retries HTTP 429 responses up to the configured retry limit and honors the server's retry timing. It does not retry other error statuses. Authentication, validation, and server errors therefore return to the caller without repeated writes.
References: pkg/…/api.go• L62-129 pkg/…/api.go• L237-317 pkg/…/api_test.go• L41-200
Resource groups
The API presents Cloud as a set of related resource groups. The groups below show the role each group plays in the larger system.
| Resource group | Purpose |
|---|---|
| Teams and projects | Discover the account scope and the projects linked to source repositories. |
| Pipelines and assets | Inspect pipeline definitions, validation state, asset metadata, and quality information. |
| Runs and backfills | Start, inspect, retry, or mark execution results. A backfill is a group of runs made from split date ranges. |
| Instances and logs | Inspect the asset-level work inside a run and find the logs for a step or check. |
| Agents, threads, and queries | Manage Cloud agents and conversations. Attach data connections and run read-only SQL through the agent query service. |
| Data apps | Build and share small Cloud-hosted data applications from HTML, query manifests, and HTTP request manifests. |
| Dashboards, folders, and semantic layers | Manage dashboard definitions, active filter selections, team folders, and shared semantic model definitions. |
| Scheduled agents | Define recurring agent work, trigger it early, keep run-state files between executions, and optionally link success to a pipeline trigger. |
| Connections and connection sets | Store Cloud-side data access and group full connection definitions for agent use. |
| Skills, glossary, audit logs, notification rules, and cost explorer | Support shared agent guidance, data terms, team activity review, alert rules, and warehouse cost analysis. |
References: pkg/…/api.go• L132-1166 pkg/…/api.go• L1433-1504 pkg/…/types.go• L8-515 pkg/…/types.go• L600-656 cmd/cloud.go• L31-60
Database-facing operations
The database-facing side has two distinct paths. The Bruin Cloud connection adapts a token for the ingestion system. The agent query operation uses a Cloud-managed agent connection for a read-only SQL request.
Ingestion URI
The fully qualified adapter in home/…/db.go accepts a bruincloud.Config and returns the URI bruin://?api_token=.... The URI carries the token in encoded query form so the normal connection framework can pass Cloud access to a downstream ingestion operation.
The adapter does not expose tables, run queries, or manage projects. Those operations belong to the Cloud API client and its CLI workflows. This split keeps data connection handling separate from Cloud resource management.
References: pkg/…/config.go• L7-20 pkg/…/db.go• L3-19
Agent query interface
The agent query interface runs a read-only SQL query in Cloud against a named connection available to an agent. It returns column names, column types, rows, and the SQL rendered by the service. The SQL is sent as written and does not support template variables.
This path is separate from the local ingestion URI. A caller must select an agent connection that Cloud makes available, and a non-read-only query is returned as an API error. Query result numbers keep their full JSON precision so large integer values do not change during decoding.
References: pkg/…/api.go• L526-579 pkg/…/api_test.go• L1772-1836
CLI workflows
The bruin cloud command is the main user interface for Cloud management. Every runnable subcommand shares token lookup, optional team targeting, and plain or JSON output. The same workflow can therefore serve an interactive terminal or a script.
Resource discovery
Engineers normally begin by discovering the account scope and resource IDs. The discovery path moves from teams to projects. It then moves from projects to pipelines and assets.
flowchart TD
T[teams list] --> P[projects list]
P --> PL[pipelines list or get]
PL --> A[assets list or get]
A --> R[runs and instances]
Use bruin cloud teams list to find team prefixes and bruin cloud projects list to find project IDs. Use --output json when a later command or tool needs stable machine-readable data.
References: cmd/cloud.go• L279-329 cmd/cloud.go• L469-639 cmd/cloud_test.go• L331-365 cmd/cloud_test.go• L442-572
Project repository connection
bruin cloud projects create links a source repository to a new Cloud project. A GitHub repository can use the Bruin GitHub App when no Git token is supplied. GitLab, Bitbucket, and other supported provider cases use a personal token and an explicit or inferred provider. The command can also create the project without parsing its pipelines yet.
This workflow keeps repository access separate from the Cloud API token. The Cloud token authorizes the project request, while the repository access choice lets Cloud read the source that it will track.
References: cmd/cloud.go• L522-639 cmd/cloud_test.go• L452-576
Pipeline execution and diagnosis
Pipeline commands connect a local operator to a Cloud execution without running the pipeline in the local process. runs trigger starts a run for a required date range. It can narrow the work to assets, include downstream assets, force a full refresh, attach variables or tags, or split the range into a backfill. runs rerun can repeat all work or only failed assets.
The CLI can mark either the whole run or one asset within the run as success or failed. For an asset-level change, it first resolves the asset's step instances and sends their IDs so the rest of the run keeps its current status.
Inspection commands then follow the run from summary to cause. The CLI can select a run by ID or resolve the latest run. It can list asset instances, show step logs, collect failed-step logs, or produce a diagnosis that combines run details, asset status, and likely error lines. JSON output provides the same report shape for automation.
References: cmd/cloud.go• L950-1667 cmd/cloud.go• L1671-1777 cmd/cloud.go• L1780-1898 cmd/cloud_test.go• L578-684 pkg/…/api.go• L205-473
Cloud connection workflows
Connection commands move data access from a local project into Cloud. connections add reads a named connection from the selected .bruin.yml environment by default, or accepts credentials as JSON. connection-sets create and update group selected local connections so an agent can use them as a Cloud-side set.
The CLI resolves project-relative configuration and secret-backed connections before sending them. A local service_account_file is converted to its file content because the Cloud runner cannot read the engineer's local filesystem. Connection-set updates are full replacements. The submitted list becomes the complete set.
Agent connection commands follow the same boundary. They list only connection names and types. When adding a connection, they send the credential-bearing configuration to Cloud without returning credentials in the result. An agent can also request a connection while it is running in a Cloud chat; that request uses the agent and thread IDs supplied by the Cloud run context rather than caller-selected IDs.
References: cmd/cloud.go• L2588-2757 cmd/cloud.go• L4374-4901 cmd/cloud_test.go• L386-403 cmd/cloud_test.go• L734-798 pkg/…/api.go• L526-547 pkg/…/api.go• L789-859
Agent and scheduled work
Agent workflows support both direct conversations and recurring work. Engineers can create or update agents, send messages in new or existing threads, inspect message status, manage prompts and long-term memory, export threads, and attach external MCP services through named connections. Threads can be renamed, archived, restored, or deleted. Active messages can be steered or stopped when their state allows it. Team skills provide reusable instruction blocks that can be attached to selected agents or all agents.
MCP selection is a full replacement at the API boundary. The CLI reads the current picks before it adds or removes one kind. This keeps other configured kinds attached during a change.
Agent IDs, thread IDs, message IDs, and related resource IDs must be positive when the CLI uses them. Invalid explicit IDs fail locally instead of becoming a request for a different resource or a less useful remote error. Steering can use IDs from the current Cloud run environment, while a normal message remains the fallback when no running message can be steered. Stopping selects the latest pending or processing message when no message ID is given.
An agent message or scheduled run can request structured output through a JSON Schema object. The schema is accepted inline or from a file and is sent only when a new thread starts for a direct message. Scheduled agents use the same contract for each run. A scheduled-agent update can remove the schema so later runs return plain text.
Scheduled agents turn an agent plan into recurring work. The plan can include a cron schedule, time zone, instructions, output format, data connection, and thread reuse. The CLI can create or update the plan and can trigger it outside its schedule. A scheduled agent can also keep named run-state files across executions. A plan with a schedule can be activated through the lifecycle commands, while a plan without one remains a draft until a schedule is added.
Pipeline triggers are a separate scheduled-agent relationship. The scheduled-agents pipeline-trigger get, set, and delete commands manage the pipeline that responds to a scheduled agent's successful completion. Setting a trigger requires a scheduled-agent ID, project ID, and pipeline name. Getting or deleting it needs only the scheduled-agent ID. These operations do not change the agent plan or activate the agent.
Notification integrations are also outside scheduled-agent plan state. If a plan includes notification_integrations, the CLI rejects it and directs the user to set notification channels under the scheduled agent's Notifications page.
The plan builder rejects pipeline_trigger and output_schema inside plan state. This keeps trigger and structured-output changes separate from plan changes. It also prevents a plan update from silently changing the pipeline relationship or output contract.
References: cmd/cloud.go• L2556-4369 cmd/cloud.go• L6385-7119 cmd/cloud.go• L6970-7089 cmd/cloud.go• L4258-4310 cmd/cloud_test.go• L710-1137 cmd/cloud_test.go• L1448-1466 pkg/…/api.go• L493-787 pkg/…/api.go• L861-1106 pkg/…/types.go• L379-416
Data app workflows
Data apps are small Cloud-hosted applications made from HTML plus declared query and HTTP request manifests. An app runs its queries through a selected Cloud agent and can be private or visible to the team. The team settings define whether warehouse queries are read-only and which external domains may receive credentials.
The CLI supports the data app lifecycle from discovery to local editing:
- Read
bruin cloud data-apps guidebefore building or changing an app. The guide is a versioned skill for the coding agent that creates the app. - Use
data-apps list,settings,create, andgetto discover apps, team limits, ownership details, and declared resources. - Use
data-apps pullto write data-app.html, data-app.queries.json, and data-app.http.json into an editing folder. The folder also records the app ID and version in .bruin-data-app.json. - Edit one or more files and use
data-apps pushto save only the files supplied. A push based on a pull checks the recorded version so a later Cloud edit does not get overwritten by accident. - Use
data-apps updatefor the title or agent anddata-apps deleteto remove the app.
The pull and push boundary protects both local and Cloud changes. Pull refuses to overwrite changed local files unless --force is used. Push refuses a stale Cloud version unless --force is used. Query and HTTP manifests must be JSON arrays. A missing manifest in a directory push remains unchanged in Cloud, so partial edits do not clear unselected resources.
This diagram shows the normal data app editing loop and its two version checks.
flowchart LR
G[data-apps guide] --> C[data-apps create]
C --> P[data-apps pull]
P --> F[Local HTML and manifests]
F --> S[data-apps push]
S --> V{Expected version matches?}
V -->|yes| U[New Cloud app version]
V -->|no| R[Pull again or use --force]
References: cmd/cloud.go• L39-54 cmd/cloud_data_apps.go• L20-708 cmd/cloud_data_apps_test.go• L17-337 pkg/…/api.go• L1433-1504 pkg/…/types.go• L600-656
Dashboard and governance workflows
Dashboard commands create, inspect, update, publish, and remove Cloud dashboards. A dashboard can belong to a named team folder. Folders can nest, and the CLI can list them with counts and show its tree. Create and update can place or move a dashboard by folder name; update can use none to remove its folder. The commands can also read version history. Definitions may come from JSON or YAML supplied inline or from a file. Create and update write definitions as drafts, while dashboards publish makes a reviewed draft live.
Dashboard input is checked before it reaches Cloud. A definition must be one JSON or YAML object, and a command cannot use both inline state and a state file. Explicit non-positive dashboard or agent IDs are rejected locally. The dashboards apply-filters workflow accepts a JSON object of typed filter values and reports filters that Cloud ignores because the dashboard does not declare them. This keeps draft creation, publication, and active filter selection separate operations.
Dashboard notes add written context to a dashboard. dashboards notes list shows the notes and the semantic models or supported dashboard filters that can scope them. dashboards notes create sends note content with an optional model and JSON dimension values. When it can read the dashboard context, the CLI checks that the model belongs to the dashboard before creating the note. Cloud checks the note's access and dimension rules, so a user-scoped token and valid model dimensions remain part of the contract.
Audit-log commands provide a read-only view of team activity for personal tokens. Notification-rule commands expose the rule schema and let teams create, replace, list, and remove rules. Rules can come from one inline JSON or YAML object or one file. These workflows help connect resource changes and run activity to operational review.
References: cmd/cloud.go• L5212-6383 cmd/cloud_dashboard_notes.go• L19-328 cmd/cloud_dashboard_notes_test.go• L46-341 cmd/cloud.go• L7420-7721 cmd/cloud_test.go• L684-705 cmd/cloud_test.go• L1139-1241 pkg/…/api.go• L943-1091 pkg/…/types.go• L336-374
Semantic layer workflows
Semantic layers are shared team model definitions that Cloud can expose to dashboard and agent features. The CLI can list layer metadata, inspect a layer's full model, create a named layer, partially update its name or model, and delete it.
Create and update accept the model as JSON or YAML from exactly one inline value or one file. The CLI requires an object and rejects invalid or empty definitions before sending them. Updates are partial, so a name-only change leaves the model unchanged. These commands use positive semantic-layer IDs and support plain or JSON output like the other Cloud workflows.
References: cmd/cloud.go• L5232-5545 cmd/cloud_test.go• L1243-1318 pkg/…/api.go• L1093-1140 pkg/…/types.go• L404-411
Cost and usage workflows
Cloud also exposes operational views for AI use and warehouse cost. Agent usage statistics summarize messages and threads over a relative day window or an explicit date range. The cost explorer first exposes valid dimensions, filters, and time buckets, then returns cost rows for a selected date range and warehouse platform.
Cost filters use field:op:value. Repeated values for an in filter are combined by field before the request is sent. JSON output preserves the response for scripts, while plain output shows the selected grouping and cost measures.
References: cmd/cloud.go• L3860-3950 cmd/cloud.go• L7497-7721 cmd/cloud_test.go• L1796-1835
AI workflow relationship
AI-enabled project workflows can add a placeholder Bruin Cloud connection when a project needs Cloud-backed AI features. The AI command path writes that connection into the project's default environment and leaves the real token to the user's secret source. See AI workflows for the AI command flow and connection setup context.
References: cmd/ai.go• L7-17 cmd/ai_connections.go• L43-87 cmd/ai_connections.go• L165-196
Change checklist
When these files or sections are changed, remember to consider these:
- When token lookup changes, keep the precedence between
--api-key,BRUIN_CLOUD_API_KEY, act-as sessions, thebruinconnection, and global login aligned with automation and secret resolution. - When act-as behavior changes, keep global-login use for token exchange, interactive re-authentication, session expiry renewal, team and API-destination pinning, API-key precedence, concurrent session replacement, and logout cleanup aligned.
- When default-team configuration changes, keep
--team,BRUIN_CLOUD_TEAM,cloud.default_team, global login scope, act-as team scope, and theX-Bruin-Teamrequest header aligned. - When team flags are added to the command tree, keep the rule that runnable resource commands target a team while
config,login, andlogoutremain local. - When the Cloud connection schema changes, update both the
bruinconfiguration type and thebruin://ingestion URI contract. - When an endpoint response shape changes, check the typed resource models, raw-JSON paths, and agent query result decoding together.
- When team or project scoping changes, keep discovery commands and the
--teamor--project-idresolution rules consistent. - When project repository access changes, keep GitHub App behavior, personal-token requirements, provider inference, branch defaults, and the
do_not_parserequest field aligned. - When connection-set or MCP behavior changes, preserve the distinction between listing metadata and sending full credential-bearing or full replacement configurations.
- When query access rules change, keep the read-only contract and the absence of template variables aligned between the API client and its callers.
- When data app fields or guide versions change, keep the guide reference, app resource shape, pull files, push payload, and recorded local version aligned.
- When data app editing rules change, keep partial file pushes, manifest-array validation, local overwrite protection, stale-version checks, and
--forcebehavior aligned. - When dashboard folder or publication behavior changes, keep folder listing, parent and path data, dashboard folder fields, draft state, version history, and publish operations aligned.
- When dashboard input rules change, keep JSON/YAML object parsing, inline-versus-file exclusivity, positive resource IDs, draft publication behavior, and active filter selection aligned.
- When dashboard note behavior changes, keep note content, semantic-model context, supported filter dimensions, user-token access, and server-side dimension validation aligned between the CLI and API.
- When semantic-layer behavior changes, keep list metadata, full model retrieval, partial updates, JSON/YAML state parsing, and positive ID validation aligned between the CLI and API.
- When structured output changes, keep JSON-only schema parsing, inline-versus-file exclusivity, new-thread restrictions, scheduled-run fields, and schema clearing aligned.
- When scheduled-agent fields change, keep plan updates separate from pipeline-trigger operations, notification settings, run-state files, and the trigger's project-and-pipeline identity.
- When scheduled-agent lifecycle rules change, keep same-thread behavior, run-state persistence, manual trigger behavior, schedule requirements, and activation state aligned.
- When agent message-control rules change, keep running-message discovery, pending-message stop rules, Cloud run IDs, positive ID validation, and the fallback to sending a new message aligned.
- When cost explorer fields change, keep schema discovery,
field:op:valueparsing, repeatedinvalues, date ranges, pagination, and platform selection aligned. - When agent, dashboard, or scheduled-agent lifecycle rules change, update the CLI message that tells the user which state still needs Cloud UI action.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| No token is available from the flag, environment, act-as session, project connection, or global login | The CLI cannot create a Cloud client and exits before making a request. | Provide --api-key, set BRUIN_CLOUD_API_KEY, configure a bruin connection, or complete the bruin cloud login flow. |
BRUIN_CLOUD_API_KEY is set while an act-as session is active | Commands use the API key instead of the agent's permissions. | Unset the environment value when agent permissions are required. |
| The global login cannot act as agents | Agent start fails unless an interactive terminal re-authenticates with the required permission. | Run bruin cloud login --global --reauth, or allow the interactive retry to open the browser; do not expect JSON output to open it. |
| An act-as session is pinned to another team or API destination | Cloud authentication stops before a request can use the wrong scope or service. | Stop the session and start a new one for the intended team and destination. |
| An act-as token expires and renewal fails after the old token expires | The command reports that acting as the agent has ended. | Restore the user's global login and access to the agent, then start act-as again. |
| A session is stopped or replaced while its token is renewing | The completed renewal does not restore the old session, and the command rechecks the newer state. | Let the newer stop or replacement complete; start a new session if needed. |
A token can access several projects and --project-id is omitted | Pipeline and run workflows cannot identify the target project. | List projects first and pass the selected project ID. |
An invalid or unintended company prefix is passed to --team or saved as the default | Requests run against the wrong team or fail with a Cloud authorization error. | Get prefixes from bruin cloud teams list and confirm token access before saving or using one. |
| A runnable command is changed without the shared team flag | The command cannot target the same team scope as its sibling workflows. | Keep team-flag propagation on all runnable resource commands. |
| A repository needs a personal Git token but no token or provider is supplied | Project creation fails or Cloud cannot read the repository. | Use the GitHub App only for GitHub access without a token; otherwise provide a token and a supported or inferable provider. |
| Cloud returns HTTP 429 repeatedly | The client retries the request and then returns the final rate-limit error. | Reduce request rate and honor the server retry window. |
| A resource ID is zero or negative | The CLI stops before the API call instead of targeting an invalid or unintended resource. | Pass a positive agent, thread, message, dashboard, data app, scheduled-agent, semantic-layer, connection-set, or notification-rule ID. |
| A connection-set or MCP replacement omits an existing item | The omitted connection or MCP kind is detached. | Read the current set and submit the complete intended list. |
| A local file path is sent as a Cloud runner credential | The runner cannot read the engineer's local path and the connection cannot work remotely. | Let the CLI inline supported file content before sending the connection. |
| An agent connection request is run outside a Cloud thread context | The CLI rejects the request without calling the API, so no request card can be shown. | Run the request from the Cloud chat context that supplies valid agent and thread IDs. |
| Agent steering or stopping has no valid agent/thread IDs or no eligible message | The CLI does not send a control request, or Cloud rejects it because the message is not running, pending, or processing. | Run inside the Cloud context or pass positive IDs; steer a running message and stop only a pending or processing message. |
| An agent query uses a write statement or assumes template variables | Cloud rejects the query or receives a query different from the caller's intended contract. | Use read-only SQL and send the complete query text. |
| A data app has no agent | Its declared queries cannot run until an agent is assigned. | Set an agent during create or with bruin cloud data-apps update --agent-id. |
A pull would overwrite changed local app files without --force | The CLI stops and keeps the local edits. | Review the changes or pass --force only when the Cloud copy should replace them. |
| A push uses a stale recorded or explicit app version | Cloud rejects the save with a version conflict and the local recorded version stays unchanged. | Pull again and re-apply the edit, or use --force when overwriting the Cloud change is intended. |
A data app manifest is not a JSON array, or a push combines --dir with file flags | The CLI rejects the push before sending app content. | Use one input mode and provide each manifest as a JSON array. |
| A structured output schema is not a JSON object, is supplied twice, or is attached to an existing direct thread | The CLI rejects the request before Cloud receives it. | Supply one valid JSON object from inline input or a file, and use schemas only when starting a new direct thread. |
| A pipeline trigger, output schema, or notification integration is included in scheduled-agent plan state | Plan create or update fails before Cloud receives the request. | Manage each concern through its dedicated CLI option or workflow. |
| A dashboard definition is sent as both inline state and a state file, or is not an object | The CLI rejects the ambiguous or invalid request before Cloud receives it. | Use exactly one state source and provide a JSON or YAML object. |
| A dashboard filter is not declared by the dashboard | Cloud drops that filter from the applied selection. | Use the dashboard's declared filter names and inspect the ignored list in the command result. |
| A dashboard draft is not published after review | The new definition remains invisible to viewers. | Review it, then run bruin cloud dashboards publish --dashboard-id <id>. |
| A dashboard note is created with a team-scoped token | Cloud rejects the create request because note creation needs a user-scoped token. | Use a user-scoped token for bruin cloud dashboards notes create. |
| A note names a model that the dashboard does not use | The CLI rejects the note before the create request when it can read the dashboard's note context. | Use a model listed by bruin cloud dashboards notes list, or omit --model to use the dashboard context. |
| Note dimension values do not satisfy the dashboard's model or filter rules | Cloud returns a validation error and does not create the note. | Use the dimensions shown by the notes listing and provide values in the required JSON object. |
A semantic-layer state is invalid, empty, or supplied through both --state and --state-file | The CLI rejects create or update before Cloud receives it. | Supply one non-empty JSON or YAML object. |
| A scheduled agent has no schedule when activation is requested | Cloud cannot run the scheduled task. | Set a valid schedule before activating it. |
| A scheduled agent uses same-thread mode when a clean conversation is needed | Later runs continue the existing thread and retain its context. | Disable same-thread mode or use scheduled-agents reset-thread before the next run. |
| An agent is deleted | Its scheduled agents, dashboards, and threads are also removed, and its Cloud CLI token is revoked. | Confirm the agent ID and dependent resources before deletion. |
A cost filter does not use field:op:value or a requested dimension is not in the schema | The CLI rejects the filter or Cloud rejects the cost request. | Read bruin cloud cost schema first and use the documented filter form. |
A dashboard folder is changed with an unintended name or with a value other than none when removal is needed | Cloud places the dashboard in the wrong folder or creates a new folder instead of clearing the assignment. | List folders first and use the exact folder name; use none to remove the assignment. |
Key files
| File | Why to read it |
|---|---|
| cmd/cloud.go | Defines the Cloud command tree and shows how discovery, project connection, execution, asset status, connection, agent, data app, dashboard, semantic-layer, scheduled-agent, cost, audit, and local team configuration workflows join the shared client setup. |
| cmd/cloud_auth.go | Defines the order for API-key, act-as, repository, and global-login authentication and the final team scope used by the client. |
| cmd/cloud_act_as.go | Defines agent impersonation, session status, renewal, re-authentication guidance, team pinning, and return to the user's login. |
| cmd/cloud_act_as_test.go | Covers act-as start, status, stop, precedence, interactive re-authentication, renewal, expiry, concurrent session changes, and cleanup during logout. |
| cmd/cloud_data_apps.go | Defines the data app guide, settings, lifecycle, local pull and push files, version checks, and partial update workflow. |
| cmd/cloud_data_apps_test.go | Covers data app guide and settings output, lifecycle requests, local edit protection, version conflicts, manifest validation, and exact number handling. |
| cmd/cloud_dashboard_notes.go | Defines the dashboard note listing and creation workflow, including model context display and note input checks. |
| cmd/cloud_dashboard_notes_test.go | Covers dashboard note output, context-aware model checks, dimension input, token access errors, and Cloud validation errors. |
| cmd/cloud_pipeline_trigger.go | Defines the CLI boundary for reading, setting, and removing a scheduled agent's pipeline-success trigger. |
| pkg/…/api.go | Defines the Cloud API boundary, authentication behavior, team scope, retry policy, resource operations, data app lifecycle, query contract, and request error contract. |
| pkg/…/pipeline_trigger.go | Defines the API operations for a scheduled agent's pipeline trigger. |
| pkg/…/types.go | Describes the resource shapes returned by Cloud and the boundary between typed data and raw JSON. |
| pkg/…/cloud.go | Shows how cloud.default_team is added, changed, or removed while preserving the rest of project configuration. |
| pkg/…/config.go | Shows how a Cloud token becomes a bruin:// ingestion URI. |
| pkg/…/db.go | Shows the database-facing connection interface used by the ingestion system. |
| pkg/…/connections.go | Defines the sensitive bruin connection entry used in .bruin.yml. |
| cmd/cloud_test.go | Covers CLI contracts for credential lookup, team selection, shared team flags, project repository access, project resolution, default-team persistence, run execution and diagnosis, agent context and message control, structured output, scheduled-agent plans and run state, dashboards, filters, notes, semantic layers, cost explorer, and workflow validation. |
| cmd/cloud_pipeline_trigger_test.go | Covers pipeline-trigger CLI methods, request payloads, output forms, validation, and separation from scheduled-agent plan state. |
| pkg/…/pipeline_trigger_test.go | Covers optional trigger responses and scheduled-agent decoding. |
| pkg/…/api_test.go | Covers request headers, error handling, rate-limit behavior, resource operations, dashboard folders, agent query restrictions, semantic-layer operations, and numeric response precision. |
| cmd/ai_connections.go | Shows how AI workflows add a placeholder Cloud connection to a project configuration. |
| templates/…/.bruin.yml | Gives the smallest project example that combines a Bruin Cloud connection with a local database connection. |