$ anypoint-cli-agent-fabric-plugin conf client_id myClientID $ anypoint-cli-agent-fabric-plugin conf client_secret myClientSecret $ anypoint-cli-agent-fabric-plugin conf organization myOrgId
Build Agent Networks in a CI/CD Environment
Use the Anypoint CLI Agent Fabric plugin in CI/CD pipelines to configure agent network gateways, create and build projects, and publish and deploy networks from the command line, matching the lifecycle you can drive from Anypoint Code Builder. Automating these steps keeps environments aligned, lets you embed approvals, secrets, and quality gates in the pipeline, and avoids one-off scripts when you promote from development to staging and production.
For installation, package updates, and release details, see Anypoint CLI Agent Fabric Plugin on npm.
Before You Begin
If you’re using the Anypoint CLI to create agent network projects, ensure you install these requirements.
-
Node 20 (v20.19.4) or later. See Nodejs.org.
Follow the steps in the installer, and then from a terminal verify that
node -vreturns a Node 20 version. -
Java 17 or later. Set the
JAVA_HOMEenvironment variable. -
Anypoint CLI Agent Fabric Plugin
Install the Anypoint CLI Agent Fabric plugin by running this command in a terminal window:
npm install mulesoft-anypoint-cli-agent-fabric-plugin
Authentication
You can authenticate to Anypoint Platform through the command line by running the anypoint-cli-agent-fabric-plugin command with a combination of parameters.
Or, you can set a combination of environment variables before running the anypoint-cli-agent-fabric-plugin command. For more information, see Command-Line Parameters and Environment Variables.
Set configuration file authentication using a client ID and client secret from your connected app.
Add authentication values to the configuration file using these commands.
For more information, see Authentication to the Anypoint Platform CLI.
Create a Target Space for Your Environment
To deploy an agent network, you need a space on CloudHub 2.0 or a deployment target on Anypoint Runtime Fabric. See Set Up the Space or Deployment Target for Your Environment.
After you create a target space, set up the ingress and egress gateways for deployment if you haven’t already done so. See Set Up Agent Network Gateways for the Space or Deployment Target.
CLI for Agent Fabric Plugin Reference
Use these commands to set up gateways and author, publish, and deploy agent network projects.
| Command | Description |
|---|---|
Builds the agent network project and validates configuration |
|
Creates a new agent network project and generates the initial configuration files |
|
Deploys the agent network project to the target environment |
|
Publishes the agent network project to Anypoint Exchange |
|
Undeploys the agent network project and removes all deployed runtime resources |
|
Unpublishes the agent network project asset versions from Anypoint Exchange |
|
Sets up the gateways for the agent network |
agent-network:project:build
> anypoint-cli-agent-fabric-plugin agent-network project build [flags]
Builds the current agent network project using the Maven wrapper (mvnw or mvnw.cmd).
This command validates the configuration and generates the artifacts required for publishing and deployment.
In addition to the default flags, this command accepts these flags:
| Flag | Description | Example |
|---|---|---|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Enable debug mode |
|
|
Environment name |
|
|
Force update the dependencies |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Path to the project |
|
|
Username |
|
agent-network:project:create
> anypoint-cli-agent-fabric-plugin agent-network project create --name <projectName> [flags]
Creates a new agent network project in the current directory.
The command generates a project folder with initial configuration files, including agent-network.yaml.
In addition to the default flags, this command accepts these flags:
| Flag | Description | Example |
|---|---|---|
|
(Required) Name of the project |
|
|
Output directory for the project |
|
|
API version |
|
|
Asset name (GAV). Valid characters are 'A-Z', 'a-z', '0-9', '_' and '-'. |
|
|
Asset version (GAV) |
|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Create a new directory under |
|
|
Environment name |
|
|
Group ID (GAV) |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Tab size for indenting the API specification |
|
|
Username |
|
agent-network:project:deploy
> anypoint-cli-agent-fabric-plugin agent-network project deploy [flags]
Deploys the agent network application.
By default, the command uses single-gateway mode with the agent-network-gw gateway.
You can override this using the -g flag or switch to separate-gateways mode using -i and -e flags.
In addition to the default flags, this command accepts these flags:
| Flag | Description | Example |
|---|---|---|
|
Name of the target egress gateway (separate-gateways mode; requires |
|
|
Name of the gateway for single-gateway mode (recommended). Mutually exclusive with |
|
|
Name of the target ingress gateway. Combine with |
|
|
Name of the target space to deploy. In single-gateway mode, optional; when provided it must match the gateway’s target space (validated, not used for lookup). In separate-gateways mode, defaults to |
|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Disable tracing functionalities |
|
|
Do not wait for the agent network to be ready |
|
|
Environment name |
|
|
Host URL |
|
|
Max retries to check the status of the deploying application |
|
|
Organization name |
|
|
Password |
|
|
Path to the project |
|
|
Process timeout in milliseconds |
|
|
Property to override in |
|
|
Request timeout in milliseconds |
|
|
Username |
|
|
Format output as JSON |
|
Example
$ anypoint-cli-agent-fabric-plugin agent-network project deploy $ anypoint-cli-agent-fabric-plugin agent-network project deploy --property apiKey:sk-xxx $ anypoint-cli-agent-fabric-plugin agent-network project deploy --property apiKey:sk-xxx --property role:user $ anypoint-cli-agent-fabric-plugin agent-network project deploy --path ./my-project --property myAgent.url:https://api.example.com
agent-network:project:publish
> anypoint-cli-agent-fabric-plugin agent-network project publish [flags]
Publishes the current agent network project to Anypoint Exchange. The command outputs links and details for all created assets.
In addition to the default flags, this command accepts these flags:
| Flag | Description | Example |
|---|---|---|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Enable debug mode |
|
|
Environment name |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Path to the project |
|
|
Username |
|
|
Format output as JSON |
|
agent-network:project:undeploy
> anypoint-cli-agent-fabric-plugin agent-network project undeploy [flags]
Undeploys the agent network application, removing all deployed resources.
In addition to the default flags, this command accepts these flags:
| Flag | Description | Example |
|---|---|---|
|
API version used to discover remotely deployed resources when using |
|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Preview the deploy-plane resources that would be undeployed without deleting anything |
|
|
Environment name |
|
|
Parent asset GAV ( |
|
|
Host URL |
|
|
Format output as JSON |
|
|
Organization name |
|
|
Password |
|
|
Path to the project. Discovers deployed resources remotely from the project lock file. Requires an environment to be selected. Mutually exclusive with |
|
|
Process timeout in milliseconds |
|
|
Request timeout in milliseconds |
|
|
Username |
|
Examples
Undeploy from the current project:
$ anypoint-cli-agent-fabric-plugin agent-network project undeploy --environment Sandbox
Undeploy from a specific project path:
$ anypoint-cli-agent-fabric-plugin agent-network project undeploy --path ./my-project --environment Sandbox
Undeploy using GAV coordinates:
$ anypoint-cli-agent-fabric-plugin agent-network project undeploy --gav myOrgId:my-network:0.0.0 --environment Sandbox
Preview resources that would be undeployed (dry run):
$ anypoint-cli-agent-fabric-plugin agent-network project undeploy --dry-run --environment Sandbox
agent-network:project:unpublish
> anypoint-cli-agent-fabric-plugin agent-network project unpublish [flags]
Removes the agent network assets from Anypoint Exchange. By default performs a soft-delete; use --hard-delete for irreversible removal.
To prevent orphaned runtime references to deleted Exchange assets, run agent-network project undeploy before unpublish.
In addition to the default flags, this command accepts these flags:
| Flag | Description | Example |
|---|---|---|
|
API version used to discover remotely published assets when using |
|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Preview the Exchange assets that would be unpublished without deleting anything |
|
|
Environment name |
|
|
Parent asset GAV ( |
|
|
Permanently delete assets from Exchange. This cannot be undone |
|
|
Host URL |
|
|
Format output as JSON |
|
|
Organization name |
|
|
Password |
|
|
Path to the project. Reads the published assets from the project lock file. Select an environment to enable the active API instances safety check. Mutually exclusive with |
|
|
Username |
|
Examples
Unpublish with soft-delete:
$ anypoint-cli-agent-fabric-plugin agent-network project unpublish --environment Sandbox
Unpublish from a specific project path:
$ anypoint-cli-agent-fabric-plugin agent-network project unpublish --path ./my-project --environment Sandbox
Unpublish with hard-delete (irreversible):
$ anypoint-cli-agent-fabric-plugin agent-network project unpublish --hard-delete --environment Sandbox
Unpublish using GAV coordinates:
$ anypoint-cli-agent-fabric-plugin agent-network project unpublish --gav myOrgId:my-network:0.0.0 --environment Sandbox
Preview assets that would be unpublished (dry run):
$ anypoint-cli-agent-fabric-plugin agent-network project unpublish --dry-run --environment Sandbox
agent-network:setup:gateways
> anypoint-cli-agent-fabric-plugin agent-network setup gateways [flags]
Sets up the agent network environment with the required gateways in the specified target space (private space, RTF, or shared space). This step is required only if the target space doesn’t already have gateways. In the typical (happy path) workflow, you run it once per target space before the first deployment.
In addition to the default flags, this command accepts these flags:
| Flag | Description | Example |
|---|---|---|
|
Name of the egress gateway (separate-gateway mode; requires |
|
|
Name of the gateway for single-gateway mode (recommended). Mutually exclusive with |
|
|
Name of the ingress gateway (separate-gateway mode) |
|
|
Name of the target space (private space, RTF, or shared space) where you set up the agent network environment |
|
|
Bearer token |
|
|
Client ID |
|
|
Client Secret |
|
|
Collect metrics |
|
|
Do not wait for the gateways to be running |
|
|
Environment name |
|
|
Host URL |
|
|
Organization name |
|
|
Password |
|
|
Username |
|



