# `ADK.Session.Recovery`
[🔗](https://github.com/zeroasterisk/adk-elixir/blob/main/lib/adk/session/recovery.ex#L1)

Recovers active sessions after application restart.

On application boot, scans the configured session store for sessions that
were active (not completed/failed) and restarts their GenServer processes
under the SessionSupervisor.

## Usage

    # In your Application.start/2, after starting the supervisor:
    ADK.Session.Recovery.recover(store: {ADK.Session.Store.JsonFile, [base_path: "sessions/"]})

    # Or with options:
    ADK.Session.Recovery.recover(
      store: {ADK.Session.Store.JsonFile, [base_path: "sessions/"]},
      auto_save: true,
      filter: fn session -> session.app_name == "my_app" end
    )

Beyond Python ADK: This module has no equivalent in the Python ADK.

# `recover`

```elixir
@spec recover(keyword()) :: {:ok, non_neg_integer()} | {:error, term()}
```

Scan the session store and restart active sessions.

Options:
  - `:store` — `{module, opts}` tuple for the session store (required)
  - `:auto_save` — whether recovered sessions auto-save on terminate (default: true)
  - `:filter` — optional function to filter which sessions to recover
  - `:timeout` — max time to wait for all recoveries (default: 30_000ms)

Returns `{:ok, recovered_count}` or `{:error, reason}`.

---

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