Middleware that clears the contents of stale tool results.
Distinct from summarisation: instead of dropping or condensing rounds, it
keeps the full message skeleton (every tool call and reply stays in place)
but blanks the body of large, older %Message.Tool{} results — the
outputs the model has already reasoned over and no longer needs verbatim.
The rewrite persists via LangEx.Message.remove_all/0, and is idempotent:
once a result is replaced by the short placeholder it falls under the
threshold and is left alone.
No LLM call — cheap, deterministic context recovery. Composes with
LangEx.Middleware.Summarization; typically you reach for one or the
other.
Options
:keep_last- most recent tool results left untouched (default3):clear_at_chars- only results larger than this are cleared (default4_000):placeholder- replacement content for cleared results
Summary
Functions
Builds a context-editing middleware. See the module doc for options.
Functions
@spec new(keyword()) :: LangEx.Middleware.t()
Builds a context-editing middleware. See the module doc for options.