> 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/use-harness-ai/core-capabilities/in-your-pipelines/worker-agent/harness-agents-references.md).

# Harness Agents reference

Harness Agents Reference

Worker Agent definitions use `agent.uses` to select a versioned template, `agent.with` to configure it, and `agent.inputs` to declare reusable parameters. The Harness-managed template supplies the container and runtime configuration.

## Worker Agent form field reference <a href="#worker-agent-form-field-reference" id="worker-agent-form-field-reference"></a>

The following fields define a Worker Agent. Required fields are marked in the **Required** column.

| Field                     | Required | Description                                                                                                                                                                                                                                                                                                                                                         | Example                                                                             |
| ------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| **Name**                  | Yes      | Human-readable identifier displayed in the catalog and pipeline step picker.                                                                                                                                                                                                                                                                                        | `PR Reviewer Agent`                                                                 |
| **Description**           | No       | Free-text summary of what the agent does. Helps teams discover and reuse agents from the catalog.                                                                                                                                                                                                                                                                   | `Reviews PRs for security, schema, and architectural issues.`                       |
| **Instructions**          | Yes      | The system prompt sent to the model at runtime. Supports Harness variable expressions for dynamic context injection. Go to [Configure instructions and Harness expressions](/harness-platform/use-harness-ai/core-capabilities/in-your-pipelines/worker-agent/configuration.md#configure-instructions-and-harness-expressions) to review dynamic context injection. | Example below                                                                       |
| **Model Connector**       | Yes      | The LLM provider connector. When you configure the connector, you select a default model. Go to [Configure Model Connectors](/harness-platform/use-harness-ai/core-capabilities/in-your-pipelines/worker-agent/configuration.md#configure-model-connectors) for supported providers and models.                                                                     | `anthropic_bedrock_99cf4be5`                                                        |
| **Model Name**            | No       | Optional override for the model used at runtime. If not specified, the agent uses the default model configured on the Model Connector. Accepts an AWS Bedrock inference profile ARN for Anthropic connectors.                                                                                                                                                       | `arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/a1b2c3d4e5f6` |
| **MCP Connectors**        | No       | One or more MCP server connectors granting the agent access to Harness platform data and external services (such as GitHub). Each connector requires a URL and API key.                                                                                                                                                                                             | `harness_hosted_mcp`                                                                |
| **Inputs**                | No       | Named parameters declared under `agent.inputs` and referenced in the prompt with `<+inputs.inputName>`.                                                                                                                                                                                                                                                             | `projectName`, `orgId`, `repoName`                                                  |
| **Environment variables** | No       | String values supplied to the runtime through `agent.with.env`.                                                                                                                                                                                                                                                                                                     | `demo: "true"`                                                                      |
| **Allowed domains**       | No       | Hostnames or regex patterns for domains the agent can reach. Harness domains are allowed by default.                                                                                                                                                                                                                                                                | `harness.io`                                                                        |

***

## Agent definition YAML reference <a href="#agent-definition-yaml-reference" id="agent-definition-yaml-reference"></a>

The following YAML shows a Worker Agent definition in the **YAML** tab of the Worker Agent Catalog. Replace `harness_hosted_mcp` with your MCP connector identifier, and set the project and organization identifiers for your environment. Input names are case-sensitive: `projectName` must be referenced as `<+inputs.projectName>`.

```yaml
agent:
  uses: harnessAI@1.0.0
  with:
    prompt: |
      Analyze the pipelines in project <+inputs.projectName> in organization <+inputs.orgId>.
      Use Harness MCP to list the pipelines and retrieve each complete pipeline YAML.
      Identify repeated patterns and recommend improvements.
      Write the complete analysis to pipeline_analysis_report.md in the working directory.
      Confirm that the file exists and report its path.
    connector: account.harnessAnthropic
    mcp:
      - harness_hosted_mcp
    output: pipeline_analysis_report.md
    allowed_domains: harness.io
    env:
      demo: "true"
      swarm: "true"
  inputs:
    projectName:
      type: string
      required: true
      default: Unscripted_Tour
    orgId:
      type: string
      required: true
      default: default
```

### YAML field reference <a href="#yaml-field-reference" id="yaml-field-reference"></a>

| Field                         | Description                                                                                                                                                     |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `agent.uses`                  | Versioned base template. Use `harnessAI@1.0.0` for the Harness AI agent runtime.                                                                                |
| `agent.with.prompt`           | Agent instructions. Use a YAML block scalar (\`                                                                                                                 |
| `agent.with.connector`        | Model connector identifier, such as `account.harnessAnthropic`. The connector supplies the default model and credentials.                                       |
| `agent.with.mcp`              | Optional list of MCP connector identifiers. Harness resolves their server configuration.                                                                        |
| `agent.with.allowed_domains`  | Optional comma-separated string of hostnames or regex patterns for domains the agent can reach over the network. Harness domains are allowed by default.        |
| `agent.with.env`              | Optional map of environment variable names to string values. Quote boolean-like strings such as `"true"`. Values can reference agent inputs or Harness secrets. |
| `agent.with.max_turns`        | Optional limit on agent iterations. Supply a string, such as `"40"`.                                                                                            |
| `agent.with.output`           | Optional path to an output file that the agent must produce. This is a string, not an output-variable declaration array.                                        |
| `agent.with.workdir`          | Optional working directory. Defaults to `/harness`.                                                                                                             |
| `agent.with.backend`          | Optional runtime backend. For the OpenAI-compatible LiteLLM setup, set `openai`.                                                                                |
| `agent.with.image`            | Optional custom agent container image.                                                                                                                          |
| `agent.with.docker_connector` | Optional Docker connector used to pull the agent image.                                                                                                         |
| `agent.inputs`                | Typed parameters referenced by the agent configuration. Each input has a `type` and can specify `required` and `default`.                                       |

Go to [OpenAI Model Connector](/harness-platform/use-harness-ai/connect-with-ai/openai-model-connector.md#use-the-litellm-connector-in-a-worker-agent) to configure the LiteLLM backend.

{% @harness-feedback/feedback module="harness-ai" pagePath="harness-ai/use-harness-ai/core-capabilities/in-your-pipelines/worker-agent/harness-agents-references" %}
