I am trying to override the Langgraph's state["messages"] before it reaches the agent, but not sure if I am doing it right. I need to remove some messages from state before sending it to agent, for that I am using langgraph's @before_agent hook and created a middleware. Code class FileProcessor(AgentMiddleware): def _process_files(self, state, runtime): """Extract file data from messages and remove file items from content.""" messages =...
Originally asked by Triko on Stack Exchange (stackoverflow) (CC BY-SA 4.0).