> ## Documentation Index
> Fetch the complete documentation index at: https://vijil-dome-ui.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Harnesses

> Create targeted evaluations with custom Harnesses, personas, and policies.

While Vijil has a variety of pre-configured [Harnesses](/concepts/evaluation-components/harness) that you can select from, you can also create your own Harnesses in order to obtain a [Trust Score](/concepts/trust-score/introduction) specific to your organization and agent.

## View Custom Harnesses

You can view previously created custom Harnesses by navigating to **Harnesses** in the left sidebar.

To view the prompts, [Personas](/owner-guide/simulate-environment/personas) and [Policies](/owner-guide/simulate-environment/policies) in a custom Harness, click on its row in the **Harnesses** table.

## Create a Custom Harness

1. In the left sidebar, navigate to **Harnesses** and press **Create Harness**.
2. Enter a Harness name and a description.
3. Select an [Agent](/owner-guide/register-agents/what-is-an-agent)
4. <Badge>Optional</Badge> Select one or more [Persona(s)](/owner-guide/simulate-environment/personas).
5. <Badge>Optional</Badge> Select one or more [Policies](/owner-guide/simulate-environment/policies)

## Create a Custom Harness Programmatically

### Create a Harness

<Tabs>
  <Tab title="CLI">
    ```bash theme={null}
    vijil harness custom-create \
      --name "Customer Support Harness" \
      --agent-id "$AGENT_ID"
    ```

    | Flag              | Description                                       | Required |
    | ----------------- | ------------------------------------------------- | -------- |
    | `--name`          | Harness display name                              | Yes      |
    | `--agent-id`      | Agent ID to generate Probes for                   | Yes      |
    | `--description`   | Harness description                               |          |
    | `--persona-ids`   | Persona IDs to include (JSON array)               |          |
    | `--policy-ids`    | Policy IDs to include (JSON array)                |          |
    | `--system-prompt` | Agent description or system prompt for generation |          |
    | `--json`          | Output as JSON                                    |          |
  </Tab>

  <Tab title="MCP">
    With the [Vijil MCP server](/developer-guide/agentic/quickstart) configured, ask Claude Code in natural language:

    <Prompt description="Create a custom Harness called 'Customer Support Harness' for agent a1b2c3d4-… with the GDPR policy">
      Create a custom Harness called 'Customer Support Harness' for agent a1b2c3d4-… with the GDPR policy
    </Prompt>

    Claude creates the Harness and returns the ID.
  </Tab>

  <Tab title="REST API">
    Send a `POST` request to `/v1/custom-harnesses/` with your Agent ID. Personas and Policies are optional.

    ```bash theme={null}
    curl -s -X POST "$VIJIL_URL/v1/custom-harnesses/?team_id=$TEAM_ID" \
      -H "Authorization: Bearer $TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "My Custom Harness",
        "description": "Targeted evaluation for our customer-facing agent.",
        "agent_id": "<agent-id>",
        "persona_ids": ["<persona-id>"],
        "policy_ids": ["<policy-id>"],
        "system_prompt": "You are a helpful customer support assistant."
      }'
    ```

    The API returns `201 Created` with the new Harness object. Save the `id` for later calls.

    ```json theme={null}
    {
      "id": "h1a2b3c4-...",
      "team_id": "t1a2b3c4-...",
      "name": "My Custom Harness",
      "agent_id": "<agent-id>",
      "persona_ids": ["<persona-id>"],
      "policy_ids": ["<policy-id>"],
      "status": "draft"
    }
    ```

    | Field           | Description                                                                                | Required |
    | --------------- | ------------------------------------------------------------------------------------------ | -------- |
    | `name`          | Harness display name (1–255 characters)                                                    | Yes      |
    | `agent_id`      | UUID of the Agent under test                                                               | Yes      |
    | `policy_ids`    | One or more Policy UUID values                                                             | No       |
    | `persona_ids`   | One or more Persona UUID values                                                            | No       |
    | `description`   | Human-readable description                                                                 | No       |
    | `system_prompt` | System prompt used during Harness generation; defaults to the Agent description if omitted | No       |
  </Tab>
</Tabs>

<Note>Custom Harnesses are immutable once created. To change the configuration, delete the Harness and create a new one.</Note>

### Check Generation Status

Harness generation is asynchronous. Poll until `status` is `active`.

<CodeGroup>
  ```bash title="CLI" theme={null}
  vijil harness custom-get <harness_id>
  ```

  ```bash title="API" theme={null}
  curl -s "$VIJIL_URL/v1/custom-harnesses/$HARNESS_ID?team_id=$TEAM_ID" \
    -H "Authorization: Bearer $TOKEN"
  ```
</CodeGroup>

| `status` value               | Meaning                             |
| ---------------------------- | ----------------------------------- |
| `draft` (no workflow)        | Not yet started                     |
| `draft` (workflow `running`) | Generation in progress              |
| `draft` (workflow `failed`)  | Generation failed                   |
| `active`                     | Ready to use in an Evaluation       |
| `failed`                     | Harness creation failed permanently |

### Get Harness Prompts

Retrieve the generated Probes for a completed Harness.

<CodeGroup>
  ```bash title="CLI" theme={null}
  vijil harness custom-prompts <harness_id> --json
  ```

  ```bash title="API" theme={null}
  curl -s "$VIJIL_URL/v1/custom-harnesses/$HARNESS_ID/prompts?team_id=$TEAM_ID" \
    -H "Authorization: Bearer $TOKEN"
  ```
</CodeGroup>

Returns an empty list if the Harness is still in `draft` status.

### List Custom Harnesses

<CodeGroup>
  ```bash title="CLI" theme={null}
  vijil harness custom-list
  vijil harness custom-list --agent-id "$AGENT_ID" --status active
  ```

  ```bash title="API" theme={null}
  curl -s "$VIJIL_URL/v1/custom-harnesses/?team_id=$TEAM_ID&status=active" \
    -H "Authorization: Bearer $TOKEN"
  ```
</CodeGroup>

Both support filtering by `agent_id` and `status`, with `limit` and `offset` for pagination.

### Cancel Generation

Stop a Harness that is still generating.

<CodeGroup>
  ```bash title="CLI" theme={null}
  vijil harness custom-cancel <harness_id>
  ```

  ```bash title="API" theme={null}
  curl -s -X POST "$VIJIL_URL/v1/custom-harnesses/$HARNESS_ID/cancel?team_id=$TEAM_ID" \
    -H "Authorization: Bearer $TOKEN"
  ```
</CodeGroup>

### Delete a Harness

<CodeGroup>
  ```bash title="CLI" theme={null}
  vijil harness custom-delete <harness_id>
  vijil harness custom-delete <harness_id> --yes
  ```

  ```bash title="API" theme={null}
  curl -s -X DELETE "$VIJIL_URL/v1/custom-harnesses/$HARNESS_ID?team_id=$TEAM_ID" \
    -H "Authorization: Bearer $TOKEN"
  ```
</CodeGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Run Evaluations" icon="play" href="/developer-guide/evaluate/running-evaluations">
    Execute custom Harness evaluations
  </Card>

  <Card title="Understand Results" icon="chart-bar" href="/developer-guide/evaluate/understanding-results">
    Analyze custom Harness results
  </Card>

  <Card title="Personas" icon="users" href="/owner-guide/simulate-environment/personas">
    Learn more about personas
  </Card>

  <Card title="Policies" icon="scroll" href="/owner-guide/simulate-environment/policies">
    Learn more about policies
  </Card>
</CardGroup>
