Persist State Variables through Chain of Runnables (LCEL) #20532
juandiegobalbi
announced in
Ideas
Replies: 1 comment
-
I was looking for the same feature, but then discovered StateGraph. Have you checked this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked
Feature request
I'd like to propose a new feature that would allow the user to store each Runnable's output in a state object, that can later be accessed on any of the following steps in the chain, adding this sort of 'state-machine' behavior to the chain,
similar to how LangGraph works, but on LCEL Runnables.
Motivation
Having worked with plenty of real-world use cases, I have come to realize that most of the time,
the solution you need is neither a complex cyclic graph nor a simple linear chain, but rather a complex, well-structured LCEL chain on Runnables.
That being said, after starting to nest chains within chains, I find that having to wrap step outputs on RunnablePassthroughs to store them and be able to
access them in the next steps is a bit cumbersome and even kind of annoying.
On the other hand, adding more and more keys to the chain's state with RunnablePassthroughs also makes debugging and tracing in LangSmith a bit more difficult,
since each step's output will carry the state object with all the added keys, making it harder to track the actual output of each step.
Motivated on LangGraph, I would like to propose a new feature that would allow the user to store each Runnable's output in a state object, that can later be accessed
on any of the following steps in the chain, adding this sort of 'state-machine' behavior to the chain.
Proposal (If applicable)
I have myself coded a State model to persist state, and would like your feedback and/or some comments on whether you guys have been working on a possible solution for this or not.
The State Base Model:
Example Implementation
Beta Was this translation helpful? Give feedback.
All reactions