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

# Data labeling and classification

> Classify data, extract records, build preference datasets, and review labels with agents.

ML and data teams use agents to turn large collections of unstructured inputs into datasets for training, evaluation, search, and automation. Agno applies the same Pydantic schema pattern across text, images, audio, video, and PDFs, with workflows for parallel labeling, review, and conditional adjudication.

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

from agno.agent import Agent
from pydantic import BaseModel, Field


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


agent = Agent(
    model="google: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')
```

`Agent.run()` validates the response against the Pydantic model. Change the schema and instructions to extract fields, label spans, score responses, or rank preferences.

## What you can build

| Outcome                                                   | Input                    | Pattern                                                                     |
| --------------------------------------------------------- | ------------------------ | --------------------------------------------------------------------------- |
| Classify feedback, support requests, or documents         | Text or files            | [Classification](/use-cases/data-labeling/classification)                   |
| Extract contacts, line items, action items, or attributes | Any supported modality   | [Data extraction](/use-cases/data-labeling/structured-extraction)           |
| Detect entities and PII spans                             | Text                     | [Classification and span labeling](/use-cases/data-labeling/classification) |
| Search an image library in natural language               | Images                   | [Image Search](/use-cases/data-labeling/image-search)                       |
| Build pairwise preference datasets                        | Prompt and two responses | [Preference data](/use-cases/data-labeling/preference-data)                 |
| Score generated responses against a rubric                | Prompt and response      | [LLM as judge](/use-cases/data-labeling/llm-as-judge)                       |
| Review and adjudicate important labels                    | Any labeling task        | [Quality pipeline](/use-cases/data-labeling/quality-pipeline)               |
| Label images, audio, video, and PDFs                      | Media or files           | [Multimodal inputs](/use-cases/data-labeling/multimodal-inputs)             |

The [data labeling cookbook](https://github.com/agno-agi/agno/tree/main/cookbook/data_labeling) contains 18 labeling patterns and a complete Image Search application. The patterns cover text, image, audio, video, and document inputs.

## Run the examples

Create an environment and install the Google provider:

```bash theme={null}
uv venv .venv --python 3.12
source .venv/bin/activate
uv pip install "agno[google]"
export GOOGLE_API_KEY="..."
```

The quality review workflow also uses Anthropic:

```bash theme={null}
uv pip install "agno[anthropic]"
export ANTHROPIC_API_KEY="..."
```

## Developer Resources

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