> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-codex-docs-audit-20260719-0149.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Data labeling and classification

> Label and classify text, images, audio, video, and PDFs.

Agents can:

* Turn text, images, audio, video, and PDFs into structured records.
* Assign labels, label sets, taxonomy paths, and labeled spans.
* Score and rank model outputs for evals and preference data.
* Add a reviewer and an adjudicator when label quality matters.

Each task follows a similar pattern: an agent with an `output_schema`.

`Agent.run()` accepts text and media inputs. Set `output_schema` to validate the response against a Pydantic model.

## Example

```python theme={null}
from typing import Literal

from agno.agent import Agent
from agno.models.google import Gemini
from pydantic import BaseModel, Field


class Classification(BaseModel):
    label: Literal["positive", "negative", "neutral"] = Field(
        ..., description="The assigned sentiment label"
    )


agent = Agent(
    model=Gemini(id="gemini-3.5-flash"),
    instructions="You classify product reviews by sentiment.",
    output_schema=Classification,
)

result = agent.run("Broken on arrival, total waste of money.").content
# Classification(label='negative')
```

Swap the schema and instructions and the same pattern covers data extraction, span labeling, scoring, and preference ranking.

<Tip>
  If you're looking to jump straight into code, the [data labeling cookbook](https://github.com/agno-agi/agno/tree/v2.7.4/cookbook/data_labeling) contains 40+ runnable recipes across 18 data labeling patterns.
</Tip>

## Data labeling workflows

Pick the page that matches what you need.

| Workload             | Input                    | Output                          | Page                                                              |
| -------------------- | ------------------------ | ------------------------------- | ----------------------------------------------------------------- |
| Data extraction      | Any modality             | Typed Pydantic object           | [Data extraction](/use-cases/data-labeling/structured-extraction) |
| Classification       | Any modality             | One label, label set, or spans  | [Classification](/use-cases/data-labeling/classification)         |
| Scoring / evaluation | Prompt + response        | Rubric scores                   | [LLM as judge](/use-cases/data-labeling/llm-as-judge)             |
| Preference ranking   | Prompt + two responses   | Winner + rationale              | [Preference data](/use-cases/data-labeling/preference-data)       |
| Non-text input       | Image, audio, video, PDF | Any of the above                | [Multimodal inputs](/use-cases/data-labeling/multimodal-inputs)   |
| Reviewed labels      | Any input                | Adjudicated label + audit trail | [Quality pipeline](/use-cases/data-labeling/quality-pipeline)     |

## Model choice

The cookbooks use `gemini-3.5-flash` for text, image, audio, video, and PDF examples. A replacement model must support the input modality and structured output used by the recipe.

To run the examples, install the Google provider and set your API key:

```bash theme={null}
pip install -U "agno[google]"
export GOOGLE_API_KEY=***
```

The [Quality pipeline](/use-cases/data-labeling/quality-pipeline) runs its second labeler, reviewer, and adjudicator on Anthropic for provider diversity. That page needs a second provider and key:

```bash theme={null}
pip install -U "agno[anthropic]"
export ANTHROPIC_API_KEY=***
```

## Explore

<CardGroup cols={2}>
  <Card title="Data extraction" icon="brackets-curly" href="/use-cases/data-labeling/structured-extraction">
    Turn any modality into a typed object, with optional per-field confidence.
  </Card>

  <Card title="Classification" icon="tags" href="/use-cases/data-labeling/classification">
    Single-label, multi-label, hierarchical, and span labeling.
  </Card>

  <Card title="LLM as judge" icon="gavel" href="/use-cases/data-labeling/llm-as-judge">
    Score outputs against a rubric. The same machinery, used for evals.
  </Card>

  <Card title="Preference data" icon="scale-balanced" href="/use-cases/data-labeling/preference-data">
    Rank A vs B for RLHF and DPO datasets.
  </Card>

  <Card title="Multimodal inputs" icon="photo-film" href="/use-cases/data-labeling/multimodal-inputs">
    Feed images, audio, video, and PDFs into any labeler.
  </Card>

  <Card title="Quality pipeline" icon="users-gear" href="/use-cases/data-labeling/quality-pipeline">
    Two labelers, a reviewer, and an adjudicator with an audit trail.
  </Card>
</CardGroup>

## Developer Resources

* [Data labeling cookbook](https://github.com/agno-agi/agno/tree/v2.7.4/cookbook/data_labeling)
* [Structured output](/input-output/structured-output/agent)
* [Multimodal agents](/multimodal/overview)
