diff --git a/docs/_scripts/copy_notebooks.py b/docs/_scripts/copy_notebooks.py index c955dd6b7..b573c1a22 100644 --- a/docs/_scripts/copy_notebooks.py +++ b/docs/_scripts/copy_notebooks.py @@ -29,7 +29,7 @@ _MANUAL = { "configuration.ipynb", "map-reduce.ipynb", "extraction/retries.ipynb", - "create-react-agent.ipynb" + "create-react-agent.ipynb", ], "tutorials": [ "introduction.ipynb", diff --git a/examples/create-react-agent.ipynb b/examples/create-react-agent.ipynb index e591c7d40..35a3bb6e3 100644 --- a/examples/create-react-agent.ipynb +++ b/examples/create-react-agent.ipynb @@ -9,14 +9,14 @@ ] }, { - "cell_type": "code", - "execution_count": 1, - "id": "a213e11a-5c62-4ddb-a707-490d91add383", + "cell_type": "markdown", + "id": "e0fcced0-9767-412f-90f9-7f3cd618ff90", "metadata": {}, - "outputs": [], "source": [ - "%%capture --no-stderr\n", - "%pip install -U langgraph langchain-openai" + "In this how-to we'll create a simple [ReAct](https://arxiv.org/abs/2210.03629) agent app that can check the weather. The app consists of an agent (LLM) and tools. As we interact with the app, we will first call the agent (LLM) to decide if we should use tools. Then we will run a loop: \n", + "\n", + "1. If the agent said to take an action (i.e. call tool), we'll run the tools and pass the results back to the agent\n", + "2. If the agent did not ask to run tools, we will finish (respond to the user)" ] }, { @@ -27,6 +27,17 @@ "## Setup" ] }, + { + "cell_type": "code", + "execution_count": 1, + "id": "a213e11a-5c62-4ddb-a707-490d91add383", + "metadata": {}, + "outputs": [], + "source": [ + "%%capture --no-stderr\n", + "%pip install -U langgraph langchain-openai" + ] + }, { "cell_type": "code", "execution_count": 2, @@ -64,19 +75,14 @@ "id": "03c0f089-070c-4cd4-87e0-6c51f2477b82", "metadata": {}, "source": [ - "## How to create a simple ReAct agent" + "## How to create a simple ReAct agent with `create_react_agent`" ] }, { "cell_type": "markdown", - "id": "f1c8e137-e6e6-4f9f-bd1b-77359a1c4ec5", + "id": "91efaf20-711b-4b94-837e-dcef10d8abdd", "metadata": {}, "source": [ - "Let's create a simple ReAct agent app that can check the weather. The app consists of an agent (LLM) and tools. As we interact with the app, we will first call the agent (LLM) to decide if we should use tools. Then we will run a loop: \n", - "\n", - "1. If the agent said to take an action (i.e. call tool), we'll run the tools and pass the results back to the agent\n", - "2. If the agent did not ask to run tools, we will finish (respond to the user)\n", - "\n", "In our example we'll use `ChatOpenAI` as our agent and a custom tool that returns pre-defined values for weather in two cities (NYC & SF)" ] },