---
schema_version: "1"
id: 3956e6189f935c303813f92b7d45a1847112dcdadd0f627ae797f246c277c1f5
title: Build Agent Networks in a CI/CD Environment
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/agent-network/latest/af-build-agent-networks-in-a-ci-cd-environment.md
canonical_url: https://docs.mulesoft.com/agent-network/latest/af-build-agent-networks-in-a-ci-cd-environment
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 1f6d228c5b034c1c049abcbd7ce61d1665a078c55f2127e510648b7bb182d625
description: MuleSoft Documentation Site
release: "2.0"
latest: true
---
---
product: Building Agent Networks
version: 2.0
is-latest-version: true
---

# Build Agent Networks in a CI/CD Environment

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

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](https://www.npmjs.com/package/mulesoft-anypoint-cli-agent-fabric-plugin).

If a plugin command fails, see [Troubleshoot Agent Fabric CLI Errors](https://docs.mulesoft.com/agent-network/latest/af-troubleshoot-errors).

## 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](https://nodejs.org/en).

  Follow the steps in the installer, and then from a terminal verify that `node -v` returns a Node
  20 version.

- Java 17 or later. Set the `JAVA_HOME` environment variable.

- [Anypoint CLI Agent Fabric Plugin](https://www.npmjs.com/package/mulesoft-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](https://docs.mulesoft.com/anypoint-cli/latest/auth#command-line-parameters).

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.

$ 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

For more information, see
[Authentication to the Anypoint Platform CLI](https://docs.mulesoft.com/anypoint-cli/latest/auth).

### 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](https://docs.mulesoft.com/agent-network/latest/af-get-started#setup-space).

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](https://docs.mulesoft.com/agent-network/latest/af-get-started#setup-gateways).

## CLI for Agent Fabric Plugin Reference

Use these commands to set up gateways and author, publish, and deploy agent network projects.

<table><colgroup><col> <col></colgroup><thead><tr><th>Command</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p><a href="https://docs.mulesoft.com/anypoint-cli/latest/agent-fabric#agent-network-project-build">agent-network:project:build</a></p></div></div></td><td><div><div><p>Builds the agent network project and validates configuration</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/anypoint-cli/latest/agent-fabric#agent-network-project-create">agent-network:project:create</a></p></div></div></td><td><div><div><p>Creates a new agent network project and generates the initial configuration files</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/anypoint-cli/latest/agent-fabric#agent-network-project-deploy">agent-network:project:deploy</a></p></div></div></td><td><div><div><p>Deploys the agent network project to the target environment</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/anypoint-cli/latest/agent-fabric#agent-network-project-publish">agent-network:project:publish</a></p></div></div></td><td><div><div><p>Publishes the agent network project to Anypoint Exchange</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/anypoint-cli/latest/agent-fabric#agent-network-project-undeploy">agent-network:project:undeploy</a></p></div></div></td><td><div><div><p>Undeploys the agent network project and removes all deployed runtime resources</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/anypoint-cli/latest/agent-fabric#agent-network-project-unpublish">agent-network:project:unpublish</a></p></div></div></td><td><div><div><p>Unpublishes the agent network project asset versions from Anypoint Exchange</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/anypoint-cli/latest/agent-fabric#agent-network-setup-gateways">agent-network:setup:gateways</a></p></div></div></td><td><div><div><p>Sets up the gateways for the agent network</p></div></div></td></tr></tbody></table>

## 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](https://docs.mulesoft.com/anypoint-cli/latest/#default-options), this command accepts
these flags:

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Flag</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><div><div><p><code>--bearer &lt;value&gt;</code></p></div></div></td><td><div><div><p>Bearer token<br>You can also set it with <code>ANYPOINT_BEARER</code> env variable</p></div></div></td><td><div><div><p><code>--bearer myBearerToken</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_id &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client ID<br>You can also set it with the <code>ANYPOINT_CLIENT_ID</code> env variable</p></div></div></td><td><div><div><p><code>--client_id myClientID</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_secret &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client Secret<br>You can also set it with the <code>ANYPOINT_CLIENT_SECRET</code> env variable</p></div></div></td><td><div><div><p><code>--client_secret myClientSecret</code></p></div></div></td></tr><tr><td><div><div><p><code>--[no-]collectMetrics</code></p></div></div></td><td><div><div><p>Collect metrics<br>You can also set it with the <code>COLLECT_METRICS</code> env variable</p></div></div></td><td><div><div><p><code>--no-collectMetrics</code></p></div></div></td></tr><tr><td><div><div><p><code>--debug</code></p></div></div></td><td><div><div><p>Enable debug mode</p></div></div></td><td><div><div><p><code>--debug</code></p></div></div></td></tr><tr><td><div><div><p><code>--environment &lt;value&gt;</code></p></div></div></td><td><div><div><p>Environment name<br>You can also set it with the <code>ANYPOINT_ENV</code> variable</p></div></div></td><td><div><div><p><code>--environment Sandbox</code></p></div></div></td></tr><tr><td><div><div><p><code>--forceUpdate</code></p></div></div></td><td><div><div><p>Force update the dependencies</p></div></div></td><td><div><div><p><code>--forceUpdate</code></p></div></div></td></tr><tr><td><div><div><p><code>--host &lt;value&gt;</code></p></div></div></td><td><div><div><p>Host URL<br>Default: <code>anypoint.mulesoft.com</code><br>You can also set it with the <code>ANYPOINT_HOST</code> variable</p></div></div></td><td><div><div><p><code>--host mycompany.anypoint.mulesoft.com</code></p></div></div></td></tr><tr><td><div><div><p><code>--organization &lt;value&gt;</code></p></div></div></td><td><div><div><p>Organization name<br>You can also set it with the <code>ANYPOINT_ORG</code> variable</p></div></div></td><td><div><div><p><code>--organization MyOrg</code></p></div></div></td></tr><tr><td><div><div><p><code>--password &lt;value&gt;</code></p></div></div></td><td><div><div><p>Password<br>You can also set it with the <code>ANYPOINT_PASSWORD</code> variable</p></div></div></td><td><div><div><p><code>--password myPassword</code></p></div></div></td></tr><tr><td><div><div><p><code>--path &lt;value&gt;</code></p></div></div></td><td><div><div><p>Path to the project<br>Default: <code>.</code></p></div></div></td><td><div><div><p><code>--path ./my-agent-network</code></p></div></div></td></tr><tr><td><div><div><p><code>--username &lt;value&gt;</code></p></div></div></td><td><div><div><p>Username<br>You can also set it with the <code>ANYPOINT_USERNAME</code> variable</p></div></div></td><td><div><div><p><code>--username myuser@example.com</code></p></div></div></td></tr></tbody></table>

### Example

$ anypoint-cli-agent-fabric-plugin agent-network project build

## 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](https://docs.mulesoft.com/anypoint-cli/latest/#default-options), this command accepts
these flags:

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Flag</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><div><div><p><code>-n, --name &lt;value&gt;</code></p></div></div></td><td><div><div><p>(Required) Name of the project</p></div></div></td><td><div><div><p><code>--name my-agent-network</code></p></div></div></td></tr><tr><td><div><div><p><code>-o, --output-dir &lt;value&gt;</code></p></div></div></td><td><div><div><p>Output directory for the project</p></div></div></td><td><div><div><p><code>--output-dir ./projects</code></p></div></div></td></tr><tr><td><div><div><p><code>--api-version &lt;value&gt;</code></p></div></div></td><td><div><div><p>API version<br>Default: <code>v1</code></p></div></div></td><td><div><div><p><code>--api-version v2</code></p></div></div></td></tr><tr><td><div><div><p><code>--asset-id &lt;value&gt;</code></p></div></div></td><td><div><div><p>Asset name (GAV). Valid characters are 'A-Z', 'a-z', '0-9', '_' and '-'.</p></div></div></td><td><div><div><p><code>--asset-id my-asset</code></p></div></div></td></tr><tr><td><div><div><p><code>--asset-version &lt;value&gt;</code></p></div></div></td><td><div><div><p>Asset version (GAV)<br>Default: <code>0.0.0</code></p></div></div></td><td><div><div><p><code>--asset-version 1.2.0</code></p></div></div></td></tr><tr><td><div><div><p><code>--bearer &lt;value&gt;</code></p></div></div></td><td><div><div><p>Bearer token<br>You can also set it with the <code>ANYPOINT_BEARER</code> variable</p></div></div></td><td><div><div><p><code>--bearer myBearerToken</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_id &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client ID<br>You can also set it with the <code>ANYPOINT_CLIENT_ID</code> variable</p></div></div></td><td><div><div><p><code>--client_id myClientID</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_secret &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client Secret<br>You can also set it with the <code>ANYPOINT_CLIENT_SECRET</code> variable</p></div></div></td><td><div><div><p><code>--client_secret myClientSecret</code></p></div></div></td></tr><tr><td><div><div><p><code>--[no-]collectMetrics</code></p></div></div></td><td><div><div><p>Collect metrics<br>You can also set it with the <code>COLLECT_METRICS</code> variable</p></div></div></td><td><div><div><p><code>--no-collectMetrics</code></p></div></div></td></tr><tr><td><div><div><p><code>--[no-]create-dir</code></p></div></div></td><td><div><div><p>Create a new directory under <code>output-dir</code> using the project name</p></div></div></td><td><div><div><p><code>--create-dir</code></p></div></div></td></tr><tr><td><div><div><p><code>--environment &lt;value&gt;</code></p></div></div></td><td><div><div><p>Environment name<br>You can also set it with the <code>ANYPOINT_ENV</code> variable</p></div></div></td><td><div><div><p><code>--environment Sandbox</code></p></div></div></td></tr><tr><td><div><div><p><code>--group-id &lt;value&gt;</code></p></div></div></td><td><div><div><p>Group ID (GAV)</p></div></div></td><td><div><div><p><code>--group-id com.myorg</code></p></div></div></td></tr><tr><td><div><div><p><code>--host &lt;value&gt;</code></p></div></div></td><td><div><div><p>Host URL<br>Default: <code>anypoint.mulesoft.com</code><br>You can also set it with the <code>ANYPOINT_HOST</code> variable</p></div></div></td><td><div><div><p><code>--host mycompany.anypoint.mulesoft.com</code></p></div></div></td></tr><tr><td><div><div><p><code>--organization &lt;value&gt;</code></p></div></div></td><td><div><div><p>Organization name<br>You can also set it with the <code>ANYPOINT_ORG</code> env variable</p></div></div></td><td><div><div><p><code>--organization MyOrg</code></p></div></div></td></tr><tr><td><div><div><p><code>--password &lt;value&gt;</code></p></div></div></td><td><div><div><p>Password<br>You can also set it with the <code>ANYPOINT_PASSWORD</code> variable</p></div></div></td><td><div><div><p><code>--password myPassword</code></p></div></div></td></tr><tr><td><div><div><p><code>--tab-size &lt;value&gt;</code></p></div></div></td><td><div><div><p>Tab size for indenting the API specification<br>Default: <code>2</code></p></div></div></td><td><div><div><p><code>--tab-size 4</code></p></div></div></td></tr><tr><td><div><div><p><code>--username &lt;value&gt;</code></p></div></div></td><td><div><div><p>Username<br>You can also set it with the <code>ANYPOINT_USERNAME</code> variable</p></div></div></td><td><div><div><p><code>--username myuser@example.com</code></p></div></div></td></tr></tbody></table>

### Example

$ anypoint-cli-agent-fabric-plugin agent-network project create --name my-agent-network

## 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](https://docs.mulesoft.com/anypoint-cli/latest/#default-options), this command accepts
these flags:

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Flag</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><div><div><p><code>-e, --egress-gw &lt;value&gt;</code></p></div></div></td><td><div><div><p>Name of the target egress gateway (separate-gateways mode; requires <code>--ingress-gw</code>). When no gateway flags are provided, deploy defaults to single-gateway mode using <code>agent-network-gw</code>.</p></div></div></td><td><div><div><p><code>--egress-gw custom-egress</code></p></div></div></td></tr><tr><td><div><div><p><code>-g, --gateway &lt;value&gt;</code></p></div></div></td><td><div><div><p>Name of the gateway for single-gateway mode (recommended). Mutually exclusive with <code>--ingress-gw</code> and <code>--egress-gw</code>.</p></div></div></td><td><div><div><p><code>--gateway my-gateway</code></p></div></div></td></tr><tr><td><div><div><p><code>-i, --ingress-gw &lt;value&gt;</code></p></div></div></td><td><div><div><p>Name of the target ingress gateway. Combine with <code>--egress-gw</code> for separate-gateways mode; on its own it selects single-gateway mode using this gateway. When no gateway flags are provided, deploy defaults to single-gateway mode using <code>agent-network-gw</code>.</p></div></div></td><td><div><div><p><code>--ingress-gw custom-ingress</code></p></div></div></td></tr><tr><td><div><div><p><code>-t, --target-space &lt;value&gt;</code></p></div></div></td><td><div><div><p>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 <code>agent-network-space</code>.</p></div></div></td><td><div><div><p><code>--target-space my-space</code></p></div></div></td></tr><tr><td><div><div><p><code>--bearer &lt;value&gt;</code></p></div></div></td><td><div><div><p>Bearer token<br>You can also set it with the <code>ANYPOINT_BEARER</code> variable</p></div></div></td><td><div><div><p><code>--bearer myBearerToken</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_id &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client ID<br>You can also set it with the <code>ANYPOINT_CLIENT_ID</code> variable</p></div></div></td><td><div><div><p><code>--client_id myClientID</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_secret &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client Secret<br>You can also set it with the <code>ANYPOINT_CLIENT_SECRET</code> variable</p></div></div></td><td><div><div><p><code>--client_secret myClientSecret</code></p></div></div></td></tr><tr><td><div><div><p><code>--[no-]collectMetrics</code></p></div></div></td><td><div><div><p>Collect metrics<br>You can also set it with the <code>COLLECT_METRICS</code> variable</p></div></div></td><td><div><div><p><code>--no-collectMetrics</code></p></div></div></td></tr><tr><td><div><div><p><code>--disable-tracing</code></p></div></div></td><td><div><div><p>Disable tracing functionalities</p></div></div></td><td><div><div><p><code>--disable-tracing</code></p></div></div></td></tr><tr><td><div><div><p><code>--dont-wait-for-agent-network</code></p></div></div></td><td><div><div><p>Do not wait for the agent network to be ready</p></div></div></td><td><div><div><p><code>--dont-wait-for-agent-network</code></p></div></div></td></tr><tr><td><div><div><p><code>--environment &lt;value&gt;</code></p></div></div></td><td><div><div><p>Environment name<br>You can also set it with the <code>ANYPOINT_ENV</code> variable</p></div></div></td><td><div><div><p><code>--environment Sandbox</code></p></div></div></td></tr><tr><td><div><div><p><code>--host &lt;value&gt;</code></p></div></div></td><td><div><div><p>Host URL<br>Default: <code>anypoint.mulesoft.com</code><br>You can also set it with the <code>ANYPOINT_HOST</code> variable</p></div></div></td><td><div><div><p><code>--host mycompany.anypoint.mulesoft.com</code></p></div></div></td></tr><tr><td><div><div><p><code>--max-retries &lt;value&gt;</code></p></div></div></td><td><div><div><p>Max retries to check the status of the deploying application<br>Default: <code>3</code></p></div></div></td><td><div><div><p><code>--max-retries 5</code></p></div></div></td></tr><tr><td><div><div><p><code>--organization &lt;value&gt;</code></p></div></div></td><td><div><div><p>Organization name<br>You can also set it with the <code>ANYPOINT_ORG</code> variable</p></div></div></td><td><div><div><p><code>--organization MyOrg</code></p></div></div></td></tr><tr><td><div><div><p><code>--password &lt;value&gt;</code></p></div></div></td><td><div><div><p>Password<br>You can also set it with the <code>ANYPOINT_PASSWORD</code> variable</p></div></div></td><td><div><div><p><code>--password myPassword</code></p></div></div></td></tr><tr><td><div><div><p><code>--path &lt;value&gt;</code></p></div></div></td><td><div><div><p>Path to the project<br>Default: <code>.</code></p></div></div></td><td><div><div><p><code>--path ./my-agent-network</code></p></div></div></td></tr><tr><td><div><div><p><code>--process-timeout &lt;value&gt;</code></p></div></div></td><td><div><div><p>Process timeout in milliseconds<br>Default: <code>600000</code></p></div></div></td><td><div><div><p><code>--process-timeout 900000</code></p></div></div></td></tr><tr><td><div><div><p><code>--property &lt;value&gt;</code></p></div></div></td><td><div><div><p>Property to override in <code>name:value</code> format</p></div></div></td><td><div><div><p><code>--property apiKey:sk-xxx</code></p></div></div></td></tr><tr><td><div><div><p><code>--request-timeout &lt;value&gt;</code></p></div></div></td><td><div><div><p>Request timeout in milliseconds<br>Default: <code>60000</code></p></div></div></td><td><div><div><p><code>--request-timeout 120000</code></p></div></div></td></tr><tr><td><div><div><p><code>--username &lt;value&gt;</code></p></div></div></td><td><div><div><p>Username<br>You can also set it with the <code>ANYPOINT_USERNAME</code> variable</p></div></div></td><td><div><div><p><code>--username myuser@example.com</code></p></div></div></td></tr><tr><td><div><div><p><code>--json</code></p></div></div></td><td><div><div><p>Format output as JSON</p></div></div></td><td><div><div><p><code>--json</code></p></div></div></td></tr></tbody></table>

### 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](https://docs.mulesoft.com/anypoint-cli/latest/#default-options), this command accepts
these flags:

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Flag</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><div><div><p><code>--bearer &lt;value&gt;</code></p></div></div></td><td><div><div><p>Bearer token<br>You can also set it with the <code>ANYPOINT_BEARER</code> variable</p></div></div></td><td><div><div><p><code>--bearer myBearerToken</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_id &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client ID<br>You can also set it with the <code>ANYPOINT_CLIENT_ID</code> variable</p></div></div></td><td><div><div><p><code>--client_id myClientID</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_secret &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client Secret<br>You can also set it with the <code>ANYPOINT_CLIENT_SECRET</code> variable</p></div></div></td><td><div><div><p><code>--client_secret myClientSecret</code></p></div></div></td></tr><tr><td><div><div><p><code>--[no-]collectMetrics</code></p></div></div></td><td><div><div><p>Collect metrics<br>You can also set it with the <code>COLLECT_METRICS</code> variable</p></div></div></td><td><div><div><p><code>--no-collectMetrics</code></p></div></div></td></tr><tr><td><div><div><p><code>--debug</code></p></div></div></td><td><div><div><p>Enable debug mode</p></div></div></td><td><div><div><p><code>--debug</code></p></div></div></td></tr><tr><td><div><div><p><code>--environment &lt;value&gt;</code></p></div></div></td><td><div><div><p>Environment name<br>You can also set it with the <code>ANYPOINT_ENV</code> variable</p></div></div></td><td><div><div><p><code>--environment Sandbox</code></p></div></div></td></tr><tr><td><div><div><p><code>--host &lt;value&gt;</code></p></div></div></td><td><div><div><p>Host URL<br>Default: <code>anypoint.mulesoft.com</code><br>You can also set it with the <code>ANYPOINT_HOST</code> variable</p></div></div></td><td><div><div><p><code>--host mycompany.anypoint.mulesoft.com</code></p></div></div></td></tr><tr><td><div><div><p><code>--organization &lt;value&gt;</code></p></div></div></td><td><div><div><p>Organization name<br>You can also set it with <code>ANYPOINT_ORG</code> env variable</p></div></div></td><td><div><div><p><code>--organization MyOrg</code></p></div></div></td></tr><tr><td><div><div><p><code>--password &lt;value&gt;</code></p></div></div></td><td><div><div><p>Password<br>You can also set it with the <code>ANYPOINT_PASSWORD</code> variable</p></div></div></td><td><div><div><p><code>--password myPassword</code></p></div></div></td></tr><tr><td><div><div><p><code>--path &lt;value&gt;</code></p></div></div></td><td><div><div><p>Path to the project<br>Default: <code>.</code></p></div></div></td><td><div><div><p><code>--path ./my-agent-network</code></p></div></div></td></tr><tr><td><div><div><p><code>--username &lt;value&gt;</code></p></div></div></td><td><div><div><p>Username<br>You can also set it with the <code>ANYPOINT_USERNAME</code> variable</p></div></div></td><td><div><div><p><code>--username myuser@example.com</code></p></div></div></td></tr><tr><td><div><div><p><code>--json</code></p></div></div></td><td><div><div><p>Format output as JSON</p></div></div></td><td><div><div><p><code>--json</code></p></div></div></td></tr></tbody></table>

### Example

$ anypoint-cli-agent-fabric-plugin agent-network project publish

## 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](https://docs.mulesoft.com/anypoint-cli/latest/#default-options), this command accepts
these flags:

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Flag</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><div><div><p><code>--api-version &lt;value&gt;</code></p></div></div></td><td><div><div><p>API version used to discover remotely deployed resources when using <code>--gav</code><br>Default: <code>v1</code></p></div></div></td><td><div><div><p><code>--api-version v1</code></p></div></div></td></tr><tr><td><div><div><p><code>--bearer &lt;value&gt;</code></p></div></div></td><td><div><div><p>Bearer token<br>You can also set it with the <code>ANYPOINT_BEARER</code> variable</p></div></div></td><td><div><div><p><code>--bearer myBearerToken</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_id &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client ID<br>You can also set it with the <code>ANYPOINT_CLIENT_ID</code> variable</p></div></div></td><td><div><div><p><code>--client_id myClientID</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_secret &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client Secret<br>You can also set it with the <code>ANYPOINT_CLIENT_SECRET</code> variable</p></div></div></td><td><div><div><p><code>--client_secret myClientSecret</code></p></div></div></td></tr><tr><td><div><div><p><code>--[no-]collectMetrics</code></p></div></div></td><td><div><div><p>Collect metrics<br>You can also set it with the <code>COLLECT_METRICS</code> variable</p></div></div></td><td><div><div><p><code>--no-collectMetrics</code></p></div></div></td></tr><tr><td><div><div><p><code>--dry-run</code></p></div></div></td><td><div><div><p>Preview the deploy-plane resources that would be undeployed without deleting anything</p></div></div></td><td><div><div><p><code>--dry-run</code></p></div></div></td></tr><tr><td><div><div><p><code>--environment &lt;value&gt;</code></p></div></div></td><td><div><div><p>Environment name<br>You can also set it with the <code>ANYPOINT_ENV</code> variable</p></div></div></td><td><div><div><p><code>--environment Sandbox</code></p></div></div></td></tr><tr><td><div><div><p><code>--gav &lt;value&gt;</code></p></div></div></td><td><div><div><p>Parent asset GAV (<code>groupId:assetId:version</code>). Discovers deployed resources remotely. Requires an environment to be selected</p></div></div></td><td><div><div><p><code>--gav myOrgId:my-network:0.0.0</code></p></div></div></td></tr><tr><td><div><div><p><code>--host &lt;value&gt;</code></p></div></div></td><td><div><div><p>Host URL<br>Default: <code>anypoint.mulesoft.com</code><br>You can also set it with the <code>ANYPOINT_HOST</code> variable</p></div></div></td><td><div><div><p><code>--host mycompany.anypoint.mulesoft.com</code></p></div></div></td></tr><tr><td><div><div><p><code>--json</code></p></div></div></td><td><div><div><p>Format output as JSON</p></div></div></td><td><div><div><p><code>--json</code></p></div></div></td></tr><tr><td><div><div><p><code>--organization &lt;value&gt;</code></p></div></div></td><td><div><div><p>Organization name<br>You can also set it with the <code>ANYPOINT_ORG</code> variable</p></div></div></td><td><div><div><p><code>--organization MyOrg</code></p></div></div></td></tr><tr><td><div><div><p><code>--password &lt;value&gt;</code></p></div></div></td><td><div><div><p>Password<br>You can also set it with the <code>ANYPOINT_PASSWORD</code> variable</p></div></div></td><td><div><div><p><code>--password myPassword</code></p></div></div></td></tr><tr><td><div><div><p><code>--path &lt;value&gt;</code></p></div></div></td><td><div><div><p>Path to the project. Discovers deployed resources remotely from the project lock file. Requires an environment to be selected. Mutually exclusive with <code>--gav</code></p></div></div></td><td><div><div><p><code>--path ./my-project</code></p></div></div></td></tr><tr><td><div><div><p><code>--process-timeout &lt;value&gt;</code></p></div></div></td><td><div><div><p>Process timeout in milliseconds<br>Default: <code>900000</code></p></div></div></td><td><div><div><p><code>--process-timeout 900000</code></p></div></div></td></tr><tr><td><div><div><p><code>--request-timeout &lt;value&gt;</code></p></div></div></td><td><div><div><p>Request timeout in milliseconds<br>Default: <code>60000</code></p></div></div></td><td><div><div><p><code>--request-timeout 60000</code></p></div></div></td></tr><tr><td><div><div><p><code>--username &lt;value&gt;</code></p></div></div></td><td><div><div><p>Username<br>You can also set it with the <code>ANYPOINT_USERNAME</code> variable</p></div></div></td><td><div><div><p><code>--username myuser@example.com</code></p></div></div></td></tr></tbody></table>

### 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](https://docs.mulesoft.com/anypoint-cli/latest/#default-options), this command accepts
these flags:

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Flag</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><div><div><p><code>--api-version &lt;value&gt;</code></p></div></div></td><td><div><div><p>API version used to discover remotely published assets when using <code>--gav</code><br>Default: <code>v1</code></p></div></div></td><td><div><div><p><code>--api-version v1</code></p></div></div></td></tr><tr><td><div><div><p><code>--bearer &lt;value&gt;</code></p></div></div></td><td><div><div><p>Bearer token<br>You can also set it with the <code>ANYPOINT_BEARER</code> variable</p></div></div></td><td><div><div><p><code>--bearer myBearerToken</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_id &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client ID<br>You can also set it with the <code>ANYPOINT_CLIENT_ID</code> variable</p></div></div></td><td><div><div><p><code>--client_id myClientID</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_secret &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client Secret<br>You can also set it with the <code>ANYPOINT_CLIENT_SECRET</code> variable</p></div></div></td><td><div><div><p><code>--client_secret myClientSecret</code></p></div></div></td></tr><tr><td><div><div><p><code>--[no-]collectMetrics</code></p></div></div></td><td><div><div><p>Collect metrics<br>You can also set it with the <code>COLLECT_METRICS</code> variable</p></div></div></td><td><div><div><p><code>--no-collectMetrics</code></p></div></div></td></tr><tr><td><div><div><p><code>--dry-run</code></p></div></div></td><td><div><div><p>Preview the Exchange assets that would be unpublished without deleting anything</p></div></div></td><td><div><div><p><code>--dry-run</code></p></div></div></td></tr><tr><td><div><div><p><code>--environment &lt;value&gt;</code></p></div></div></td><td><div><div><p>Environment name<br>You can also set it with the <code>ANYPOINT_ENV</code> variable</p></div></div></td><td><div><div><p><code>--environment Sandbox</code></p></div></div></td></tr><tr><td><div><div><p><code>--gav &lt;value&gt;</code></p></div></div></td><td><div><div><p>Parent asset GAV (<code>groupId:assetId:version</code>). Discovers assets remotely. Use <code>--environment</code> to enable the active API instances safety check</p></div></div></td><td><div><div><p><code>--gav myOrgId:my-network:0.0.0</code></p></div></div></td></tr><tr><td><div><div><p><code>--hard-delete</code></p></div></div></td><td><div><div><p>Permanently delete assets from Exchange. This cannot be undone</p></div></div></td><td><div><div><p><code>--hard-delete</code></p></div></div></td></tr><tr><td><div><div><p><code>--host &lt;value&gt;</code></p></div></div></td><td><div><div><p>Host URL<br>Default: <code>anypoint.mulesoft.com</code><br>You can also set it with the <code>ANYPOINT_HOST</code> variable</p></div></div></td><td><div><div><p><code>--host mycompany.anypoint.mulesoft.com</code></p></div></div></td></tr><tr><td><div><div><p><code>--json</code></p></div></div></td><td><div><div><p>Format output as JSON</p></div></div></td><td><div><div><p><code>--json</code></p></div></div></td></tr><tr><td><div><div><p><code>--organization &lt;value&gt;</code></p></div></div></td><td><div><div><p>Organization name<br>You can also set it with the <code>ANYPOINT_ORG</code> variable</p></div></div></td><td><div><div><p><code>--organization MyOrg</code></p></div></div></td></tr><tr><td><div><div><p><code>--password &lt;value&gt;</code></p></div></div></td><td><div><div><p>Password<br>You can also set it with the <code>ANYPOINT_PASSWORD</code> variable</p></div></div></td><td><div><div><p><code>--password myPassword</code></p></div></div></td></tr><tr><td><div><div><p><code>--path &lt;value&gt;</code></p></div></div></td><td><div><div><p>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 <code>--gav</code></p></div></div></td><td><div><div><p><code>--path ./my-project</code></p></div></div></td></tr><tr><td><div><div><p><code>--username &lt;value&gt;</code></p></div></div></td><td><div><div><p>Username<br>You can also set it with the <code>ANYPOINT_USERNAME</code> variable</p></div></div></td><td><div><div><p><code>--username myuser@example.com</code></p></div></div></td></tr></tbody></table>

### 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](https://docs.mulesoft.com/anypoint-cli/latest/#default-options), this command accepts
these flags:

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Flag</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><div><div><p><code>-e, --egress-gw &lt;value&gt;</code></p></div></div></td><td><div><div><p>Name of the egress gateway (separate-gateway mode; requires <code>--ingress-gw</code>)</p></div></div></td><td><div><div><p><code>--egress-gw my-egress</code></p></div></div></td></tr><tr><td><div><div><p><code>-g, --gateway &lt;value&gt;</code></p></div></div></td><td><div><div><p>Name of the gateway for single-gateway mode (recommended). Mutually exclusive with <code>--ingress-gw</code> and <code>--egress-gw</code>.</p></div></div></td><td><div><div><p><code>--gateway my-gateway</code></p></div></div></td></tr><tr><td><div><div><p><code>-i, --ingress-gw &lt;value&gt;</code></p></div></div></td><td><div><div><p>Name of the ingress gateway (separate-gateway mode)</p></div></div></td><td><div><div><p><code>--ingress-gw my-ingress</code></p></div></div></td></tr><tr><td><div><div><p><code>-t, --target-space &lt;value&gt;</code></p></div></div></td><td><div><div><p>Name of the target space (private space, RTF, or shared space) where you set up the agent network environment<br>Default: <code>agent-network-space</code></p></div></div></td><td><div><div><p><code>--target-space my-space</code></p></div></div></td></tr><tr><td><div><div><p><code>--bearer &lt;value&gt;</code></p></div></div></td><td><div><div><p>Bearer token<br>You can also set it with the <code>ANYPOINT_BEARER</code> variable</p></div></div></td><td><div><div><p><code>--bearer myBearerToken</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_id &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client ID<br>You can also set it with the <code>ANYPOINT_CLIENT_ID</code> variable</p></div></div></td><td><div><div><p><code>--client_id myClientID</code></p></div></div></td></tr><tr><td><div><div><p><code>--client_secret &lt;value&gt;</code></p></div></div></td><td><div><div><p>Client Secret<br>You can also set it with the <code>ANYPOINT_CLIENT_SECRET</code> variable</p></div></div></td><td><div><div><p><code>--client_secret myClientSecret</code></p></div></div></td></tr><tr><td><div><div><p><code>--[no-]collectMetrics</code></p></div></div></td><td><div><div><p>Collect metrics<br>You can also set it with the <code>COLLECT_METRICS</code> variable</p></div></div></td><td><div><div><p><code>--no-collectMetrics</code></p></div></div></td></tr><tr><td><div><div><p><code>--dont-wait-for-gateways-running</code></p></div></div></td><td><div><div><p>Do not wait for the gateways to be running</p></div></div></td><td><div><div><p><code>--dont-wait-for-gateways-running</code></p></div></div></td></tr><tr><td><div><div><p><code>--environment &lt;value&gt;</code></p></div></div></td><td><div><div><p>Environment name<br>You can also set it with the <code>ANYPOINT_ENV</code> variable</p></div></div></td><td><div><div><p><code>--environment Sandbox</code></p></div></div></td></tr><tr><td><div><div><p><code>--host &lt;value&gt;</code></p></div></div></td><td><div><div><p>Host URL<br>Default: <code>anypoint.mulesoft.com</code><br>You can also set it with the <code>ANYPOINT_HOST</code> variable</p></div></div></td><td><div><div><p><code>--host mycompany.anypoint.mulesoft.com</code></p></div></div></td></tr><tr><td><div><div><p><code>--organization &lt;value&gt;</code></p></div></div></td><td><div><div><p>Organization name<br>You can also set it with the <code>ANYPOINT_ORG</code> variable</p></div></div></td><td><div><div><p><code>--organization MyOrg</code></p></div></div></td></tr><tr><td><div><div><p><code>--password &lt;value&gt;</code></p></div></div></td><td><div><div><p>Password<br>You can also set it with the <code>ANYPOINT_PASSWORD</code> variable</p></div></div></td><td><div><div><p><code>--password myPassword</code></p></div></div></td></tr><tr><td><div><div><p><code>--username &lt;value&gt;</code></p></div></div></td><td><div><div><p>Username<br>You can also set it with the <code>ANYPOINT_USERNAME</code> variable</p></div></div></td><td><div><div><p><code>--username myuser@example.com</code></p></div></div></td></tr></tbody></table>

### Example

$ anypoint-cli-agent-fabric-plugin agent-network setup gateways --target-space my-space

## Configure CPU and Memory Resources for an Agent Broker

Configure CPU and memory resources for brokers when you deploy an agent network with Anypoint CLI.
By default, brokers reserve `20m` of CPU and `700Mi` of memory, with limits of `2000m` CPU and
`700Mi` memory.

Specify the resource settings in a deployment configuration file or directly in the deploy command.
Don’t use both methods in the same command.

To specify the settings in a deployment configuration file:

1.  Create a `deployment-config.yaml` file with the resource settings:

    ```yaml
    brokers:
      resources.cpu.reserved: 20m
      resources.cpu.limit: 2000m
      resources.memory.reserved: 700Mi
      resources.memory.limit: 700Mi
    ```

2.  Pass the file to the deploy command with `--deployment-properties-file`:

    \--deployment-properties-file=/path/to/deployment-config.yaml

To specify a resource setting directly in the deploy command, use `--deployment-property` with the
broker scope, resource property, and value. For example, to reserve `50m` of CPU:

\--deployment-property brokers:resources:cpu:reserved:50m
