Alloy.Session (alloy v0.10.1)

Copy Markdown View Source

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.

Summary

Functions

Creates a new session with a generated ID.

Updates a session with results from an agent run.

Types

t()

@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()
}

Functions

new(opts \\ [])

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

Creates a new session with a generated ID.

update_from_result(session, result)

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

Updates a session with results from an agent run.