cxas push¶
cxas push uploads a local agent directory to CX Agent Studio, either updating an existing app or creating a fresh one — it's how your local edits make it into the platform.
Usage¶
cxas push [--app-dir DIR] [--to TARGET] [--env-file FILE]
[--app-name APP] [--display-name NAME]
[--create-version] [--version-name NAME] [--version-description DESC]
[--overwrite]
[--project-id PROJECT] [--location LOCATION]
Options¶
| Option | Required | Default | Description |
|---|---|---|---|
--app-dir DIR | No | . (current directory) | Path to the local agent directory to upload. |
--to TARGET | No | — | Target app to overwrite. Accepts a full resource name or display name. When provided, the existing app is updated in place. |
--env-file FILE | No | — | Path to a JSON environment file to inject as environment.json before uploading. Useful for supplying environment-specific resource bindings and resolving "$env_var" placeholders in app.json / app.yaml variableDeclarations, tools/, and toolsets/ without committing secrets or per-stage overrides. |
--app-name APP | No | — | Explicit app resource name to push to (v1beta API). Use this when you want to overwrite a specific app and already know its full ID. |
--display-name NAME | No | "Pushed Agent" | Display name for the new app when no target is specified and a new app will be created. |
--create-version | No | false | Automatically create a version snapshot after a successful push. |
--version-name NAME | No | import-TIMESTAMP | Custom display name for the created version snapshot (used with --create-version). |
--version-description DESC | No | — | Description text for the created version snapshot (used with --create-version). |
--overwrite | No | false | Overwrite existing resources with imported data. Unmatched existing resources will be deleted. |
--project-id PROJECT | No | — | GCP project ID. Required for a display-name target or when creating a new app. Inferred from a full target resource name. |
--location LOCATION | No | — | GCP location (e.g., global, us-central1). Required for a display-name target or when creating a new app. Inferred from a full target resource name. |
What Gets Uploaded¶
The CLI bundles the following top-level items from --app-dir into a ZIP archive before uploading:
app.yaml/app.jsonglobal_instruction.txtenvironment.json(or the file you pass via--env-file). Place app-level settings under"app": { ... }and component settings under"tools","toolsets","agents", or"guardrails"keyed bydisplayName(or directory name). Any boolean"$env_var"placeholders or per-environment boolean overrides on CES protobufboolfields (such asapp.pinned,app.loggingSettings.bigqueryExportSettings.enabled,app.loggingSettings.cloudLoggingSettings.enableCloudLogging,app.loggingSettings.conversationLoggingSettings.disableConversationLogging,app.loggingSettings.redactionConfig.enableRedaction, oropenApiTool.ignoreUnknownFields) are resolved into the staged.json/.yamlmanifests as native booleans before archiving.cxas lint(V001–V007) likewise resolves boolean"$env_var"placeholders fromenvironment.json(or accepts"$env_var"on protobufboolfields when--env-fileis supplied externally at push time).agents/,tools/,guardrails/,toolsets/evaluations/,evaluationDatasets/,evaluationExpectations/.github/workflows/
Everything else in the directory (e.g. .git, local test output) is ignored.
Environment-Specific Variable Defaults ($env_var)¶
When a variable in app.json (or app.yaml) sets "default": "$env_var", cxas push resolves its typed default from environment.json (or --env-file) inside a temporary staging directory before uploading — leaving your local working tree untouched.
Declare the placeholder in app.json:
{
"variableDeclarations": [
{
"name": "enable_authentication",
"description": "Whether caller authentication is enforced.",
"schema": {
"type": "BOOLEAN",
"default": "$env_var"
}
}
]
}
Supply the per-environment value under app.variableDeclarations in environment.json (or --env-file):
{
"app": {
"variableDeclarations": [
{
"name": "enable_authentication",
"schema": {
"type": "BOOLEAN",
"default": true
}
}
]
}
}
cxas push fails fast before uploading if --env-file is missing, a "$env_var" variable is absent from app.variableDeclarations, variableDeclarations is mistakenly placed at the top level of environment.json, or the supplied value does not match the declared schema type.
Environment-Specific Tool and Toolset Fields ($env_var)¶
When any tool under tools/<name>/<name>.{json,yaml} or toolset under toolsets/<name>/<name>.{json,yaml} uses "$env_var" (including connectorToolset.connection, mcpToolset.serverAddress / mcpTool.serverAddress, openApiTool / openApiToolset schema URLs and apiAuthentication.oauthConfig.clientId, connectorTool.connection, dataStoreTool engines/datastores, fileSearchTool.fileCorpus, remoteAgentTool.agentCard.supportedInterfaces[].url, applicationIntegrationTool.{integrationVersion,triggerId}, enterpriseAgentTool datasets/Cloud SQL connections, and googleSearchTool URLs/domains), cxas push resolves those values from environment.json (or --env-file) inside the staging directory before uploading — matching entries by displayName, nested tool name, or directory/file stem without mutating local files.
For example, declare "$env_var" in toolsets/cymbal_connector/cymbal_connector.json and toolsets/orders_mcp/orders_mcp.json:
{
"displayName": "cymbal_connector",
"connectorToolset": {
"connection": "$env_var",
"connectorActions": [
{
"entityOperation": {
"entityId": "Customers",
"operation": "LIST"
}
}
]
}
}
Supply the per-environment values under toolsets / tools in environment.json (or --env-file):
{
"toolsets": {
"cymbal_connector": {
"connectorToolset": {
"connection": "projects/my-gcp-project/locations/us-central1/connections/cymbal-prod"
}
},
"orders_mcp": {
"mcpToolset": {
"serverAddress": "https://mcp-prod.example.com/mcp/",
"apiAuthentication": {
"oauthConfig": {
"clientId": "orders-mcp-prod-client"
}
}
}
}
}
}
cxas push and cxas lint (A018) validate that every "$env_var" tool and toolset field resolves to a valid non-empty value (and matches the expected GCP resource name or HTTP/HTTPS URL format where applicable) before uploading.
Examples¶
Push the current directory to an existing app by display name:
Push a specific directory and create a new app with a custom display name:
cxas push \
--app-dir ./my-agent \
--display-name "My Support Agent (Staging)" \
--project-id my-gcp-project \
--location us-central1
Push current directory and create a version snapshot with a custom name:
cxas push \
--to "My Support Agent" \
--create-version \
--version-name "v1.2.0" \
--version-description "Release candidate v1.2.0" \
--project-id my-gcp-project \
--location us-central1
Push using a separate environment file (keeps secrets out of source control):
cxas push \
--app-dir ./my-agent \
--to projects/my-gcp-project/locations/us-central1/apps/abc123 \
--env-file ./secrets/env-prod.json \
--project-id my-gcp-project \
--location us-central1
Related Commands¶
cxas pull— Download an app to a local directory first.cxas create— Create an empty app shell before pushing.cxas ci-test— Run the full push + test lifecycle in CI.