# `MingaAgent.RuntimeState`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_agent/runtime_state.ex#L1)

Domain-only agent session state, independent of any UI.

Tracks the active session identity, lifecycle status, and
model/provider info. This struct lives in Layer 1 and can be
consumed by both the Editor (Layer 2) and headless runtime
clients without pulling in presentation concerns.

Presentation state (spinner timers, buffer PIDs, session history)
lives in `MingaEditor.State.Agent`, which composes this struct.

# `status`

```elixir
@type status() :: :idle | :thinking | :tool_executing | :error | nil
```

Agent lifecycle status.

# `t`

```elixir
@type t() :: %MingaAgent.RuntimeState{
  active_session_id: String.t() | nil,
  model_name: String.t() | nil,
  provider_name: String.t() | nil,
  status: status()
}
```

Domain-only agent runtime state.

# `busy?`

```elixir
@spec busy?(t()) :: boolean()
```

Returns true if the agent is actively working.

# `set_model`

```elixir
@spec set_model(t(), String.t() | nil) :: t()
```

Sets the model name.

# `set_provider`

```elixir
@spec set_provider(t(), String.t() | nil) :: t()
```

Sets the provider name.

# `set_session_id`

```elixir
@spec set_session_id(t(), String.t() | nil) :: t()
```

Sets the active session ID.

# `set_status`

```elixir
@spec set_status(t(), status()) :: t()
```

Sets the agent lifecycle status.

---

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