# `PromptRunner.Rendering.Renderer`
[🔗](https://github.com/nshkrdotcom/prompt_runner_sdk/blob/v0.12.1/lib/prompt_runner/rendering/renderer.ex#L1)

Behaviour for rendering prompt-runner canonical event maps into human-readable output.

# `opts`

```elixir
@type opts() :: keyword()
```

# `state`

```elixir
@type state() :: term()
```

# `finish`

```elixir
@callback finish(state()) :: {:ok, iodata(), state()}
```

# `init`

```elixir
@callback init(opts()) :: {:ok, state()} | {:error, term()}
```

# `render_event`

```elixir
@callback render_event(event :: map(), state()) :: {:ok, iodata(), state()}
```

# `set_view`
*optional* 

```elixir
@callback set_view(view :: map(), state()) :: {:ok, state()}
```

Applies live view settings to a renderer's state, mid-stream.

Called at an event boundary when a control-plane consumer changes
`tool_output` or `diff`. A renderer that carries neither can leave this
unimplemented; `PromptRunner.Rendering` treats its absence as "this renderer
has nothing to change" rather than as an error, so a view change is never
fatal to a run.

---

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