Update intro to same thread example, update conceptual docs to include checkpoint (#827)

This commit is contained in:
Jacob Lee
2024-06-25 22:20:50 -07:00
committed by GitHub
parent fcdf7a8ced
commit c217e4a58d
4 changed files with 21 additions and 10 deletions
@@ -6,7 +6,7 @@
"source": [
"# How to Wait for User Input\n",
"\n",
"One of the main human-in-the-loop interaction patterns is waiting for human input. A key use case involves asking the user clarifying questions. One way to accomplish this is simply go to the END node and exit the graph. Then, any user response comes back in as fresh invocation of the graph. This is basically just creating a chatbot architecture.\n",
"One of the main human-in-the-loop interaction patterns is waiting for human input. A key use case involves asking the user clarifying questions. One way to accomplish this is simply go to the `END` node and exit the graph. Then, any user response comes back in as fresh invocation of the graph. This is basically just creating a chatbot architecture.\n",
"\n",
"The issue with this is it is tough to resume back in a particular point in the graph. Often times the agent is halfway through some process, and just needs a bit of a user input. Although it is possible to design your graph in such a way where you have a `conditional_entry_point` to route user messages back to the right place, that is not super scalable (as it essentially involves having a routing function that can end up almost anywhere).\n",
"\n",
+10 -6
View File
@@ -7,9 +7,13 @@
"source": [
"# How to run multiple agents on the same thread\n",
"\n",
"In LangGraph API, a thread is not explicitly associated with a particular agent.\n",
"This means that you can run multiple agents on the same thread.\n",
"In this example, we will create two agents and then call them both on the same thread."
"In LangGraph Cloud, a thread is not explicitly associated with a particular agent.\n",
"This means that you can run multiple agents on the same thread, which allows a different\n",
"agent to continue from an initial agent's progress.\n",
"\n",
"In this example, we will create two agents and then call them both on the same thread.\n",
"You'll see that the second agent will respond using information from the [checkpoint](https://langchain-ai.github.io/langgraph/concepts/low_level/#checkpointer-state) generated in the thread\n",
"by the first agent as context."
]
},
{
@@ -37,7 +41,7 @@
"id": "4f10d346-69e6-44f4-8ff0-ef539ba938df",
"metadata": {},
"source": [
"We can see that these agents are different"
"We can see that these agents are different:"
]
},
{
@@ -97,7 +101,7 @@
"id": "5e655e61-c2ee-488a-90f6-6189c84841da",
"metadata": {},
"source": [
"We can now run it on the OpenAI assistant first."
"We can now run the OpenAI assistant on the thread first."
]
},
{
@@ -133,7 +137,7 @@
"id": "c53709e9-ddb2-4429-9042-456eb6c91244",
"metadata": {},
"source": [
"Now, we can run it on a different Anthropic-based assistant."
"Now, we can run it on a second Anthropic-based assistant and see that this second assistant is aware of the initial question, and can answer the question, `and you?`:"
]
},
{