I believe a simple tool with a proper description could change a variable in state, say isFinal=False to isFinal=True, and that could suffice. I'll try it shortly.
Answer from stkcn tr on Stack OverflowHow to cleanly stop the workflow of the react agent from the tool?
Pause/Terminate Streaming Messages (LangGraph)
STOP - User prompts
[HELP] How can I stop a run in LangSmith? (or retrieve its run id?)
Videos
In ChatGPT one can press the stop button while the interface is streaming a response, to halt the remaining responses, and the incomplete response is stored in history.
I have no idea if the LLM itself is actually halted, or if it just stops accepting new messages from the backend.
Is there a way to do this canceling in the graph?
I use the graphs astream_events and yield responses to the front-end via FastAPI's StreamingResponse. I imagine that to halt streaming, I can listen for a flag in the endpoint method, and instead of yield, I could just break or return, which would stop sending responses.
However, the LLM will still be being executed. Is it possible halt execution as well? Even more, rather than stop the graph altogether, is it possible to just stop that LLM node? That way, it could proceed to the other nodes I have that work on saving conversation messages, etc.
I'm currently working on a complex workflow in LangGraph and using LangSmith for tracing.
At a certain point in the workflow, we need to stop execution to prevent it from continuing. However, the trace (run) in LangGraph remains active for a while and eventually shows as (-). This is the problem: we want to stop the trace immediately or mark it as 'closed' or something similar.
Our initial approach was to update a tag with the run_id, but now we can't retrieve this run_id.
Any suggestions or advice on how to solve this?