# `Codex.Transport`
[🔗](https://github.com/nshkrdotcom/codex_sdk/blob/v0.18.1/lib/codex/transport.ex#L1)

Behaviour for Codex transport implementations.

Transports handle the communication protocol between the SDK and the Codex runtime.

# `event_stream`

```elixir
@type event_stream() :: Enumerable.t()
```

# `input`

```elixir
@type input() :: String.t()
```

# `thread`

```elixir
@type thread() :: Codex.Thread.t()
```

# `turn_opts`

```elixir
@type turn_opts() :: map() | keyword()
```

# `turn_result`

```elixir
@type turn_result() :: Codex.Turn.Result.t()
```

# `interrupt`
*optional* 

```elixir
@callback interrupt(thread(), turn_id :: String.t()) :: :ok | {:error, term()}
```

Interrupts a running turn.

Optional for transports that don't support it.

# `run_turn`

```elixir
@callback run_turn(thread(), input(), turn_opts()) ::
  {:ok, turn_result()} | {:error, term()}
```

Executes a single turn and returns the accumulated result.

# `run_turn_streamed`

```elixir
@callback run_turn_streamed(thread(), input(), turn_opts()) ::
  {:ok, event_stream()} | {:error, term()}
```

Executes a turn and returns a stream of events.

---

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