# `Alloy.Session`
[🔗](https://github.com/alloy-ex/alloy/blob/v0.10.1/lib/alloy/session.ex#L1)

Serializable session container.

Wraps the conversation state in a format that can be serialized
to JSON, stored in a database, or passed between processes.
No database required — sessions are plain structs.

# `t`

```elixir
@type t() :: %Alloy.Session{
  created_at: DateTime.t(),
  id: String.t(),
  messages: [Alloy.Message.t()],
  metadata: map(),
  updated_at: DateTime.t(),
  usage: Alloy.Usage.t()
}
```

# `new`

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

Creates a new session with a generated ID.

# `update_from_result`

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

Updates a session with results from an agent run.

---

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