# Send an agent on a mission

> A quest step that sends one of the player's agents away with written instructions; its answer proves the step.

You write a step where the player picks an agent, reads its instructions and sends it. The agent leaves across the map, then comes back with its answer. That answer is the proof: the step is done when the agent returns, not when the player clicks.

**Before you begin (15 minutes)**

- The `alta` command (see [Install the CLI](https://docs.altasystem.ai/start/install)).
- The [quickstart](https://docs.altasystem.ai/quickstart), to know what a quest and a step are.

### Create the quest

`alta new mission` writes a quest with a mission step that already passes `alta lint`.

```sh [Terminal]
alta new mission my-mission
```

```text [Output]
created my-mission/mission.json (mission, id my-mission)
next: edit the texts, then `alta lint my-mission`, then `alta dev my-mission`
```

### Write the instructions

A step of kind `mission` carries `mission.brief`, the instructions in each language. `agent` is who goes: `daemon`, `architect`, `operator`, `reviewer` or `guardian` (by default, the agent who gives the quest). `target` is the thing of the map the agent walks to. With `editable` (true by default), the player can rewrite the instructions before sending them.

```json [my-mission/mission.json]
{
  "id": "errand",
  "kind": "mission",
  "title": {
    "en": "Ask for today's three most important mails",
    "fr": "Demande les trois mails les plus importants du jour"
  },
  "mission": {
    "agent": "operator",
    "brief": {
      "en": "Read today's mail and tell me the three that matter most, one line each.",
      "fr": "Lis le courrier du jour et dis-moi les trois qui comptent le plus, une ligne chacun."
    },
    "editable": true,
    "target": "module:google"
  }
}
```

### Ask for a second opinion

A quest can send several agents. This optional step sends the reviewer with instructions the player cannot change (`"editable": false`).

```json [my-mission/mission.json]
{
  "id": "second-opinion",
  "kind": "mission",
  "optional": true,
  "title": {
    "en": "Ask the reviewer to double-check",
    "fr": "Demande au vérificateur de revérifier"
  },
  "mission": {
    "agent": "reviewer",
    "brief": {
      "en": "Check the operator's list of important mails: did it miss anything?",
      "fr": "Vérifie la liste de mails importants de l'opérateur : a-t-il oublié quelque chose ?"
    },
    "editable": false
  }
}
```

### Know what leaves, and what proves it

When the player sends the agent, the page asks the player's own machine to pass the text to that agent. The text goes on the program's standard input, never in a command line; it holds 4,000 characters at most. The answer is cut at 8,000 characters, and a mission with no answer after ten minutes fails: the player can send it again. A mission step counts as proven by the machine, so it can close a daily or a repeatable quest.

```json [What the page sends]
{
  "agent": "operator",
  "text": "Read today's mail and tell me the three that matter most, one line each.",
  "quest": "core.first-errand",
  "step": "errand",
  "target": "module:google"
}
```

### Check it

`alta lint` refuses a mission step without instructions, a `mission` field on another kind of step, and an unknown agent.

```sh [Terminal]
alta lint my-mission
```

```text [Output]
ok   my-mission/mission.json (quests)
1 checked, 0 errors, 0 warnings
```

**Try it:**

```sh
alta dev my-mission
```

Open the address it prints, then your quest in the journal: the mission step shows the agent and its instructions. In the demo, nothing runs on your machine.

## Pitfalls

| Do | Avoid |
|---|---|
| One clear request, with the shape of the answer ("one line each") | Instructions that ask for a secret or a password |
| `editable` left on when the player knows best | Locked instructions the player cannot read before sending |
| A `target` that is a thing of the map (`module:google`) | A free text as target: the agent has nowhere to walk |
| A mission on macOS and Linux | Declaring Windows for a quest with a mission: it does not run there |

Known limits, said plainly: only the five agents of the game take missions; an agent bought in the store does not yet. The check does not yet refuse a target that is not a thing of the map, nor a quest with a mission that declares Windows: read them again.

## Go further

- [Mission](https://docs.altasystem.ai/reference/standards/mission): every field of a mission step.
- [Quests and proof](https://docs.altasystem.ai/concepts/quests-and-proof): why the answer, not the click, proves the step.
- [Errors](https://docs.altasystem.ai/reference/errors#standard-mission): each rule of `alta lint` for missions.

**Next:**

- [A paid business agent, end to end](https://docs.altasystem.ai/charts/guides/business-agent)
- [Make a step that does it](https://docs.altasystem.ai/guides/quests/do-it-step)
- [Mission](https://docs.altasystem.ai/reference/standards/mission)
