Skip to main content

Module history

Module history 

Source
Expand description

Conversation-history context providers.

Upstream moved conversation history out of the thread/session entirely: it is now just another ContextProvider — a HistoryProvider — that prepends its stored messages ahead of a run (before_run) and records the run’s request + response messages after a successful run (after_run). InMemoryHistoryProvider is the in-process default; FileHistoryProvider persists to a JSON file on disk.

Agent and WorkflowAgent auto-attach a fresh InMemoryHistoryProvider (via ensure_history_provider) to any non-service-managed AgentSession that doesn’t already carry a history provider, so local multi-turn conversations keep accumulating history the way the old AgentThread message store used to.

Structs§

FileHistoryProvider
A HistoryProvider that persists to a JSON file on disk, loading any existing history from path on construction and rewriting the whole file after every successful run.
InMemoryHistoryProvider
In-memory HistoryProvider: keeps history in an Arc<Mutex<Vec<Message>>>, shared across clones.

Traits§

HistoryProvider
A ContextProvider that also manages conversation history.

Functions§

ensure_history_provider
Attach a fresh InMemoryHistoryProvider as the first context provider on session when it is not service-managed and does not already carry a history provider. A no-op for service-managed sessions (the service owns history server-side) and for sessions that already have one attached (detected via ContextProvider::is_history_provider).