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§
- File
History Provider - A
HistoryProviderthat persists to a JSON file on disk, loading any existing history frompathon construction and rewriting the whole file after every successful run. - InMemory
History Provider - In-memory
HistoryProvider: keeps history in anArc<Mutex<Vec<Message>>>, shared across clones.
Enums§
- Stored
History - What a provider’s stored history is, which decides which occurrence of it inside a replayed transcript is the one it actually holds.
Traits§
- History
Provider - A
ContextProviderthat also manages conversation history.
Functions§
- ensure_
history_ provider - Attach a fresh
InMemoryHistoryProvideras the first context provider onsessionwhen 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 viaContextProvider::is_history_provider). - filter_
new_ messages - Return the suffix of
incomingthat is not already present inexisting, so replaying a conversation does not store — or resend — it twice. - filter_
new_ messages_ from filter_new_messageswith an explicitStoredHistoryshape.- inject_
stored_ history - Inject
storedahead of any context another provider has already added — unless the run’s own input already carries that stored run, which is exactly what a caller replaying its own transcript sends. - inject_
stored_ history_ from inject_stored_historyfor a provider whose stored history has a knownStoredHistoryshape — a retention-limited store holds aStoredHistory::Window.- new_
run_ messages - What a run adds to
existing: the part of its input that is not a replay of already-stored history (seefilter_new_messages), followed by every response message. - new_
run_ messages_ from new_run_messagesfor a provider whose stored history has a knownStoredHistoryshape — a retention-limited store holds aStoredHistory::Window.