# `Jido.AI.Request.Stream`
[🔗](https://github.com/agentjido/jido_ai/blob/v2.4.0/lib/jido_ai/request/stream.ex#L1)

Request-scoped runtime event streaming helpers.

The stream transport is intentionally narrow: callers can provide a pid sink
and receive canonical runtime events for one request.

# `sink`

```elixir
@type sink() :: {:pid, pid()}
```

# `cancelled_event`

```elixir
@spec cancelled_event(String.t(), term(), keyword()) :: Jido.AI.Runtime.Event.t()
```

Creates a synthetic terminal cancellation event.

# `events`

```elixir
@spec events(Jido.AI.Request.Handle.t(), keyword()) :: Enumerable.t()
```

Builds an enumerable over runtime events for a request handle.

The enumerable halts after receiving `:request_completed`,
`:request_failed`, or `:request_cancelled`.

ReAct worker events retain runtime order. The final runtime checkpoint is
delivered before the terminal event, while the request sink is still active.
Synthetic rejection and caller cancellation events use `seq: 0` and can stop
a request before its worker finishes.

# `failed_event`

```elixir
@spec failed_event(String.t(), term(), keyword()) :: Jido.AI.Runtime.Event.t()
```

Creates a synthetic terminal failure event for non-worker rejection paths.

# `message_tag`

```elixir
@spec message_tag() :: atom()
```

Returns the mailbox tag used for request stream messages.

# `normalize_sink`

```elixir
@spec normalize_sink(term()) :: {:ok, sink() | nil} | {:error, term()}
```

Normalizes public stream sink options.

# `send_event`

```elixir
@spec send_event(sink() | nil, Jido.AI.Runtime.Event.t() | map()) :: :ok
```

Sends one runtime event to a normalized stream sink.

# `terminal_kind?`

```elixir
@spec terminal_kind?(atom()) :: boolean()
```

Returns true when the event kind terminates a request stream.

---

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