Deploy, Redeploy & Undeploy
Agent swarms are deployed like other applications (see Deployments) — from the swarm's Choose Action › Deploy or the Deployments card. Deployments and undeployments run as jobs (Deploy Agent Swarm, Undeploy Agent Swarm) shown in the job list; their detail has one section per environment with the phases, tasks and messages, and Retry / Cancel per operation. For agents, CodeNOW does additional work in both directions.
Deploy
Choose Action › Deploy (or + Deploy in the Deployments card) opens the Create Deployment wizard.
- Agent Swarm Package / Package Labels — select the package version to deploy (Select agent swarm package).
- Environment / Label — select targets by environment name, by label, or both. A selected label targets all environments attached to it, listed under Resource Labels / Assigned Environments. Only environments whose cluster has an Agent Gateway can be deployed to: others are listed but disabled, with the suffix — No Agent Gateway on its cluster. When a selected label targets such an environment, it is shown among the label's environments with an amber warning icon (No Agent Gateway on its cluster: agents can't be deployed there). If such an environment is selected anyway (for example preselected from a link), the wizard shows <environment>: No Agent Gateway on its cluster. Agents can't be deployed there. and Deploy stays disabled. The same applies to Direct Deploy and to the environment selects of release, preview and trigger settings; in build triggers, an environment with twins of which only some have a gateway stays selectable and is marked No Agent Gateway on some of its clusters.
- Back / Next / Deploy — Next shows the second step Deployment Configuration with the configuration that will be used for each target; Deploy starts the deployment. When any target is a production environment, CodeNOW asks for an explicit confirmation first.
Without packages the wizard shows No agent swarm packages found / Please, create some agent swarm packages first. Without the right to deploy: You don't have the necessary rights to deploy the selected agent swarm package.
For each agent of the swarm, a deployment:
- checks the agent configuration — service account set, A2A connections filled in and valid;
- composes the agent's environment variables (see Agent Runtime);
- issues a token for the agent's service account — or reuses the token of the existing deployment, so a redeploy without changes does not restart the agent;
- registers the agent in the Agent Gateway of the environment's cluster, if its A2A endpoint is exposed;
- registers the agent's admin console sign-in address, if the agent has an external endpoint.
Changes of the agent configuration — service account, console access, A2A endpoint, A2A connections — take effect only after the agent is redeployed. A target agent deployed later starts working for its callers without redeploying them.
Deployment and undeployment of the same swarm in the same environment never run at the same time; they are processed one after another.
Redeploy
A redeploy (for example to apply a changed agent configuration) is started with Redeploy in the deployment's ⋯ menu on the Deployments card, or with the repair action on the deployment status. It runs as the same Deploy Agent Swarm job as a deployment, with the same steps — A2A validation, Agent Gateway provisioning and waiting for the rollout — and the same warnings. In the job history it is listed as a deploy. If the environment has a Deployment Approval rule, the redeploy waits for the approval of all groups, as a deployment does. The tooltip of Redeploy then says Approval will be requested first.; on the repair action, this text is added to its tooltip. A conflict is then shown as a failed quality gate task in the job run detail.
| Result | What you see |
|---|---|
| Started | Redeploy requested with the link Go to job run detail |
| No current deployment of the swarm in that environment | There is no current deployment to redeploy. |
| Invalid A2A connections (rejected before a job is queued) | The A2A validation message, e.g. Invalid A2A connections: … |
| Any other failure | Could not request deployment synchronization. |
Through the API, a redeploy without a current deployment returns 404 Deployment for <swarm>/<environment> was not found, invalid A2A connections return 400, a cluster without an Agent Gateway 409 and an unverifiable gateway state 503 — with the messages listed in Errors that stop a deployment. Nothing is queued.
Errors that stop a deployment
In the deploy wizard, an agent without a service account (Not set — this agent cannot be deployed.) or with an unfilled declared A2A connection is marked with a red error icon and Deploy stays disabled. When a deployment is started anyway (for example through the API), it fails with:
| Cause | Message (shortened) |
|---|---|
| No service account | Agent component … has no agentGateway.serviceAccountId configured - configure a service account on the agent's deployment configuration (agent configuration tab) or remove the agent from the package |
| Service account missing | service account … referenced by agent … does not exist in account … |
| Service account disabled | … is disabled: enable it or pick another one in the agent's deployment config |
| Expired secrets | … has expired secret bindings: … - rotate or unbind them in account before deploying |
| A2A connection without target (Deploy and Redeploy of an agent swarm only) | Invalid A2A connections: … declared A2A connection has no target … |
| A2A connection to an agent on another cluster | Invalid A2A connections: agent '<agent>' connection '<name>': targets environment '<environment>', which has no twin on cluster <cluster> (agents can only call agents on their own cluster's gateway) — a twin is an environment of the same name on another cluster |
The environment's cluster has no Agent Gateway (409, before the job is queued) | Agents cannot be deployed to <environment> (cluster <cluster>): no Agent Gateway is installed on the environment's cluster. Install the Agent Gateway on that cluster or deploy to an environment whose cluster has one. — with several targets the list reads e.g. dev (cluster c2), test (cluster c3) |
The gateway state cannot be checked right now (503) | Cannot verify that the environment's cluster has an Agent Gateway (customer-cluster unavailable). Try again later. |
| The gateway has no address | The Agent Gateway on cluster <cluster> of account <account> has no url |
| Gateway address cannot be parsed | The Agent Gateway endpoint (AI_GATEWAY) URL '…' of account … cannot be parsed - cannot derive the A2A agent URLs |
If the gateway disappears between the request and the deployment, the job fails with the same Agents cannot be deployed to … message.
The gateway and A2A cluster checks apply to every way of deploying agents:
- Deploy and Redeploy of an agent swarm — refused with
409,503or400. Any refused target refuses the whole request. The gateway check applies whatever the package contains. Only here all A2A connections are validated, including declared ones without a target; preview deployments, builds and the V1 API check only that targets are on the same cluster. - The V1 application deployment API — refused the same way, but only when the package contains agents.
- Direct Deploy of an agent — refused the same way. With several targets, see below.
- Builds with a target environment (preview or release) — the build itself stays successful, but its post-build processing fails and nothing is deployed to the refused environment. The message is Error during post-build processing: followed by the text from Errors that stop a deployment — Agents cannot be deployed to …, Cannot verify that the environment's cluster has an Agent Gateway … or Invalid A2A connections: … — cut to 300 characters (with several targets, each target's message is cut on its own and the whole text is not).
- Remote debug of an agent swarm deployment — changing it is refused with
409,503or400and the setting stays as it was.
When Direct Deploy or a build has several targets, a refused target does not stop the others, and the message names the refused ones:
Refused on <n> of <total> targets: <environment> (cluster <cluster>): <message>; <environment> (cluster <cluster>): <message>
The (cluster …) after the environment is left out when the request names no cluster. If a target fails for another reason, ; another target failed: <description> is appended (the error's class name when it has no description) and the remaining targets are not started; a refusal not collected by then is not named. Direct Deploy then returns the refusals' common status (409, 503 or 400), otherwise 409 — other targets may have been started even though the response is an error. With a single target, the message and status are the same as for Deploy.
A refused target saves no deployment. The gateway check of a preview or direct deploy comes before anything is written. A2A connections are checked only by the deployment itself, on the version being deployed, so after an A2A refusal the preview package and its configuration can remain — and a preview of a version that removes a connection to another cluster is deployed. A release build's package exists even after a refusal.
Warnings
The deployment succeeds but reports agents that could not be registered in the Agent Gateway. In the job detail the task stays Completed, its Message shows the warning in amber with a warning icon, and the collapsed phase row shows a warning icon (1 warning / N warnings):
- <n> agent(s) not registered in Agent Gateway (no usable internal endpoint): <agents>
Such agents run but cannot be called through the gateway. If the gateway of a cluster is uninstalled after the deployment, its agents become unreachable and CodeNOW does not redeploy them — see Uninstalling a Gateway.
The deployment (and a redeploy) also reports service-account secrets that were not passed to an agent or that replaced another variable. They are shown in the job detail as the warning of the step that waits for the rollout — the step still completes; several warnings are joined with ; :
- Service-account secret <ENV_NAME> was not passed to agent <agentId>: the name is reserved for CodeNOW. — rename the secret (see Reserved names).
- A service-account secret without an environment variable name was not passed to agent <agentId>.
- Service-account secret <ENV_NAME> overrides the environment variable of the same name (agent <agentId>). — the secret wins over the component's own environment variable.
Undeploy
Use Undeploy (the power icon) on a deployment in the Deployments card and confirm Are you sure you want to undeploy <swarm> from <environment>? — Request to undeploy sent successfully.
If the environment has a Deployment Approval rule, the undeployment first waits for the approval of all groups. Until then, whoever started it can cancel it on the Pending Approval tab.
Undeploying an agent swarm from an environment runs as the Undeploy Agent Swarm job with four steps:
| Step | What it does |
|---|---|
| Delete | Removes the swarm's workloads from the environment |
| Agent Gateway deregistration | Removes the agents from the Agent Gateway of the environment's cluster |
| Redirect URI removal | Removes the agents' admin console sign-in addresses |
| Token release | Revokes the service-account tokens of the agents |
If one step fails, the job ends as failed, but the following steps still run. If the job cannot be started, the deployment stays deployed: Undeploy was rejected by job-controller (…); the deployment was left deployed.
A token is also revoked when an agent is removed from the swarm or switched to another service account.