# Enqueue

> Tag 2: the client sends a message to the agent, which starts a loop when none runs and joins the queue when one does; the server answers with exactly one channel response, the fate of the message, when the fate is known.

Canonical: https://protocol.diverge.network/2.3.0/container-proxy-endpoints/agents-begin/client/enqueue/
Specification revision: 2.3.0

The client opens this channel to send a message to the agent. A
message sent while no loop runs starts one, as its input; a message
sent while one runs is placed in its queue, and the agent takes it at
a seam of its own choosing. Nothing interrupts a loop. What the agent
says in reply is the main stream of the scope, as
[Response](/2.3.0/container-proxy-endpoints/agents-begin/response/) states.

- **The request.** The tag byte `2` followed by the message as JSON.
  [Request](/2.3.0/container-proxy-endpoints/agents-begin/client/enqueue/request/) states its form.
- **The response.** Exactly one channel response, sent when the fate
  of the message is known, however long that takes, and the channel
  response finish. [Response](/2.3.0/container-proxy-endpoints/agents-begin/client/enqueue/response/) states the
  sequence.
- **Order.** Messages are taken in the order the client sent them.
- **A loop ending.** A loop that ends with a message still waiting
  does not lose it: the server starts the next loop on every message
  still waiting, their content concatenated into one, in the order
  sent. A container that refuses that content refuses every message
  of it.
- **No timeout.** The server holds the channel open until the fate is
  known.
