# `ClaudeAgentSDK.Transport.StreamingRouter`
[🔗](https://github.com/nshkrdotcom/claude_agent_sdk/blob/v0.21.0/lib/claude_agent_sdk/transport/streaming_router.ex#L1)

Selects streaming transport based on required features.

## Decision Algorithm

1. Check explicit override (`preferred_transport`)
2. Detect control protocol requirements
3. Default to CLI-only for performance

## Examples

    # Simple streaming → CLI-only
    iex> select_transport(%Options{})
    :streaming_session

    # With hooks → Control client
    iex> select_transport(%Options{hooks: %{pre_tool_use: [...]}})
    :control_client

    # Override
    iex> select_transport(%Options{preferred_transport: :cli})
    :streaming_session

# `transport_choice`

```elixir
@type transport_choice() :: :streaming_session | :control_client
```

# `explain`

```elixir
@spec explain(ClaudeAgentSDK.Options.t()) :: String.t()
```

Human-readable explanation of transport choice.

## Examples

    iex> StreamingRouter.explain(%Options{hooks: %{...}})
    """
    Transport: control_client
    Reason: hooks detected
    Features: [:hooks]
    Override: none
    """

# `requires_control_protocol?`

```elixir
@spec requires_control_protocol?(ClaudeAgentSDK.Options.t()) :: boolean()
```

Checks if options require control protocol.

Useful for debugging transport selection.

# `select_transport`

```elixir
@spec select_transport(ClaudeAgentSDK.Options.t()) :: transport_choice()
```

Selects transport implementation.

Returns `:streaming_session` (CLI-only) or `:control_client` (full features).

## Performance

This is a pure function with no I/O. Typical execution: <0.1ms.

---

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