# `Planck.Agent.StreamBuffer`
[🔗](https://github.com/alexdesousa/planck/blob/v0.2.2/lib/planck/agent/stream_buffer.ex#L1)

Accumulates the output of a single LLM stream turn.

Text deltas, thinking deltas, and tool call completions are appended as the
stream arrives. At stream end the buffer is consumed to build the assistant
message and hand off tool calls for execution.

# `t`

```elixir
@type t() :: %Planck.Agent.StreamBuffer{
  calls: [map()],
  text: String.t(),
  thinking: String.t()
}
```

- `:text` — accumulated text content from `:text_delta` events
- `:thinking` — accumulated thinking content from `:thinking_delta` events
- `:calls` — completed tool calls from `:tool_call_complete` events, in order

# `add_call`

```elixir
@spec add_call(t(), map()) :: t()
```

Add a completed tool call.

# `append_text`

```elixir
@spec append_text(t(), String.t()) :: t()
```

Append a text delta.

# `append_thinking`

```elixir
@spec append_thinking(t(), String.t()) :: t()
```

Append a thinking delta.

# `new`

```elixir
@spec new() :: t()
```

Return an empty buffer.

---

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