def delete_messages(state):
        """To prevent message history from overflowing, regularly clear message history after a stage of the pipeline is done"""
        messages = state["messages"]
        return {"messages": [RemoveMessage(id=m.id) for m in messages]}
To prevent message history from overflowing, regularly clear message history after a stage of the pipeline is done
tradingagents/agents/utils/agent_utils.py