# Connectors
Source: https://docs.maelstrom-ai.co/dev/understanding/connectors/
Documentation revision: 89a8f5e9d10cedcf0b30376d7846113f06f26120
SDK manifests in this build: @maelstrom-co/react@0.2.1, @maelstrom-co/client@0.2.1, @maelstrom-co/connectors@0.2.1, @maelstrom-co/protocol@0.2.1, @maelstrom-co/engine@0.2.1
These docs follow this source revision. Manifest versions do not prove release compatibility; verify the installed package exports before using an API.

A Connector is the transport boundary between the Maelstrom client and the engine backend. It carries protocol messages, reports connection state, and keeps the UI from knowing whether the engine is reached through WebSocket, HTTP, or an in-memory test harness.

The connector should be boring. If it starts making layout decisions or hiding engine failures, it is doing work that belongs somewhere else.

## Where connectors fit

```mermaid
flowchart TD
  ReactApp["React app / client orchestrator"]
  Connector["Connector<br/>transport adapter"]
  Engine["Engine backend"]

  ReactApp --> Connector
  Connector --> Engine
```

The protocol defines the payload. The connector defines how that payload travels.

## Common connector shapes

| Connector shape | Fits when | Trade-off |
| --- | --- | --- |
| WebSocket | Interactive browser sessions | Requires connection lifecycle handling. |
| HTTP | Simple request/response deployments | Less natural for streaming or long-lived sessions. |
| In-memory | Tests, local harnesses, embedded demos | Not a browser deployment boundary. |

## What a connector should own

-   Opening and closing the transport session.
-   Sending user intent or chart request messages.
-   Receiving engine responses and errors.
-   Updating connection status so the UI can disable or retry actions.
-   Carrying Agent Session traffic: sending agent inputs and delivering agent events.

## What a connector should not own

-   Choosing which Vessels appear.
-   Changing an Instance’s Variant outside declared Actions.
-   Converting provider-specific errors into user-facing policy by itself.

Those responsibilities belong to the engine or application action handlers.

## Next steps

-   [Connectors](https://docs.maelstrom-ai.co/dev/guides/client/custom-connectors/) — implement a transport adapter
-   [The Protocol](https://docs.maelstrom-ai.co/dev/understanding/protocol/) — understand the payload the connector carries
