# `Mead.Session.TurnHandler`
[🔗](https://github.com/albertosca/mead/blob/main/lib/mead/session/turn_handler.ex#L1)

Behaviour for the code that produces the output of a turn.

A handler receives the turns recorded before the current one, the input of the current turn,
and the options for the turn: the ones given to `Mead.submit_turn/3` (for example
`route: :cloud`) plus `session_id`, which the server adds and a caller can never set. It runs
in an isolated task, so raising, exiting, or running too long never takes the session down.

# `handle_turn`

```elixir
@callback handle_turn(
  history :: [Mead.Session.Turn.t()],
  input :: term(),
  options :: keyword()
) ::
  {:ok, output :: term()} | {:error, reason :: term()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
