Jido.Thread
(Jido v2.0.0-rc.4)
View Source
An append-only log of interaction entries.
Thread is the canonical record of "what happened" in a conversation or workflow. It is provider-agnostic and never modified destructively.
LLM context is derived from Thread via projection functions, not stored directly in Thread.
Example
thread = Thread.new(metadata: %{user_id: "u1"})
thread = Thread.append(thread, %{
kind: :message,
payload: %{role: "user", content: "Hello"}
})
Thread.entry_count(thread) # => 1
Thread.last(thread).kind # => :message
Summary
Functions
Append entries to thread (returns new thread)
Get entry count
Filter entries by kind
Get entry by seq
Get last entry
Create a new empty thread
Get entries in seq range (inclusive)
Get all entries as list
Types
Functions
@spec append(t(), Jido.Thread.Entry.t() | map() | [Jido.Thread.Entry.t() | map()]) :: t()
Append entries to thread (returns new thread)
@spec entry_count(t()) :: non_neg_integer()
Get entry count
@spec filter_by_kind(t(), atom() | [atom()]) :: [Jido.Thread.Entry.t()]
Filter entries by kind
@spec get_entry(t(), non_neg_integer()) :: Jido.Thread.Entry.t() | nil
Get entry by seq
@spec last(t()) :: Jido.Thread.Entry.t() | nil
Get last entry
Create a new empty thread
@spec slice(t(), non_neg_integer(), non_neg_integer()) :: [Jido.Thread.Entry.t()]
Get entries in seq range (inclusive)
@spec to_list(t()) :: [Jido.Thread.Entry.t()]
Get all entries as list