# `Jido.Messaging.InstanceSupervisor`
[🔗](https://github.com/agentjido/jido_messaging/blob/v1.0.0/lib/jido_messaging/instance_supervisor.ex#L1)

Dynamic supervisor for channel instances.

Manages the lifecycle of channel instances (e.g., Telegram bots, Discord connections).
Each instance is its own supervisor tree containing:
- InstanceServer (lifecycle state machine)
- Channel-specific processes (Poller, Sender, etc.)

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `count_instances`

```elixir
@spec count_instances(module()) :: non_neg_integer()
```

Count running instances.

# `instance_status`

```elixir
@spec instance_status(module(), String.t()) :: {:ok, map()} | {:error, :not_found}
```

Get the status of an instance.

# `list_instance_health`

```elixir
@spec list_instance_health(module()) :: [map()]
```

Get health snapshots for all running instances.

Returns a list of health snapshot maps for each instance.

# `list_instances`

```elixir
@spec list_instances(module()) :: [map()]
```

List all running instances.

# `start_instance`

```elixir
@spec start_instance(module(), atom(), map()) ::
  {:ok, Jido.Messaging.Instance.t()} | {:error, term()}
```

Start a new instance.

Returns `{:ok, instance}` with the created Instance struct, or `{:error, reason}`.

# `start_instance_tree`

Start the instance supervision tree (called by DynamicSupervisor).

# `start_link`

# `stop_instance`

```elixir
@spec stop_instance(module(), String.t()) :: :ok | {:error, :not_found}
```

Stop an instance by ID.

---

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