> 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-ai/3.0/use-harness-ai/ai-agents/productivity-agent.md).

# Developer Productivity Agents

AI agents that automate tedious engineering workflows — feature flag cleanup, framework upgrades, and repository onboarding.

Harness Developer Productivity agents automate common engineering workflows that are tedious and time-consuming. The **Feature Flag Cleanup** agent removes stale flags from codebases, the **React Upgrade** agent handles framework upgrades with custom prompts, and the **Onboarding** agent imports repositories and auto-generates CI pipelines.

***

### Feature Flag Cleanup Agent <a href="#feature-flag-cleanup-agent" id="feature-flag-cleanup-agent"></a>

The Feature Flag Cleanup agent is a Harness Managed Worker Agent that removes a stale feature flag from your codebase, keeps only the code path for the treatment you choose, and removes unused imports and variables. It commits the cleanup directly to the branch you specify. It does not create a branch or open a pull request.

To commit to Harness Code, the agent needs a Harness MCP Server connector in its `mcp_connectors` input. Go to [Feature Flag Cleanup](/harness-ai/3.0/use-harness-ai/ai-agents/harness-managed-agents.md#feature-flag-cleanup) for the inputs, prerequisites, how the agent works, and troubleshooting.

{% hint style="info" %}
**LOOKING FOR THE COMMUNITY TEMPLATES?**

The remote pipeline and stage templates for feature flag cleanup require an Anthropic API key and do not use this agent. Go to [Automated feature flag cleanup](https://developer.harness.io/feature-management-experimentation/management-and-administration/automated-feature-flag-cleanup) to use them.
{% endhint %}

***

### React Upgrade Agent <a href="#react-upgrade-agent" id="react-upgrade-agent"></a>

The React Upgrade agent automates React version upgrades and code modifications using custom prompts. Despite its name, it's the most flexible agent — it accepts any free-form `prompt` input, making it suitable for framework upgrades, refactoring, dependency updates, and performance optimizations.

#### Use Cases <a href="#use-cases" id="use-cases"></a>

* Upgrade React from version 17 to 18
* Refactor class components to functional components with hooks
* Update deprecated API usage across the codebase
* Migrate from one state management library to another
* Apply performance optimizations based on custom criteria

#### Key Inputs <a href="#key-inputs" id="key-inputs"></a>

| Input          | Type      | Description                                                           |
| -------------- | --------- | --------------------------------------------------------------------- |
| `llmConnector` | connector | LLM connector for AI operations                                       |
| `harnessKey`   | secret    | Harness API key                                                       |
| `gitConnector` | connector | Git connector for repository access                                   |
| `repo`         | string    | Repository name                                                       |
| `branch`       | string    | Target branch                                                         |
| `prompt`       | string    | Custom prompt describing the upgrade/modification task (**required**) |

#### Pipeline Configuration <a href="#pipeline-configuration" id="pipeline-configuration"></a>

```yaml
pipeline:
  clone:
    depth: 1
    ref:
      name: <+inputs.branch>
      type: branch
    repo: <+inputs.repo>
    connector: "<+inputs.gitConnector != null ? inputs.gitConnector.id : ''>"
  stages:
    - name: react_upgrade
      id: stage1
      steps:
        - name: coding_agent
          id: step1
          run:
            container:
              image: anewdocker25/mydockerhub:coding-agent
            with:
              detailed_logging: "true"
              max_iterations: "300"
              working_directory: /harness
              show_diff: "false"
              prompt: <+inputs.prompt>
              react_upgrade: "true"
            env:
              ANTHROPIC_API_KEY: <+inputs.llmConnector.token>
        - name: show_git_diff
          id: step2
          run:
            shell: bash
            script: |-
              git add -A
              git diff --cached
        - name: fix_env_variables
          id: step3
          run:
            shell: bash
            script: |-
              # Detect SCM provider and set credentials
              # Exports SCM_PROVIDER, TOKEN, NETRC_USERNAME, etc.
            env:
              HARNESS_API_KEY: <+inputs.harnessKey>
              SCM_TOKEN: <+inputs.gitConnector.token>
        - name: push_and_create_pr
          id: step4
          run:
            container:
              image: himanshu6956/create-pr-plugin:latest
            env:
              PLUGIN_SCM_PROVIDER: <+pipeline.stages.stage1.steps.step3.output.outputVariables.SCM_PROVIDER>
              PLUGIN_TOKEN: <+pipeline.stages.stage1.steps.step3.output.outputVariables.TOKEN>
              PLUGIN_REPO: ${{inputs.repo}}
              PLUGIN_SOURCE_BRANCH: ${{inputs.branch}}
              PLUGIN_BRANCH_SUFFIX: react-upgrade-code-agent
              PLUGIN_COMMIT_MESSAGE: "React upgrade: automated changes by Harness AI"
              PLUGIN_CREATE_PR: "true"
              PLUGIN_PR_TITLE: "React Upgrade: Automated changes by Harness AI"
      platform:
        os: linux
        arch: arm64
  inputs:
    llmConnector:
      type: connector
    harnessKey:
      type: secret
      default: harness_api_key
    gitConnector:
      type: connector
    repo:
      type: string
    branch:
      type: string
      default: main
      description: The branch to clone from and create PR against (defaults to main)
    prompt:
      type: string
      required: true
      description: The prompt/task for the coding agent to execute
```

{% hint style="info" %}
**FLEXIBLE BRANCHING**

The React Upgrade agent uses up to 300 AI iterations and creates branches with timestamps (e.g., `react-upgrade-code-agent-1706123456`) to avoid conflicts when running multiple upgrades in parallel.
{% endhint %}

***

### Onboarding Agent <a href="#onboarding-agent" id="onboarding-agent"></a>

The Onboarding agent streamlines repository setup in Harness. It imports repositories from GitHub into Harness Code, analyzes the repo structure to detect technologies and build commands, and auto-generates a CI pipeline tailored to the project.

#### How It Works <a href="#how-it-works" id="how-it-works"></a>

1. **Repository Import** — Clones the source repository from GitHub and imports it into Harness Code.
2. **Technology Detection** — Claude Sonnet analyzes the repo structure (languages, frameworks, build tools, dependencies).
3. **Pipeline Generation** — Claude Opus generates a complete CI pipeline based on the detected technology stack.
4. **Pipeline Creation** — The generated pipeline is created in Harness via the API.

#### Unique Architecture <a href="#unique-architecture" id="unique-architecture"></a>

The Onboarding agent has a few notable differences from other agents: it uses **two Claude models** in sequence (Sonnet for fast analysis, Opus for high-quality pipeline generation), it has **no clone step** in the pipeline (the agent container handles cloning itself), and it runs on `linux/amd64` rather than the `arm64` platform used by most agents.

#### Key Inputs <a href="#key-inputs" id="key-inputs"></a>

| Input           | Type   | Description                                               |
| --------------- | ------ | --------------------------------------------------------- |
| `anthropicKey`  | secret | Anthropic API key for Claude AI                           |
| `harnessKey`    | secret | Harness API key for creating repos and pipelines          |
| `scmToken`      | secret | Optional SCM token for private repository access          |
| `repoNamespace` | string | Source repository namespace/owner (e.g., `myorg`)         |
| `repoName`      | string | Source repository name                                    |
| `connectorRef`  | string | Harness connector reference for git operations (optional) |

#### Pipeline Configuration <a href="#pipeline-configuration" id="pipeline-configuration"></a>

```yaml
pipeline:
  stages:
    - name: onboarding
      steps:
        - name: onboarding_agent
          run:
            container:
              image: colinharness/onboarding-agent:1.0.49
            env:
              ANTHROPIC_API_KEY: <+inputs.anthropicKey>
              HARNESS_API_KEY: <+inputs.harnessKey>
              REPO_NAME: <+inputs.repoName>
              REPO_NAMESPACE: <+inputs.repoNamespace>
              SCM_TOKEN: <+inputs.scmToken>
              CONNECTOR_REF: <+inputs.connectorRef>
      platform:
        os: linux
        arch: amd64
  inputs:
    anthropicKey:
      type: secret
      default: account.onboarding_anthropic_api_key
      description: Anthropic API key for Claude AI
    harnessKey:
      type: secret
      default: account.onboarding_harness_token_pat
      description: Harness API key for creating pipelines
    scmToken:
      type: secret
      description: GitHub token for accessing private repositories (optional)
    repoName:
      type: string
      required: true
      description: Name of repository to clone
    repoNamespace:
      type: string
      required: true
      description: Namespace of repository to clone (e.g., GitHub username)
    connectorRef:
      type: string
      description: Harness connector reference for git operations (optional)
  name: onboarding
```

{% hint style="info" %}
**MIGRATION MADE EASY**

The Onboarding agent is ideal for teams migrating to Harness. Import existing GitHub repositories and automatically generate CI pipelines — dramatically reducing the time to get up and running.
{% endhint %}

{% @harness-feedback/feedback %}
