Worker Agent
Create and configure AI-powered Worker Agents that run inside Harness pipelines to automate code review, incident response, data synthesis, and other intelligent workflows.
Worker Agents are AI-powered automation units that execute tasks inside Harness pipelines using a language model, MCP-connected data sources, and configurable inputs. Each Worker Agent pairs a prompt (Instructions), a Model Connector, and optional MCP Servers into a single, reusable, governed step you can add to CI, CD, IaCM, STO, SCS, or Custom stages.
What you will learn in this topic
By the end of this topic, you will be able to:
Before you begin
Before you create a Worker Agent, ensure you have the following:
Harness account with AI Agents enabled: AI Agents section under AI in the Harness module selector. Go to Getting started with Harness Platform to access or create a Harness account.
Pipeline permissions: View, Create/Edit, and Execute permissions for Pipelines. Go to RBAC in Harness to configure roles.
Connector permissions: View, Create/Edit, and Delete permissions for Connectors to create and manage the Model Provider Connector and MCP Connector.
Secret permissions: View and Access (reference) permissions for Secrets at a minimum, since both the Model Provider Connector and MCP Connector reference secrets for authentication.
Model Connector: An Anthropic or OpenAI Model Connector configured with a default model. Go to Model Connectors to review supported providers, models, and setup options.
MCP Connector (optional): An MCP Server Connector with a valid hosted MCP URL and API key. Go to Harness MCP Server to set up MCP access.
View Worker Agents
Access the Worker Agent Catalog to browse all available agents in your project scope, including system-provided agents and custom agents your team has created.
From any Harness module, open the Module Selector in the left navigation bar.
Locate the AI section.
Select Worker Agents to open the Worker Agent Catalog.
The catalog displays all available Worker Agents for your project scope, including system agents and custom agents you have created.
Create a Worker Agent
Create custom Worker Agents that appear in the Custom tab of the Worker Agent Catalog. Custom agents are reusable across pipelines in your project and can be versioned, shared, and governed through RBAC.
The Custom tab displays all user-created Worker Agents in your project
To create a new custom agent:
In the Worker Agent Catalog, click + Create.
Complete all required fields in the Create Agent form including Agent name, Instructions, Model provider, and optional MCP connectors.
Click Save agent to publish the agent to your catalog.
The Create Agent form with Visual and YAML tabs for defining your custom Worker Agent
Create agents via AI Chat and IDE
In addition to the Harness UI, you can create Worker Agents using Harness AI Chat or directly from your IDE or terminal via the Harness MCP Server.
Harness AI Chat
The Harness AI Chat interface supports an interactive agent creation workflow. When you ask the chat to create an agent (such as "Create a PR Review Agent"), it:
Checks existing agents in your project to avoid duplicates.
Gathers requirements interactively (review focus, output format, platform).
Generates a complete agent YAML spec.
Presents the spec for your review and approval.
Creates the agent in your project via the Harness Agent API.
You can also ask Harness AI Chat to create pipelines that reference your agents. For example, "Create a CI pipeline that runs my PR Review Agent on every pull request" generates a pipeline YAML with the Agent step pre-configured, including trigger setup and codebase configuration. This lets you go from agent creation to a working pipeline entirely through the chat interface.
This approach is useful for quickly scaffolding agents and pipelines using natural language without manually filling out each form field.
IDE and terminal (via Harness MCP)
You can also create and manage Worker Agents from any IDE or terminal that supports MCP, including Cursor, Windsurf, VS Code (Copilot), and Claude Code. With the Harness MCP Server installed, your IDE gains access to agent and agent_run resource types, enabling you to:
List existing agents: View all agents in your project.
Create new agents: Provide the agent YAML spec to create an agent.
Update agent configurations: Modify instructions, inputs, and environment variables.
Trigger agent runs: Execute agents and inspect outputs.
Go to Harness MCP Server to install and configure the MCP Server for your IDE or terminal.
Agent Marketplace
The Worker Agent Catalog includes a Marketplace tab and a Custom tab. The Marketplace provides pre-built agents maintained by Harness that you can use immediately.
The Agent Marketplace with agents available for your project
Agent categories
The Marketplace includes three categories of agents:
Harness Certified
Agents verified and certified by Harness for production use. These agents meet strict quality, security, and performance standards.
Harness Managed
Agents maintained and owned by Harness. These are loaded into your account by default and receive ongoing updates.
Community
Agents contributed by the Harness community. Available for use but not officially maintained by Harness.
By default, your account includes Harness Managed agents. These agents are ready to use out of the box and cover common use cases such as code review, autofix, code coverage, manifest remediation, onboarding, feature flag cleanup, zero day remediation, IaCM remediation, and library upgrades.
Contribute a Worker Agent to the Marketplace
You can submit your own Worker Agents to the Community category so other Harness users can discover and use them. Go to Agent categories to understand how Community agents differ from Harness Certified and Harness Managed agents.
Go to the Worker Agent submission form to submit your agent for review. Include the agent name, a clear description, the agent definition YAML, and the use case it solves. The Harness team reviews each submission before publishing it to the Marketplace. If you do not receive a response within 10 business days, contact Harness Support.
Use a custom container image
The run.container.image field defaults to the Harness-managed agent image (pkg.harness.io/vrvdt5ius7uwygso8s0bia/harness-agents/harness-ai-agent:latest). You can override this value to point to your own container registry if you need to add customizations on top of the base image.
Common reasons to use a custom image:
Install additional CLI tools or language runtimes the agent needs at runtime.
Bundle internal certificates or proxy configuration for air-gapped environments.
Pin a specific image tag for reproducibility instead of using
latest.
To use a custom image, pull the Harness base image, extend it with your changes, publish it to your own registry, and update the image field:
Alternatively, if you prefer to pull the image from the Harness DockerHub registry instead of the default Harness private registry, use the following image reference (requires a Docker connector configured in your pipeline):
The custom image must be accessible from your Harness delegate or Harness Cloud network at pipeline execution time.
Example: Pipeline Discovery Agent
The following complete agent definition lists and summarizes pipelines in a Harness account using Harness MCP Server tools:
Supported stage types
Worker Agents can execute in any Harness pipeline stage type. This flexibility allows you to embed AI-powered automation across your entire delivery workflow, from CI builds to CD deployments to security scans.
The Agent step can be added to any of the following Harness stage types:
Custom
Custom
Continuous Integration
CI
Continuous Delivery
CD
Infrastructure as Code Management
IACM
Security Testing Orchestration
STO
Software Supply Chain Security
SCS
This means a Worker Agent can be embedded as a step in any pipeline stage where you want AI-driven automation, from PR review in CI to compliance checks in SCS.
Infrastructure and execution
Worker Agents execute in isolated Docker containers to ensure secure, reproducible runs. Choose between Harness-managed cloud infrastructure for zero-ops execution or your own Kubernetes cluster for full infrastructure control.
Worker Agents run inside Docker containers in an isolated VM. You can run agents on Harness Cloud or on your own infrastructure in a Kubernetes cluster.
Harness Cloud: Harness manages the compute infrastructure. Select
Cloudas the runtime type in your pipeline stage configuration. Available for CI, STO, SCS, and IACM stages.Self-hosted infrastructure: Run agents on your own Kubernetes cluster using a Harness Delegate. The agent container executes in an isolated VM on your infrastructure, giving you full control over networking, data residency, and compute resources.
For CD and Custom stages, the Agent step requires a Containerized Step Group to provide the container execution environment.
Security
Worker Agents execute inside Docker containers in isolated VMs, whether on Harness Cloud or your self-hosted infrastructure. The agent's access is controlled by a scoped token that is provided at runtime.
Scoped token behavior
The scoped token grants the agent access based on the permissions block declared on the stage or Containerized Step Group that contains the Agent step, evaluated against the RBAC of the principal that invokes the pipeline. An agent's effective permission is the intersection of the two: the declared grant can only narrow what the invoking principal is already allowed to do, never expand it. Go to Agent permissions to review the permission grammar and supported resources.
Isolation model
Container isolation: Each agent runs in its own Docker container within an isolated VM. Agents do not share memory, filesystem, or network namespaces with other workloads.
Network scoping: The agent can only reach external services and APIs that the scoped token and network configuration permit.
No ambient permissions: Agents have no implicit access beyond what the scoped token grants. MCP connectors, secrets, and connectors must be explicitly configured on the agent definition.
Policy governance for agents
Enforce organizational standards on Worker Agents using Harness OPA-based governance policies. Platform administrators can control which models, connectors, and configurations are allowed in agent definitions and pipeline steps.
Harness supports OPA-based governance policies for Worker Agents. Platform administrators can enforce organizational standards on agent definitions and on how agents are used in pipelines.
With policy governance on agents, you can write policies that:
Restrict which models or model connectors an agent is allowed to use.
Require specific MCP connectors or block unauthorized ones.
Enforce naming conventions, description requirements, or maximum
max_turnsvalues.Prevent agents from using overly broad permissions or sensitive environment variables.
Policies are evaluated at two points:
On save: When a user creates or updates a Worker Agent, Harness evaluates the agent configuration against your policies. An agent that violates a policy cannot be saved until the violation is resolved.
On run: When a pipeline runs an Agent step, Harness evaluates whether the agent is properly configured in the pipeline before execution proceeds.
Go to Harness Policy As Code overview to learn about OPA-based governance in Harness.
Constraints and known limitations
Understand the current constraints and known limitations before deploying Worker Agents in production pipelines. These limitations cover model provider support, MCP connector requirements, and configuration format constraints.
MODEL NAME OVERRIDE FORMAT
If you override the default model using the optional Model Name field, you must provide an AWS Bedrock inference profile ARN in the format: arn:aws:bedrock:<region>:<account-id>:application-inference-profile/<profile-id>. Bare foundation model IDs (such as claude-opus-4-6) are not supported as overrides.
The following limitations apply to Worker Agents:
MCP connector requirements: MCP connectors require both a valid hosted MCP URL and an API key. A connector name alone is not sufficient.
Model provider support: Anthropic (direct Anthropic and AWS Bedrock endpoints) and OpenAI are supported as model providers.
Expression resolution timing: Harness expressions in the Instructions field are resolved at pipeline execution time, not at agent save time.
Max turns: The
max_turnsparameter caps the agent's reasoning steps per execution to manage cost and latency.Network access: The agent container image must be accessible from your Harness delegate network.
Agent settings: The
agentSettingsfield is currently reserved. Leave it as an empty string.
Troubleshooting
Next steps
Use Worker Agents in pipelines: Add Worker Agent steps to pipelines and reference agent outputs.
Worker Agent configuration: Configure instructions, MCP connectors, inputs, and environment variables.
Worker Agent examples: Explore PR review, IaC plan safety, and spec-driven development examples.
Harness MCP Server: Set up MCP access for your agents.
Triggers overview: Configure triggers to automate agent execution on PR events, schedules, or artifacts.
Last updated
Was this helpful?