> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-platform/3.0/harness-cli/cli/harness-cli-commands/harness-worker-agents.md).

# Harness Worker Agents

Use the Harness CLI to list, inspect, create, and update Harness Worker Agents from a wrapper YAML definition.

Harness Worker Agents are Harness-managed automation workers. Each agent is defined by a wrapper YAML file whose `spec` key carries the agent pipeline definition, which means you can keep agent definitions in version control and apply them from the CLI. The commands live in the `platform` module.

This page covers all Harness Worker Agent resources and actions available in the CLI.

## What you will learn in this topic

By the end of this page, you will know how to:

* List the Harness Worker Agents in scope.
* Retrieve an agent definition in a form you can edit and reapply.
* Create an agent from a wrapper YAML file.
* Update an existing agent definition.

## Before you begin

* **Harness CLI installed and authenticated:** For setup steps, see [Install and upgrade](https://developer.harness.io/harness-platform/3.0/harness-cli/cli/overview.md) and [Authenticate](https://developer.harness.io/harness-platform/3.0/harness-cli/cli/authenticate-the-harness-cli.md).
* **Scope configured:** Worker Agents resolve against the scope in your profile. Pass `--account`, `--org`, or `--project` to override it for a single command.

### The wrapper YAML

An agent definition is a wrapper document with three parts:

* **`name`:** The display name of the agent.
* **`description`:** A short summary of what the agent does.
* **`spec`:** A string that carries the agent pipeline definition.

Because `spec` is a string, the agent pipeline is nested inside the wrapper rather than merged into it. Retrieve an existing agent with `-o yaml` to get a valid wrapper that you can edit and pass straight back to `create` or `update`.

### Worker Agents

#### List agents

```bash
harness list agent 
harness list agent --all --format json 
harness list agent --columns "name,id"
```

#### Get agent details

Use `-o yaml` to produce a valid wrapper document for editing.

```bash
harness get agent <agent_id>
harness get agent <agent_id> -o yaml 
harness get agent <agent_id> --format json
```

#### Create an agent

Create an agent from a wrapper YAML file.

```bash
harness create agent <agent_id> -f <agent_file>.yaml
```

#### Update an agent

Update an agent from a wrapper YAML file. To round-trip a definition, retrieve it, edit it locally, and apply it back.

```bash
harness update agent <agent_id> -f <agent_file>.yaml
```

```bash
harness get agent <agent_id> -o yaml > <agent_file>.yaml 
$EDITOR <agent_file>.yaml 
harness update agent <agent_id> -f <agent_file>.yaml
```

### Related articles

* [Platform](https://developer.harness.io/harness-platform/3.0/harness-cli/cli/harness-cli-commands/platform.md): Manage the connectors, secrets, and delegates an agent depends on.
* [Continuous Delivery](https://developer.harness.io/harness-platform/3.0/harness-cli/cli/harness-cli-commands/continuous-delivery.md): Manage pipelines and executions.
