惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Last Week in AI
Last Week in AI
H
Help Net Security
博客园 - 叶小钗
V
Visual Studio Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
腾讯CDC
MongoDB | Blog
MongoDB | Blog
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
GbyAI
GbyAI
Microsoft Security Blog
Microsoft Security Blog
A
About on SuperTechFans
博客园 - 司徒正美
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
月光博客
月光博客
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
Vercel News
Vercel News

LangChain Forum - Latest topics

Seeking help regarding the connection between Websocket and tool calls Tool invocation error with empty error message when using `InjectedState` + `Command` return in async tool How to use @langchain/react FileSystem middleware Using ChatSnowflake with agents Built llmsessioncontract on AgentMiddleware: runtime enforcement of tool-call protocols — feedback wanted DeltaChannelHistory not found in langgraph-api:3.12 Improving citation accuracy and reducing hallucinations in custom Parent-Child RAG pipeline (Gemma3:4B + FAISS+BM25 + Cross-encoder reranker) Built a live autonomous AI agent network using LangGraph-style economics — looking for feedback How are you validating LangChain agent output before it executes shell commands? Cross-site pattern pool for production agent failures — looking for 5 pilot teams (open spec, CC-BY-4.0) Metadata filter not filtering for alerts Using custom MCP servers with assistants How to use tool calling using ChatLlamaCpp and Gemma 4 E4B with create_agent? CLI - No Longer Sending traces to Langsmith Connecting the Slack integration fails with invalid_team_for_non_distributed_app The Docs says open router can be used with init_chat_model but throws an error Interested to contribute to langgraph postgre checkpointer for multiple adapter support Modal Inference Trouble understanding and editing experiment summary evaluators feedbacks SSL certificate error from httpx with LangGraph server [Feature Request] Wire allowed_msgpack_modules in langgraph.json Serving an agent with the LangGraph CLI dev command Proposal: implement delete_for_runs for SQLite checkpoint savers WikipediaLoader endup in JSONDecodeError Human-in-the-loop approval dashboard for LangGraph agents — open source, free to deploy Ombre — open source security and audit layer for LangChain apps Should interrupt() be split into two primitives — one for human input, one for s2s data fetching? Unable to delete runs from annotation queue First Bedrock call after idle is slow on TTFT (follow-ups in the same trace are fast)
How do ContextEditingMiddleware and SummarizationMiddlewa...
rushant001 · 2026-04-20 · via LangChain Forum - Latest topics
Hi everyone, I’m using ContextEditingMiddleware and SummarizationMiddleware together in create_agent , and I’d like to understand the exact execution semantics when they’re combined. The docs describe each one individually but don’t explain how they interact. My code: agent_executor = create_agent( model=self.llm_service.llm, tools=self.tools, system_prompt=system_prompt, middleware=[ # Layer 1: clean up old tool results (lightweight, no LLM call) ContextEditingMiddleware( edits=[ ClearToolUsesEdit( trigger=self.clear_trigger, keep=self.clear_tool_keep, ), ], ), # Layer 2: summarization (heavier, uses a cheap LLM) SummarizationMiddleware( model=LLMService(model_name=self.summary_model_name).llm, trigger=self.summary_trigger, keep=self.summary_keep, trim_tokens_to_summarize=self.summary_trim_tokens, ), ], ) Questions I’d love help with: Execution order — Which one runs first? Does the order in the middleware=[] list matter, or is it determined by hook type ( before_model vs wrap_model_call )? Data flow — Does one middleware’s output feed into the other? Does the cleanup affect what the summary LLM sees? Does the summary output become the input that cleanup operates on? Both triggered at once — If the conversation exceeds both thresholds in the same call: Do both run? Which result reaches the main LLM? Are the effects combined, or does one override the other? State vs request — I noticed SummarizationMiddleware uses before_model and ContextEditingMiddleware uses wrap_model_call . Does that mean summarization persistently modifies state["messages"] while context editing only modifies the per-call request? What are the multi-turn implications? Recommended pattern — Is the “cheap cleanup first, summarization as fallback” pattern (often suggested in community tutorials) actually supported by this combination, or does it require custom middleware? A concrete walkthrough showing the message list before and after each middleware runs — especially for the “both triggered” case — would be really helpful. Using langchain 1.2.15 . Thanks! 1 post - 1 participant Read full topic