跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
其他技能

create-agent

Create and update Harness AI agent instances - standalone templates for agentic workflows in pipelines. Use when asked to create agent, update agent, modify agent spec, build autonomous systems, or work with AI agents.

Harness · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add harness/harness-skills --skill create-agent

技能说明


name: create-agent description: >- Create and update Harness AI agent instances - standalone templates for agentic workflows in pipelines. Use when asked to create agent, update agent, modify agent spec, build autonomous systems, or work with AI agents. metadata: author: Harness version: 1.0.0 mcp-server: harness-mcp-v2 module: global summary: Create and update Harness AI agent instances for agentic pipeline workflows license: Apache-2.0 compatibility: Requires Harness MCP v2 server (harness-mcp-v2)

Custom AI Agents

Create and update Harness AI agent instances - standalone templates used as building blocks in pipelines for automated code, agentic workflows, and infrastructure tasks.

Instructions

Follow this workflow to create or update an agent. This is INTERACTIVE — show YAML for review and wait for confirmation before creating/updating the agent.

Phase 1: Check Existing Solutions First

IMPORTANT: Before creating a new agent, check if an existing one can solve the use case.

  1. List existing agents — Call harness_list with resource_type="agent" (include org_id and project_id if scoped to a project)
    • Check if any system or custom agents already exist that can handle this task
    • Ask user if they want to use/modify an existing agent instead of creating new
  2. For updating existing agents — Use harness_get with resource_type="agent" and agent_id to retrieve the current agent configuration
    • Review the current spec, name, description, and other fields
    • Identify what needs to be changed (spec, name, description, wiki, logo)
    • Use harness_update (not harness_create) to update the agent with only the fields that need modification

Phase 2: Requirements Gathering

If creating a new agent or updating an existing one, collect the following before generating YAML:

1. Agent Metadata

  • Name: Display name for the agent (e.g. "Code Coverage Agent", "PR Reviewer")
  • Description: Brief description of the agent's purpose (optional)
  • UID/UUID: Always generate this from the name and pass it explicitly to create/update APIs. Do not rely on the create API fallback.
    • Generation rule : prefix with ca_, then lowercase the name, convert spaces and hyphens (-) to _, replace any remaining non-alphanumeric runs with _, collapse duplicate _, and trim leading/trailing _ from the slug portion (e.g. "Code Coverage Agent" → ca_code_coverage_agent, "PR Reviewer" → ca_pr_reviewer)
    • If the generated UID conflicts with an existing agent, ask the user whether to reuse/update that agent or append a short suffix

2. Task Details - Interactive Requirements Gathering

Ask and clarify the following with the user:

  1. Agent's exact goal: What specific outcome should the agent achieve? Be specific — avoid vague goals.
  2. Inputs the agent needs: Repository info? Execution context? Configuration? Secrets?
  3. Outputs the agent produces: Files? External actions? Data/metrics?
  4. What the agent works on: Specific file paths? External services? Databases/APIs?
  5. Task workflow: Step-by-step workflow (do 1, then 2, then 3, etc.)
  6. Constraints and preferences: Limitations, rules, or coding standards (e.g., "Use idiomatic Go code", "Do not modify existing tests")
  7. Definition of done: How do you know the agent succeeded? Specific criteria, artifacts, or exit conditions.

3. Recommend Configuration

Based on requirements, recommend and verify with the user:

  1. Task instructions (task field):

    • Break down the goal into detailed step-by-step instructions
    • Include specific commands, file paths, and expected outcomes
    • Reference inputs using ${{inputs.fieldName}} syntax inside PLUGIN_TASK and other env vars
    • Add ## RULES section at the end with constraints formatted as markdown bullet points
  2. Runtime inputs (inputs section in spec):

    • Only add if user confirms runtime parameters are needed
    • Map each input to what the agent needs (repo, branch, executionId, thresholds, etc.)
    • Always set a default value for every non-required input — if ${{inputs.fieldName}} is referenced in PLUGIN_TASK or any env var and no value is supplied at runtime nor a default exists, the agent will error at execution time
    • Always include allowedDomains so users understand and control non-LLM/non-MCP network access
  3. Connectors:

    • LLM connector for model access (required for all agents) - User must create via Harness UI or MCP
    • MCP connectors for external services (GitHub, Slack, Harness platform, etc.) - only if needed
    • All authentication and secrets are managed within the connectors

Present this recommended configuration to the user and iterate until confirmed.

4. Default Configuration & Inputs

Agent Structure: Agents use agent.step.group.steps format — the run step is nested inside a named step group.

Default structure:

version: 1
agent:
  step:
    group:
      steps:
        - name: Agent
          if: <+Always>
          id: agent
          run:
            container:
              image: pkg.harness.io/vrvdt5ius7uwygso8s0bia/harness-agents/harness-ai-agent:latest
            env:
              PLUGIN_TASK: |
                <step-by-step task instructions>
              PLUGIN_MAX_TURNS: 150
              PLUGIN_HARNESS_CONNECTOR: ${{inputs.llmConnector.id}}
              PLUGIN_ALLOWED_DOMAINS: ${{inputs.allowedDomains}}

Required environment variables:

env:
  PLUGIN_TASK: |                                   # Task instructions go here as a multiline string
    <step-by-step instructions>
  PLUGIN_MAX_TURNS: 150                            # Adjust 100-200 based on task complexity
  PLUGIN_HARNESS_CONNECTOR: ${{inputs.llmConnector.id}}  # References llmConnector input's id property
  PLUGIN_ALLOWED_DOMAINS: ${{inputs.allowedDomains}}      # Regexes for additional ne
阅读完整来源 ↗