# Agent classification enrichment
> Identify AI crawlers and automated agents by classifying them by operator and purpose.
> Source: https://docs.snowplow.io/docs/pipeline/enrichments/available-enrichments/agent-classification-enrichment/
> Documentation index: https://docs.snowplow.io/llms.txt

- Cloud: available
- Private Managed Cloud: available
- Self-Hosted: not available
- Add-on: available

This enrichment is a part of the paid Agent Intelligence package for Snowplow CDI. For self-hosted pipelines, only the enrichment is available, but not the underlying dataset.

Find out more about [Snowplow CDI](/docs/cdi/) and [product availability](/docs/get-started/feature-comparison/), or contact [Support](https://support.snowplow.io) to upgrade.

Applies to **Enrich 6.12.0+**[Latest: 6.15.0](/docs/api-reference/versions/#feature-availability-by-version "The latest Enrich version is 6.15.0")

The agent classification enrichment identifies automated agents — AI crawlers, bots, and other non-human clients — by matching the agent name parsed by the [YAUAA enrichment](/docs/pipeline/enrichments/available-enrichments/yauaa-enrichment/) against a lookup of known agents. For each match, it adds an [entity](/docs/fundamentals/entities/) to the event identifying the operator (e.g. `OpenAI`) and, where known, the agent's purpose (e.g. `AI_TRAINING`).

This enrichment is part of the [Agent Intelligence](/docs/events/agent-intelligence/) package.

## Prerequisites

To use this enrichment, you need to enable the [YAUAA enrichment](/docs/pipeline/enrichments/available-enrichments/yauaa-enrichment/). The agent classification enrichment reads the `agentName` field from the YAUAA entity. If YAUAA is not active, no agent classification entity is attached.

## Configuration

The enrichment takes these parameters:

| Parameter            | Required | Description                                                                                                               |
| -------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------- |
| `classificationFile` | ❌        | Location of a JSON file mapping YAUAA agent names to classification records. Already provided for CDI customers.          |
| `classification`     | ❌        | Inline classification records, keyed by YAUAA agent name. Takes precedence over matching entries in `classificationFile`. |

At least one of `classificationFile` or `classification` must be present.

**Console:**

Configure the parameters in the Console enrichment editor. Keep the Console defaults for the `database` and `uri` fields. For example:

```json
{
  "classificationFile": {
    "uri": "<use default value from Console>",
    "database": "<use default value from Console>"
  },
  "classification": {
    "SomeBot": {"operator": "Acme Corp", "purpose": "Monitoring"}
  }
}
```

The agent categories in the default configuration are:

- `AI_SEARCH_INDEX` — agents that power AI-based search features, e.g. `OAI-SearchBot`
- `AI_TRAINING` — agents used for crawling content and training AI models, e.g. `GPTBot`
- `AI_USER_FETCH` — agents that fetch content upon user request, e.g. `ChatGPT-User`
- `LINK_PREVIEW` — agents that visit links in order to provide a preview of the content, e.g. `BingPreview`
- `SEARCH_INDEX` — agents powering traditional search, e.g. `Bingbot`

**Self-Hosted:**

For Self-Hosted, [provide a complete JSON](/docs/pipeline/enrichments/managing-enrichments/terraform/). For example:

```json
{
  "schema": "iglu:com.snowplowanalytics.snowplow.enrichments/agent_classification_enrichment_config/jsonschema/1-0-0",
  "data": {
    "name": "agent_classification_enrichment_config",
    "vendor": "com.snowplowanalytics.snowplow.enrichments",
    "enabled": true,
    "parameters": {
      "classificationFile": {
        "uri": "<your file location>",
        "database": "agent-classifications.json"
      },
      "classification": {
        "SomeBot": {"operator": "Acme Corp", "purpose": "Monitoring"}
      }
    }
  }
}
```

***

> **Tip: Testing with Micro**
>
> Unsure if your enrichment configuration is correct or works as expected? You can easily test it using [Snowplow Micro](/docs/testing/snowplow-micro/), either [through Console](/docs/testing/snowplow-micro/console/) or [on your machine](/docs/testing/snowplow-micro/local/).

### `classificationFile`

> **Tip: Snowplow CDI**
>
> If you're using Snowplow CDI, you don't need to configure this. Use the default values provided in Console.

Points to a JSON file containing the agent-to-classification mapping. The file must be a JSON object where the keys are YAUAA `agentName` values and the values are objects with `operator` (required) and `purpose` (optional). For example:

```json
{
  "ChatGPT-User": {"operator": "OpenAI", "purpose": "AI_USER_FETCH"},
  "GPTBot": {"operator": "OpenAI", "purpose": "AI_TRAINING"},
  "ClaudeBot": {"operator": "Anthropic"}
}
```

> **Tip: Matching logic**
>
> The matching is not case-sensitive, i.e., both `GPTBot` and `GPTbot` (lowercase `b`) will match `GPTBot`.

| Field      | Type   | Description                                                                                                        |
| ---------- | ------ | ------------------------------------------------------------------------------------------------------------------ |
| `uri`      | string | Base URI where the file is hosted. Supports `http:`, `s3:`, and `gs:` schemes. Must not end with a trailing slash. |
| `database` | string | The JSON filename.                                                                                                 |

### `classification`

An inline classification using the same format as the file. Records defined here take precedence over any matching entry in `classificationFile`.

## Output

This enrichment adds an `agent_classification` entity to events where the YAUAA `agentName` matches a known agent.

This enrichment won't produce any output if:

- The YAUAA enrichment is not enabled
- The YAUAA entity does not contain an `agentName` field
- The `agentName` is not found in the classification lookup

### `agent_classification`

**Type:** Entity

Schema for agent classification context generated by agent classification enrichment

**Properties:**

| Property            | Description                                                     |
| ------------------- | --------------------------------------------------------------- |
| `operator` _string_ | _Required._ The vendor operating the agent, e.g. OpenAI         |
| `purpose` _string_  | _Optional._ The purpose of the agent, e.g. AI crawler, if known |
