Skip to content

is possible add node or edge dynamic without restart app #18948

Answered by dosubot bot
weiminw asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @weiminw, long time no see! Hope you're coding up a storm 🌪️

Yes, it is indeed possible to add a node or edge dynamically without restarting the app in LangChain. The Graph class in the graph.py file provides methods add_node and add_edge that allow for the dynamic addition of nodes and edges to the graph instance. These methods modify the graph's state in memory, so any changes (like adding nodes or edges) take effect immediately without the need to restart the application.

Here's how you can add a node:

# Assuming `graph` is an instance of the Graph class
new_node_data = ... # This should be an instance of BaseModel or RunnableType
new_node = graph.add_node(data=new_node_data)

And …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@weiminw
Comment options

@ariel-frischer
Comment options

@ariel-frischer
Comment options

Answer selected by weiminw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants