Restart without losing the conversation: LangChain Rust 6 adds database memory
The community Rust library adds SQLite and Postgres chat history, token-budgeted memory and a shared tool-call type across four providers, with breaking API changes for existing applications.
LangChain Rust 6 gives a restarted application a way to pick up its stored conversation, while simplifying how agents read tool calls from different model providers. The community library’s October 22 release adds SQLite and Postgres chat histories and makes its memory interface asynchronous. That is useful infrastructure for an agent that should remember earlier messages after its process exits.
The project is a Rust library for building model-powered applications, chains and agents. It is not a new model, hosted agent service or plugin for an existing coding harness. Applications embed it through Cargo and supply their own model runtime and storage configuration.
A database history, not automatic task recovery
The new SqliteMessageHistory and PostgresMessageHistory store messages as JSON rows keyed by a session identifier. The versioned source describes retaining tool calls, tool-call IDs and image fields along with messages. Tables are created on first use unless the application opts out with without_migration() and manages the schema itself.
The shipped SQLite example opens chat_history.db, selects a conversation ID and attaches its history to a conversational chain. Its instructions invite developers to run the example twice so the second run can read the first run’s messages:
cargo run --example persistent_memory --features sqlite-vec
That command runs from the project checkout. For an application dependency, the README documents adding serde_json and langchain-rust, with optional features for the chosen backend. The release says either SQL history implementation is available through features that enable sqlx, including postgres, sqlite-vec and sqlite-vss.
Persisting a transcript does not establish automatic recovery of an interrupted external action. The example demonstrates conversation storage, rather than a durable workflow engine. Database access, connection settings and session selection remain application responsibilities; a session ID is not a user authorization system.
The separate TokenBufferMemory keeps recent messages within a token budget by dropping older messages, including orphaned tool results at the front. It is an in-process alternative, not another persistent backend. The source notes that its default token counting is approximate for non-OpenAI models and allows a custom counter.
One tool-call shape across providers
The release adds GenerateResult.tool_calls: Vec<ToolCall>, with id, name and arguments fields shared across OpenAI, Claude, Ollama and Bedrock integrations. The maintainer says OpenAiToolAgent now consumes that common representation, letting the same agent work with all four instead of requiring provider-specific response parsing.
That standardizes an interface; it does not make model behavior, tool reliability or access credentials identical. The argument field remains a raw JSON string produced by the model, whose interpretation belongs to the tool. Applications still configure their provider or local inference runtime and retain responsibility for tool permissions and any service costs.
Existing applications need migration work
This is a major version because two public APIs change. BaseMemory methods now require await and return Result values with MemoryError. Custom memory implementations must update their signatures and add #[async_trait]. Code constructing GenerateResult directly needs to account for the new field; the release suggests ..Default::default(). Existing parsing of tool-call JSON in generation remains supported.
The update also adds a Wikipedia query tool and fixes a tools-agent loop triggered when a model returns a bare []. The library is MIT licensed. The release reports in-memory SQLite CI coverage, while Postgres tests are ignored by default and need a database; Redis and Mongo memory backends are not included. AITrending reviewed the release and versioned sources without compiling the library or reproducing its runtime behavior.