> For the complete documentation index, see [llms.txt](https://docs.eyepop.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eyepop.ai/platform/abilities/user-defined-vlm-tasks/task-mode.md). Agents can also search and read this documentation through its [MCP server](https://docs.eyepop.ai/~gitbook/mcp).

# Task mode: classify, detect or classify events

Define a vision-language ability by a task and a list of labels, and get classes or boxes back, on images or video

A task-mode ability has no prompt you write and no schema. You give it a **task** and a list of **prompts**, each a description and the label to report it under; the model's answer comes back in the same shape as any classifier's or detector's, labelled with your labels. The example runs on a street photo, 810 x 1080, of a blue electric minibus with four people walking past it. The outputs were captured from production.

| `task`                 | The ability answers                                                  | Response              |
| ---------------------- | -------------------------------------------------------------------- | --------------------- |
| `image_classification` | which prompts apply to the image                                     | `classes`             |
| `object_detection`     | where the things the prompts describe are                            | `objects`, with boxes |
| `event_classification` | which prompts' events happen in each chunk of a video (`qwen3` only) | `classes`, per chunk  |

### How to specify a task

A task ability is set by these fields:

| Field                           | Required                        | What it does                                                                                                                             |
| ------------------------------- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `task`                          | yes                             | What the ability answers, and in which shape: `image_classification`, `object_detection` or `event_classification` (see the table above) |
| [`prompts`](#prompts)           | yes, at least one               | What to look for, and the label to report each under                                                                                     |
| [`instructions`](#instructions) | no                              | How to look: what the camera shows, which part of the scene matters, what to ignore                                                      |
| `video_chunk_length_ns`         | no, `event_classification` only | The length of the video chunks, in nanoseconds; two seconds when unset                                                                   |

The model's prompt and the shape of its answer follow from the task, so a task ability leaves `text_prompt` and `response_schema` unset. The SDKs refuse an ability that breaks these rules before sending it: the Python SDK raises a `ValidationError`, the Node SDK a `VlmAbilityModeError`.

### Prompts

The prompts are the ability's vocabulary: everything it can answer with. Each prompt has two fields, and both are required:

* `prompt` is the description the model reads. Describe what is visible, in plain words.
* `label` is the name your application gets back, as `classLabel`. Every label in an ability is unique.

The task decides what a prompt means. In `image_classification` a prompt is a statement about the whole image, in `object_detection` a kind of thing to box, and in `event_classification` something that happens over time:

| Task                   | `prompt`                                                                | `label`           | Why it is worded this way                                                      |
| ---------------------- | ----------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------ |
| `image_classification` | `an electric bus`                                                       | `electric`        | One prompt per possible answer, each a full description, not just an adjective |
| `image_classification` | `a diesel bus`                                                          | `diesel`          |                                                                                |
| `object_detection`     | `sunglasses`                                                            | `sunglasses`      | A common object needs only its name                                            |
| `object_detection`     | `a short post at the edge of the road that keeps cars off the sidewalk` | `bollard`         | A less common object is safer described than named; the label stays short      |
| `event_classification` | `people queue in front of the booth`                                    | `queue`           | An event is something that happens: who does what, and where                   |
| `event_classification` | `a person buys a ticket at the booth`                                   | `ticket purchase` | A label may contain spaces                                                     |

A classify answer, for an image or a video chunk, holds only the prompts that apply, each with a `confidence`, so the prompts do not need to rule each other out: a chunk can hold both a `queue` and a `ticket purchase`. That confidence is among your labels only, so with a single prompt it is always 1.0. A detect answer has one box per thing found, labelled with the label of the prompt it matches.

### Instructions

The prompts say *what* to look for. `instructions` says *how to look*: what the camera shows, which part of the scene matters, what to ignore, and how to decide a borderline case. They are added to the model's own instructions for the task, so they refine the answer but never change its shape or add labels. They are optional, up to 2000 characters, and work with every task and every model.

Use them for what holds for every image or video the ability sees:

| Instructions                                                                                                        | What they do                             |
| ------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
| `The camera captures an entire ferry terminal. Focus on the main booth area and ignore adjacent roads and traffic.` | Narrow the part of the scene that counts |
| `Only count people on the sidewalk. Ignore people inside vehicles and people shown on posters or screens.`          | Rule out look-alikes                     |
| `The images come from an infrared night camera, so colours are not reliable. Judge by shape.`                       | Say what the camera shows                |
| `Call a bus electric only if its livery or a sign on it says so. Do not guess from its shape.`                      | Decide a borderline case                 |

Keep what to look for in the prompts and how to look in the instructions: a new kind of answer is a new prompt, not a sentence in the instructions.

Set them when you create the ability, next to the task and prompts, as in [Classify an event](#classify-an-event) below. An update may change them alone, for example in Python with `VlmAbilityUpdate(instructions="Only count people on the sidewalk.")`. They need Python SDK 3.29.0 or Node SDK 4.1.0, or later.

### Classify

Is the bus electric or diesel? Create an ability whose task is `image_classification`, with one prompt per answer, and publish it. It leaves out `model`, so it runs on `qwen3`; task mode works the same on `gemini_4_argon` and `gpt_6_astra`, with `model=VlmModel.gemini_4_argon` in Python or `model: 'gemini_4_argon'` in Node (see [Choosing a model](https://docs.eyepop.ai/platform/abilities/user-defined-vlm-tasks.md#choosing-a-model)):

{% tabs %}
{% tab title="Python" %}

```python
from eyepop import EyePopSdk
from eyepop.data.types import AutoAnnotatePrompt, AutoAnnotateTask, VlmAbilityCreate, VlmAbilityGroupCreate

account_uuid = "<account-uuid>"
namespace = "<your-namespace>"

alias = f"{namespace}.classify.bus-drive"
ability = VlmAbilityCreate(
    name=alias,
    description="Tells an electric bus from a diesel one",
    task=AutoAnnotateTask.image_classification,
    prompts=[
        AutoAnnotatePrompt(prompt="an electric bus", label="electric"),
        AutoAnnotatePrompt(prompt="a diesel bus", label="diesel"),
    ],
)

with EyePopSdk.dataEndpoint(account_id=account_uuid) as endpoint:
    group = endpoint.create_vlm_ability_group(VlmAbilityGroupCreate(
        name=alias, description=ability.description, default_alias_name=alias,
    ))
    created = endpoint.create_vlm_ability(create=ability, vlm_ability_group_uuid=group.uuid)
    endpoint.publish_vlm_ability(vlm_ability_uuid=created.uuid, alias_name=alias)
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { AutoAnnotateTask, EyePop } from '@eyepop.ai/eyepop'

const accountUuid = '<account-uuid>'
const namespace = '<your-namespace>'

const alias = `${namespace}.classify.bus-drive`
const description = 'Tells an electric bus from a diesel one'

const endpoint = await EyePop.dataEndpoint({ accountId: accountUuid }).connect()
try {
    const group = await endpoint.createVlmAbilityGroup({ name: alias, description, default_alias_name: alias })
    const created = await endpoint.createVlmAbility({
        name: alias,
        description,
        task: AutoAnnotateTask.image_classification,
        prompts: [
            { prompt: 'an electric bus', label: 'electric' },
            { prompt: 'a diesel bus', label: 'diesel' },
        ],
        config: {},
        is_public: false,
    }, group.uuid)
    await endpoint.publishVlmAbility(created.uuid, alias)
} finally {
    await endpoint.disconnect()
}
```

{% endtab %}
{% endtabs %}

Then run it in a Pop by its alias. The prompts belong to the ability, so the Pop names only the alias:

{% tabs %}
{% tab title="JSON" %}

```json
{
  "components": [
    { "type": "inference", "ability": "<your-namespace>.classify.bus-drive:latest" }
  ]
}
```

{% endtab %}

{% tab title="Python" %}

```python
from eyepop import EyePopSdk
from eyepop.worker.worker_types import InferenceComponent, Pop

pop = Pop(components=[
    InferenceComponent(ability="<your-namespace>.classify.bus-drive:latest"),
])

with EyePopSdk.sync_worker(pop=pop) as endpoint:
    result = endpoint.upload("street.jpg").predict()

for c in result.get("classes", []):
    print(f"{c['classLabel']} {c['confidence']:.2f}")
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { EyePop, PopComponentType } from '@eyepop.ai/eyepop'

const endpoint = await EyePop.workerEndpoint({
    pop: {
        components: [
            {
                type: PopComponentType.INFERENCE,
                ability: '<your-namespace>.classify.bus-drive:latest',
            },
        ],
    },
}).connect()

try {
    const results = await endpoint.process({ source: { path: 'street.jpg' } })
    for await (const result of results) {
        for (const c of result.classes ?? []) {
            console.log(c.classLabel, c.confidence?.toFixed(2))
        }
    }
} finally {
    await endpoint.disconnect()
}
```

{% endtab %}
{% endtabs %}

```
electric 0.99
```

```json
"classes": [{ "classLabel": "electric", "confidence": 0.9921 }]
```

<figure><img src="https://1072321683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDoCvfjveqiJFmk0cnXCp%2Fuploads%2Fgit-blob-cee458fd297c1ac8447da5d854c71f261a9f0f24%2Fabilities-task-classify.jpg?alt=media" alt="The street photo labelled electric 0.99" width="400"><figcaption><p>The ability answers <code>electric</code>.</p></figcaption></figure>

A classify answer holds only the prompts that apply, so `diesel` is absent rather than scored low. Reading the livery, which says *cero emisiones*, is what tells the two apart.

### Detect

Where are the sunglasses and the bollards? The same, with the task `object_detection`:

{% tabs %}
{% tab title="Python" %}

```python
from eyepop import EyePopSdk
from eyepop.data.types import AutoAnnotatePrompt, AutoAnnotateTask, VlmAbilityCreate, VlmAbilityGroupCreate

account_uuid = "<account-uuid>"
namespace = "<your-namespace>"

alias = f"{namespace}.detect.sunglasses-and-bollards"
ability = VlmAbilityCreate(
    name=alias,
    description="Finds sunglasses and bollards",
    task=AutoAnnotateTask.object_detection,
    prompts=[
        AutoAnnotatePrompt(prompt="sunglasses", label="sunglasses"),
        AutoAnnotatePrompt(prompt="bollard", label="bollard"),
    ],
)

with EyePopSdk.dataEndpoint(account_id=account_uuid) as endpoint:
    group = endpoint.create_vlm_ability_group(VlmAbilityGroupCreate(
        name=alias, description=ability.description, default_alias_name=alias,
    ))
    created = endpoint.create_vlm_ability(create=ability, vlm_ability_group_uuid=group.uuid)
    endpoint.publish_vlm_ability(vlm_ability_uuid=created.uuid, alias_name=alias)
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { AutoAnnotateTask, EyePop } from '@eyepop.ai/eyepop'

const accountUuid = '<account-uuid>'
const namespace = '<your-namespace>'

const alias = `${namespace}.detect.sunglasses-and-bollards`
const description = 'Finds sunglasses and bollards'

const endpoint = await EyePop.dataEndpoint({ accountId: accountUuid }).connect()
try {
    const group = await endpoint.createVlmAbilityGroup({ name: alias, description, default_alias_name: alias })
    const created = await endpoint.createVlmAbility({
        name: alias,
        description,
        task: AutoAnnotateTask.object_detection,
        prompts: [
            { prompt: 'sunglasses', label: 'sunglasses' },
            { prompt: 'bollard', label: 'bollard' },
        ],
        config: {},
        is_public: false,
    }, group.uuid)
    await endpoint.publishVlmAbility(created.uuid, alias)
} finally {
    await endpoint.disconnect()
}
```

{% endtab %}
{% endtabs %}

Then run it in a Pop by its alias:

{% tabs %}
{% tab title="JSON" %}

```json
{
  "components": [
    { "type": "inference", "ability": "<your-namespace>.detect.sunglasses-and-bollards:latest" }
  ]
}
```

{% endtab %}

{% tab title="Python" %}

```python
from eyepop import EyePopSdk
from eyepop.worker.worker_types import InferenceComponent, Pop

pop = Pop(components=[
    InferenceComponent(ability="<your-namespace>.detect.sunglasses-and-bollards:latest"),
])

with EyePopSdk.sync_worker(pop=pop) as endpoint:
    result = endpoint.upload("street.jpg").predict()

for obj in result.get("objects", []):
    print(f"{obj['classLabel']:10} {obj['confidence']:.2f}  "
          f"x={obj['x']:.0f} y={obj['y']:.0f} w={obj['width']:.0f} h={obj['height']:.0f}")
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { EyePop, PopComponentType } from '@eyepop.ai/eyepop'

const endpoint = await EyePop.workerEndpoint({
    pop: {
        components: [
            {
                type: PopComponentType.INFERENCE,
                ability: '<your-namespace>.detect.sunglasses-and-bollards:latest',
            },
        ],
    },
}).connect()

try {
    const results = await endpoint.process({ source: { path: 'street.jpg' } })
    for await (const result of results) {
        for (const obj of result.objects ?? []) {
            console.log(
                obj.classLabel.padEnd(10), obj.confidence?.toFixed(2),
                ` x=${obj.x.toFixed(0)} y=${obj.y.toFixed(0)} w=${obj.width.toFixed(0)} h=${obj.height.toFixed(0)}`,
            )
        }
    }
} finally {
    await endpoint.disconnect()
}
```

{% endtab %}
{% endtabs %}

```
sunglasses 1.00  x=113 y=431 w=42 h=11
sunglasses 1.00  x=265 y=435 w=43 h=14
bollard    0.98  x=426 y=661 w=40 h=98
bollard    1.00  x=658 y=625 w=36 h=89
```

<figure><img src="https://1072321683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDoCvfjveqiJFmk0cnXCp%2Fuploads%2Fgit-blob-5d1d15eb9042e0e61d58f556ad904f1700afaaa9%2Fabilities-task-detect.jpg?alt=media" alt="The street photo with boxes around two pairs of sunglasses and two bollards" width="400"><figcaption><p>The ability boxes what its prompts describe.</p></figcaption></figure>

### Classify an event

Does a ticket sale or a queue happen at the booth? The task `event_classification` answers on video: the ability watches it in chunks, two seconds unless you set `video_chunk_length_ns`, and returns the prompts whose events happen in each chunk. It runs on `qwen3` only; on a remote model it is refused with a 422.

{% tabs %}
{% tab title="Python" %}

```python
from eyepop import EyePopSdk
from eyepop.data.types import AutoAnnotatePrompt, AutoAnnotateTask, VlmAbilityCreate, VlmAbilityGroupCreate

account_uuid = "<account-uuid>"
namespace = "<your-namespace>"

alias = f"{namespace}.event.booth"
ability = VlmAbilityCreate(
    name=alias,
    description="What happens at the ticket booth",
    task=AutoAnnotateTask.event_classification,
    prompts=[
        AutoAnnotatePrompt(prompt="a person buys a ticket at the booth", label="ticket purchase"),
        AutoAnnotatePrompt(prompt="people queue in front of the booth", label="queue"),
    ],
    instructions="The camera captures an entire ferry terminal. Focus on the main booth area and ignore adjacent roads and traffic.",
    video_chunk_length_ns=3_000_000_000,
)

with EyePopSdk.dataEndpoint(account_id=account_uuid) as endpoint:
    group = endpoint.create_vlm_ability_group(VlmAbilityGroupCreate(
        name=alias, description=ability.description, default_alias_name=alias,
    ))
    created = endpoint.create_vlm_ability(create=ability, vlm_ability_group_uuid=group.uuid)
    endpoint.publish_vlm_ability(vlm_ability_uuid=created.uuid, alias_name=alias)
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { AutoAnnotateTask, EyePop } from '@eyepop.ai/eyepop'

const accountUuid = '<account-uuid>'
const namespace = '<your-namespace>'

const alias = `${namespace}.event.booth`
const description = 'What happens at the ticket booth'

const endpoint = await EyePop.dataEndpoint({ accountId: accountUuid }).connect()
try {
    const group = await endpoint.createVlmAbilityGroup({ name: alias, description, default_alias_name: alias })
    const created = await endpoint.createVlmAbility({
        name: alias,
        description,
        task: AutoAnnotateTask.event_classification,
        prompts: [
            { prompt: 'a person buys a ticket at the booth', label: 'ticket purchase' },
            { prompt: 'people queue in front of the booth', label: 'queue' },
        ],
        instructions: 'The camera captures an entire ferry terminal. Focus on the main booth area and ignore adjacent roads and traffic.',
        video_chunk_length_ns: 3_000_000_000,
        config: {},
        is_public: false,
    }, group.uuid)
    await endpoint.publishVlmAbility(created.uuid, alias)
} finally {
    await endpoint.disconnect()
}
```

{% endtab %}
{% endtabs %}

Run it in a Pop by its alias, on a video, as in [Classify an event](https://docs.eyepop.ai/platform/abilities/open-vocabulary/classify-an-event.md#run-it-on-a-video). Each three-second chunk comes back as one prediction, at the chunk's `timestamp`, with the events that happen in it as `classes`.

### When to use it

Use task mode whenever the answer is one of a set of labels, or a set of boxes. You get labels from your own list and scores, with no prompt to word and no text to parse.

To try a task without creating an ability, use the ready-made ones: `eyepop.qwen3`, `eyepop.gemini-4-argon` and `eyepop.gpt-6-astra`, each as `classify` and `detect`, and `eyepop.qwen3.event-classify` on video, take the prompts (and instructions) in the Pop's `params` instead. See [Promptable VLM tasks](https://docs.eyepop.ai/platform/abilities/open-vocabulary/promptable-vlm-tasks.md), with pictures of what all three answer on this photo.

### Next steps

* [User defined VLM tasks](https://docs.eyepop.ai/platform/abilities/user-defined-vlm-tasks.md) — the three ways to ask, and the fields of an ability
* [Free-form prompt](https://docs.eyepop.ai/platform/abilities/user-defined-vlm-tasks/free-form-prompt.md) and [Free-form prompt with a response schema](https://docs.eyepop.ai/platform/abilities/user-defined-vlm-tasks/response-schema.md) — the other two modes
* [Promptable VLM tasks](https://docs.eyepop.ai/platform/abilities/open-vocabulary/promptable-vlm-tasks.md) — the ready-made task abilities

Questions about building a Pop? Reach us at <help@eyepop.ai>.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.eyepop.ai/platform/abilities/user-defined-vlm-tasks/task-mode.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
