deepagents icon indicating copy to clipboard operation
deepagents copied to clipboard

Some models have a max_token that does not reach 170,000. Is it possible to enable the setting for max_tokens_before_summary?

Open lzcangel opened this issue 1 month ago • 2 comments

Some models have a max_token that does not reach 170,000. Is it possible to enable the setting for max_tokens_before_summary?

Image

lzcangel avatar Nov 21 '25 15:11 lzcangel

I created a class CustomSummarizationMiddleware(SummarizationMiddleware): """Custom summarization middleware with 4000 token threshold.""" pass

then used in create_deep_agent CustomSummarizationMiddleware( model=GPT_OSS_OLLAMA, max_tokens_before_summary=4000, ), ],

hope it helps

julienlesbegueriesperso avatar Nov 21 '25 20:11 julienlesbegueriesperso

We'll start configuring this off the context window of the model soon (which will be available with langchain 1.1 via model profiles)

eyurtsev avatar Nov 24 '25 04:11 eyurtsev