> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/deployment/monitoring-and-analytics/active-learning.md).

# Active Learning

## About

Active Learning collects production data from your deployed models and surfaces it for review and retraining. When your model runs inference in production, Active Learning automatically samples images based on rules you configure (such as low-confidence predictions or specific classes) and queues them for human review.

{% hint style="info" %}
Active Learning requires a cloud deployment. It is available on plans with the Annotation Review feature.
{% endhint %}

## Web App

### Enable Active Learning

1. Open your Project and select "Active Learning" in the left sidebar.
2. Toggle Active Learning on.

Your Project must have a trained model and an active cloud deployment for Active Learning to collect data.

### Configure Collection Rules

Active Learning has two categories of configuration: collection limits and conditions.

#### Collection Limits

Control how much data Active Learning collects:

* Sampling rate: the percentage of inferences to sample (ex: 0.5%)
* Per-minute, hourly, and daily image caps
* Compression level and maximum image dimensions
* Batch recreation frequency (daily, weekly, monthly, or never)
* Whether to persist model predictions with collected images

To edit these settings, click "Edit" in the Collection Limits section and update the values in the configuration modal.

#### Conditions

Conditions filter which images get collected. You can define rules based on your model type:

* Confidence thresholds (ex: collect images where confidence falls below 60%)
* Specific classes of interest
* Detection count requirements

To set up conditions, click "Edit" in the Conditions section.

### Manage Active Learning From the Agent

You can also manage Active Learning in [Roboflow Agent](https://docs.roboflow.com/agents/roboflow-agent). Open a project tab, select "Settings", and use the same toggle, Collection Limits, and Conditions as this page. This needs the Manage Workflows, Publish Workflows, and Dataset Active Learning permissions.

### Review Collected Images

As Active Learning collects images, they appear in the Images section of the Active Learning page. The page shows counts of images ready for review and images currently being reviewed.

To start reviewing:

1. Click "Review Images" to open the review queue.
2. Browse batches by status (Not Started, In Progress) and sort by creation date, image count, or progress.
3. Select a batch to begin reviewing.

### Assign Reviewers

You can distribute review work across your team:

1. Open the review queue and select a batch.
2. Click to assign reviewers.
3. Choose team members, set the number of images to assign, and optionally add review instructions.
4. Toggle "Shuffle Images" to randomize which images each reviewer receives.

Reviewers are notified when images are assigned to them. You can reassign images to a different reviewer at any time.

### How Active Learning Fits Your Training Loop

The typical workflow:

1. Train and deploy a model.
2. Enable Active Learning with conditions tuned to your use case.
3. Production data that matches your conditions is collected and queued.
4. Reviewers label the collected images.
5. Add the reviewed images to your dataset and retrain to improve your model.

This creates a feedback loop where your model improves on the cases where it struggles most.

## HTTP API

Use the HTTP API to enable or disable Active Learning, update collection rules, and list images in the review queue. The endpoints use `https://api.roboflow.com` and require an API key in the `api_key` query parameter, request body, or bearer authorization header.

### Get Active Learning Configuration

<mark style="color:green;">`GET`</mark> `/:workspace/:project/deploy/active-learning`

Required scope: `project:read`

```bash
curl "https://api.roboflow.com/my-workspace/my-project/deploy/active-learning?api_key=$ROBOFLOW_API_KEY"
```

The response includes the Project, deployment Workflow, selected model, deployability, and Active Learning configuration:

```json
{
  "project": { "url": "my-project", "name": "My Project" },
  "workflow": { "url": "my-project-base-workflow" },
  "model": {
    "id": "rfdetr-medium",
    "kind": "pretrained",
    "displayName": "RF-DETR Medium",
    "modelId": "rfdetr-medium"
  },
  "deployability": {
    "status": "deployable",
    "modelWasConfigured": false,
    "selectedModelId": null,
    "selectionReason": null
  },
  "activeLearning": {
    "enabled": false,
    "collectionLimits": {
      "dataPercentage": 100,
      "minutelyUsageLimit": 10,
      "hourlyUsageLimit": 100,
      "dailyUsageLimit": 1000,
      "labelingBatchesRecreationFrequency": "daily",
      "usageQuotaName": "upload_quota_active_learning",
      "imageCompressionLevel": 95,
      "maxImageHeight": 1080,
      "maxImageWidth": 1920,
      "persistPredictions": true
    },
    "filters": []
  }
}
```

### Enable Active Learning

<mark style="color:green;">`POST`</mark> `/:workspace/:project/deploy/active-learning/enable`

Required scope: `project:update`

```bash
curl -X POST "https://api.roboflow.com/my-workspace/my-project/deploy/active-learning/enable" \
  -H "Content-Type: application/json" \
  -d '{ "api_key": "'$ROBOFLOW_API_KEY'" }'
```

If no model is configured, the service attempts to select one. A `400` response means the Workflow is not deployable. The response has the same shape as [Get Active Learning Configuration](#get-active-learning-configuration), with `activeLearning.enabled` set to `true`.

### Disable Active Learning

<mark style="color:green;">`POST`</mark> `/:workspace/:project/deploy/active-learning/disable`

Required scope: `project:update`

```bash
curl -X POST "https://api.roboflow.com/my-workspace/my-project/deploy/active-learning/disable" \
  -H "Content-Type: application/json" \
  -d '{ "api_key": "'$ROBOFLOW_API_KEY'" }'
```

The response has the same shape as [Get Active Learning Configuration](#get-active-learning-configuration), with `activeLearning.enabled` set to `false`.

### Update Active Learning Configuration

<mark style="color:green;">`POST`</mark> `/:workspace/:project/deploy/active-learning/configuration`

Required scope: `project:update`

Enable Active Learning before you configure it on a new Project. The request must include `collectionLimits`. The `filters` array is optional. If you omit it, existing filters do not change.

```bash
curl -X POST "https://api.roboflow.com/my-workspace/my-project/deploy/active-learning/configuration" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "'$ROBOFLOW_API_KEY'",
    "collectionLimits": {
      "dataPercentage": 50,
      "minutelyUsageLimit": 10,
      "hourlyUsageLimit": 100,
      "dailyUsageLimit": 1000,
      "labelingBatchesRecreationFrequency": "daily",
      "usageQuotaName": "default",
      "imageCompressionLevel": 85,
      "imageName": "camera-1",
      "maxImageHeight": 1080,
      "maxImageWidth": 1920,
      "registrationTags": ["production"],
      "persistPredictions": true
    },
    "filters": [
      {
        "type": "classConfidence",
        "classFilterMode": "any",
        "classes": ["cat"],
        "confidenceLowerBound": 0.2,
        "confidenceUpperBound": 0.8
      }
    ]
  }'
```

The required collection limit fields are:

* `dataPercentage`: percentage of inferences to collect, from `0` to `100`
* `minutelyUsageLimit`: maximum images collected per minute, or `0` for unlimited
* `hourlyUsageLimit`: maximum images collected per hour
* `dailyUsageLimit`: maximum images collected per day
* `labelingBatchesRecreationFrequency`: `"never"`, `"daily"`, `"weekly"`, or `"monthly"`
* `usageQuotaName`: a non-empty quota identifier

The optional fields are `imageCompressionLevel`, `imageName`, `registrationTags`, and `persistPredictions`. To resize images, provide both `maxImageHeight` and `maxImageWidth`. Providing only one removes the existing image size limit.

Active Learning supports two filter types:

* `classConfidence`: collect predictions for selected classes within a confidence range. `classFilterMode` can be `"any"`, `"in"`, or `"out"`.
* `detectionSize`: collect predictions with bounding boxes between `sizeLowerPercentage` and `sizeUpperPercentage` of the image size. This filter only supports object detection and instance segmentation Projects. Other Project types return `400`.

The response has the same shape as [Get Active Learning Configuration](#get-active-learning-configuration). A `400` response includes validation details for invalid collection limits or filters.

### List Active Learning Images

<mark style="color:green;">`GET`</mark> `/:workspace/:project/deploy/active-learning/images`

Required scope: `project:read`

```bash
curl "https://api.roboflow.com/my-workspace/my-project/deploy/active-learning/images?api_key=$ROBOFLOW_API_KEY&page=1&pageSize=20"
```

The endpoint accepts these optional query parameters:

* `page`: page number, starting at `1`
* `pageSize`: items per page, up to `50`
* `search`: text matched against queue names, types, IDs, reviewers, and labelers
* `reviewer`: reviewer email or `"unassigned"`
* `status`: `"all"`, `"not_started"`, or `"in_progress"`
* `sortBy`: `"created"`, `"images"`, or `"progress"`
* `sortDirection`: `"asc"` or `"desc"`

The response includes review queue counts, paginated queue items, batches, annotation jobs, and image totals:

```json
{
  "activeLearningImages": {
    "totalImagesReadyForReview": 0,
    "totalImagesBeingReviewed": 0,
    "batches": [],
    "annotationJobs": [],
    "latestBatch": null,
    "latestAnnotationJob": null,
    "sampleImages": [],
    "reviewQueueCounts": {
      "all": 0,
      "notStarted": 0,
      "inProgress": 0
    },
    "reviewQueuePage": {
      "page": 1,
      "pageSize": 20,
      "totalItems": 0,
      "totalPages": 1,
      "items": [],
      "search": "",
      "status": "all",
      "sortBy": "created",
      "sortDirection": "desc",
      "reviewer": ""
    }
  }
}
```

## Python SDK

`Workspace.active_learning()` runs inference on every image in a directory and conditionally uploads the image (and its prediction) to a destination project. It's the SDK's built-in active-learning loop: bootstrap a labeling queue from raw footage by letting your existing model triage what's worth labeling.

The same pattern is best built as a [Workflow](https://docs.roboflow.com/workflows/manage/manage-workflows#python-sdk) for production use, but `active_learning()` is the fastest path from "I have a folder of frames" to "labelled data going into a project".

### Basic usage

```python
import roboflow

rf = roboflow.Roboflow(api_key="YOUR_API_KEY")
ws = rf.workspace()

ws.active_learning(
    raw_data_location="./frames",
    raw_data_extension=".jpg",
    inference_endpoint=["my-detector", 3],   # [project, version]
    upload_destination="my-detector",         # destination project
    conditionals={
        "required_class_variance_count": 1,           # at least 1 different class
        "minimum_size_requirement": 100,              # min pixels per detection
        "maximum_size_requirement": 4000000,
        "confidence_interval": [0, 60],               # only low-confidence predictions
    },
)
```

#### Parameters

* `raw_data_location` (str) - directory of input images.
* `raw_data_extension` (str) - image extension to match (e.g. `.jpg`, `.png`).
* `inference_endpoint` (list, `[project, version]`) - the model to run as the triage step.
* `upload_destination` (str) - project id to upload qualifying images and predictions into. Often the same project as the model.
* `conditionals` (dict) - rules that determine whether an image gets uploaded. Common keys:
  * `confidence_interval` - `[min, max]`; only images whose detections fall in this range are forwarded.
  * `required_class_variance_count` - minimum distinct classes required.
  * `minimum_size_requirement` / `maximum_size_requirement` - filter by detection area in pixels.
  * `required_class_count` - total detections.
* `use_localhost` (bool, default `False`) - when `True`, hit a self-hosted [Roboflow Inference](/deployment/self-hosted/self-hosted.md) server instead of hosted inference.
* `local_server` (str) - base URL for the local inference server. Defaults to `http://localhost:9001/`.

### Why use it

The typical loop:

1. Train a v1 model on a small labeled set.
2. Point `active_learning()` at a folder of unlabeled production data.
3. Forward only the images where the model is uncertain (low confidence) or sees rare classes.
4. Label those in the Roboflow web app.
5. Generate v2 with the new examples and retrain.

Tuning `conditionals` is what turns this from "upload everything" into a real triage policy.

### Bigger pipelines

If your input is a video stream, your model lives behind a Workflow, or you want batching and retries, build the equivalent as a [Workflow](https://docs.roboflow.com/workflows/manage/manage-workflows#python-sdk). `active_learning()` is best for one-off bootstrapping passes from a static folder.

## MCP Server

Connect your AI agent to the [MCP Server](https://docs.roboflow.com/agents/mcp-server) and it can set up Active Learning with these tools:

<table data-search="false"><thead><tr><th width="290">Tool</th><th>Description</th></tr></thead><tbody><tr><td><code>project_deployment_enable_active_learning</code></td><td>Enable Active Learning for a Project Deployment.</td></tr><tr><td><code>project_deployment_configure_active_learning</code></td><td>Configure how a deployment collects Active Learning data.</td></tr><tr><td><code>project_deployment_disable_active_learning</code></td><td>Pause Active Learning collection.</td></tr><tr><td><code>project_deployment_list_review_queues</code></td><td>List review queues fed by production inference.</td></tr></tbody></table>
