# Agent

> Five paths the server opens on an agent container: the agent registered, a loop run, the agent’s schema obtained, a message enqueued, and the queue emptied.

Canonical: https://provider.diverge.network/2.3.0/proxy/agent/
Specification revision: 2.3.0

Five paths carry the exchanges of the server with the loop of an
agent container. The server opens each path; the proxy answers.

| Path | The server sends | The proxy sends |
|------|------------------|-----------------|
| [`/agent/register`](/2.3.0/proxy/agent/register/) | the agent, once | exactly one answer: registered, or an error |
| [`/agent/run`](/2.3.0/proxy/agent/run/) | a prompt | the chunks of the loop, or an error |
| [`/agent/schema`](/2.3.0/proxy/agent/schema/) | nothing | exactly one answer: the JSON Schema of the agent, or an error |
| [`/agent/enqueue`](/2.3.0/proxy/agent/enqueue/) | a message for the queue | exactly one answer: its fate, sent when the fate is known |
| [`/agent/dequeue`](/2.3.0/proxy/agent/dequeue/) | nothing | exactly one answer: whether the queue held anything |

- **The first binary message is the ask**, on every path that has
  one, as JSON read as [Notation](/2.3.0/endpoints/#notation) provides. A
  close before it causes the proxy to close the connection with no
  message before the close.
- **On an agent container only.** The server opens these paths only
  on a container whose entrypoint is an agent.
- **No repetition.** An exchange whose path ended abruptly has
  failed: a loop cut short, a fate not heard, a registration not
  answered. No party retries it.
