Hi, I’m building a Python LangGraph backend, where we have custom tools that can be called to create a ToolMessage which “commands” the UI to perform actions.
Currently, the idea is that we’d put the UI action command in a ToolMessage.artifact field. The UI would read the ToolMessage.artifact in the message history and perform the action. However, I want to prevent the action from being run again, so I need a way to update the response_metadata
field of the ToolMessage; to let the UI know now to perform the action the 2nd time around when the messages reloaded again.
However, I can’t seem to figure out how to change the messages in a checkpoint using AsyncPostgresSaver or PostgresSaver. I know to use the get/aget to get the checkpoint from a thread. But I can’t figure out how to save a new checkpoint with the updated Message.
Finally, we have multiple agents running, so I’m trying to manipulate the Checkpoints without recreating the graph.
Any help in the right direction would be much appreciated. Code, document, technique. Am I thinking about this in the wrong way?
Thanks in advance!