# Tasks and routes

> The built-in tasks, your own tasks, and every field of a route in sypnia.toml.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://ai.docs.sypnia.com/models/tasks-and-routes/

For agents: Built-in tasks: chat, write, code, summarize, extract, classify, vision, embed (Cloud gives each a default model chosen and tested by Sypnia; self-hosted has no defaults). Own tasks: kebab-case names. Request: model "task:<name>" or a catalog id (direct model use still metered, logged, limited; can be switched off per project with direct_models: false). sypnia.toml: [ai] {direct_models}, [ai.tasks.<name>] {model (default | catalog id), fallbacks [ids], instructions (locked, placed first), params {temperature, max_output_tokens, reasoning}, output (JSON schema file), tools (allowed names), browser (bool), limits, safety {moderation, redact}, store {days}, cache {ttl}, pin}. ai routes diff|apply; applying needs owner or admin (a person); every change versioned with who/when; rollback.

## The built-in tasks

| Task        | For                                                                           |
| ----------- | ----------------------------------------------------------------------------- |
| `chat`      | a conversation with a person of your app                                      |
| `write`     | short texts: a message, a description, an e-mail                              |
| `code`      | reading and writing code (Sypnia Agent uses it)                               |
| `summarize` | a long text or a set of facts into a few sentences                            |
| `extract`   | data out of text, as JSON that follows your schema                            |
| `classify`  | one label out of a list: «question», «complaint», «order»                     |
| `vision`    | reading images and documents                                                  |
| `embed`     | turning text into an [embedding](https://ai.docs.sypnia.com/using/embeddings) |

In Sypnia Cloud each built-in task has a **default model**, chosen and tested by Sypnia for that kind of work, for its quality, its speed and its price. When a better one appears the default changes, and the change is announced in your project's notices a week before. Write `pin: true` in a route to keep the model you have.

A self-hosted gateway has no default models: you choose every one.

## Your own tasks

Name a task after what it does in your app: `allergen-answer`, `bread-of-the-day`. A task of your own is a route like any other, and it makes usage easy to read: «`allergen-answer` spent this much» says more than «`chat` spent this much».

## Asking for a task

```json
{ "model": "task:allergen-answer", "messages": [ … ] }
```

You can also name a model directly (`"model": "openrouter/<model id>"`). It is still limited, priced and traced, but it skips the route's fallbacks and options. A project can refuse direct model names with `direct_models: false`.

## Every field of a route

Routes live in `sypnia.toml`, the one configuration file at the root of your repository that every Sypnia product shares: `direct_models` in the `[ai]` table, and one `[ai.tasks.<name>]` table per task. Sypnia AI reads only its own tables.

`sypnia.toml`

```toml
[ai]
direct_models = false

[ai.tasks.allergen-answer]
model = "default"
fallbacks = ["default"]          # Sypnia's second choice for the same kind of task
instructions = """
You answer questions about La Espiga's products using only the product data you are given.
If the data does not say, answer «I don't know, please ask at the counter».
"""
params = { temperature = 0.2, max_output_tokens = 250 }
tools = ["get_product"]
browser = true
limits = { end_user = { requests_per_day = 40 } }
safety = { moderation = "input", redact = ["email", "phone"] }
```

| Field          | What it does                                                                                                                                     |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `model`        | `default` (Cloud) or a catalog id: `openrouter/…`, `bedrock/…`, or `local/<name>` for a self-hosted endpoint                                     |
| `fallbacks`    | models that take over, in order, when the first fails or is too slow ([Fallbacks](https://ai.docs.sypnia.com/models/fallbacks-and-availability)) |
| `instructions` | text always placed first, as the system message. Callers can add their own after it, never replace it                                            |
| `params`       | `temperature`, `max_output_tokens`, `reasoning` (`low`, `medium`, `high` for models that think before answering)                                 |
| `output`       | a JSON schema file the answer must follow ([Structured answers](https://ai.docs.sypnia.com/using/tools-and-structured-output))                   |
| `tools`        | the tool names a caller may offer the model; others are refused                                                                                  |
| `browser`      | whether browsers may call this task with a [browser token](https://ai.docs.sypnia.com/using/from-the-browser)                                    |
| `limits`       | per minute and caps in credits, for the task and for each person ([Limits](https://ai.docs.sypnia.com/usage/limits))                             |
| `safety`       | `moderation` (`off`, `input`, `both`) and `redact` ([Content safety](https://ai.docs.sypnia.com/safety/content-safety))                          |
| `store`        | `days: 1` to `30` to keep what was asked and answered ([Data and retention](https://ai.docs.sypnia.com/safety/data-and-retention))               |
| `cache`        | `ttl` for repeated identical calls ([Caching](https://ai.docs.sypnia.com/usage/caching))                                                         |
| `pin`          | keep the current model when Sypnia changes a default                                                                                             |

## Changing routes

```bash
npx @sypnia/ai routes diff      # what would change
npx @sypnia/ai routes apply     # change it, after a confirmation
```

Applying needs a person with the **owner** or **admin** role. Every change becomes a new version of the project's routes, with who made it and when, and `ai routes rollback --to <version>` goes back. An agent can draft a change to the `[ai]` table of `sypnia.toml`; a person applies it.
