diff --git a/docs/docs/cloud/how-tos/langgraph_to_langgraph_cloud.ipynb b/docs/docs/cloud/how-tos/langgraph_to_langgraph_cloud.ipynb index 3620dc071..30eb85f5d 100644 --- a/docs/docs/cloud/how-tos/langgraph_to_langgraph_cloud.ipynb +++ b/docs/docs/cloud/how-tos/langgraph_to_langgraph_cloud.ipynb @@ -111,7 +111,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 10, "id": "3ab06b39-7bd1-4611-a37e-9b94e25643d2", "metadata": {}, "outputs": [], @@ -211,7 +211,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 13, "id": "0d81c783-2c7b-421a-a0f9-752e22039472", "metadata": {}, "outputs": [], @@ -538,7 +538,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 14, "id": "90b312d3-4b51-4953-8c78-8263a90b397a", "metadata": {}, "outputs": [], @@ -548,7 +548,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 15, "id": "3e523086-29ab-4b21-b762-21136d32e6fa", "metadata": {}, "outputs": [ @@ -570,7 +570,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 16, "id": "f430c8ec-782c-4003-9e30-0736cbdd37ce", "metadata": {}, "outputs": [ @@ -580,20 +580,20 @@ "text": [ "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "New York City (NYC) is known for a variety of iconic landmarks, cultural institutions, and vibrant neighborhoods. Some of the most notable features include:\n", + "New York City (NYC) is known for a variety of iconic landmarks, cultural institutions, and vibrant neighborhoods. Some of the most notable things NYC is known for include:\n", "\n", - "1. **Statue of Liberty**: A symbol of freedom and democracy.\n", + "1. **Statue of Liberty**: A symbol of freedom and democracy, located on Liberty Island.\n", "2. **Times Square**: Known for its bright lights, Broadway theaters, and bustling atmosphere.\n", - "3. **Central Park**: A large urban park offering a natural retreat in the middle of the city.\n", + "3. **Central Park**: A large urban park offering a green oasis in the middle of the city.\n", "4. **Empire State Building**: An iconic skyscraper with an observation deck offering panoramic views of the city.\n", - "5. **Broadway**: Famous for its world-class theater productions.\n", - "6. **Wall Street**: The financial hub of the United States.\n", + "5. **Broadway**: Famous for its world-class theater productions and musicals.\n", + "6. **Wall Street**: The financial hub of the United States, home to the New York Stock Exchange.\n", "7. **Museums**: Including the Metropolitan Museum of Art, the Museum of Modern Art (MoMA), and the American Museum of Natural History.\n", - "8. **Diverse Cuisine**: A melting pot of culinary experiences from around the world.\n", - "9. **Cultural Diversity**: A rich tapestry of cultures, languages, and traditions.\n", - "10. **Fashion**: A global fashion capital, home to New York Fashion Week.\n", + "8. **Diverse Cuisine**: A melting pot of culinary experiences, from street food to Michelin-starred restaurants.\n", + "9. **Cultural Diversity**: A rich tapestry of cultures and communities from around the world.\n", + "10. **Skyscrapers**: A skyline filled with iconic buildings and modern architecture.\n", "\n", - "These are just a few highlights of what makes NYC a unique and vibrant city.\n" + "NYC is also known for its influence in fashion, media, and entertainment, making it one of the most dynamic and influential cities in the world.\n" ] } ], @@ -605,7 +605,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 17, "id": "cb34efef-805d-455c-be3e-e2234d97b7cf", "metadata": {}, "outputs": [], @@ -615,7 +615,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 18, "id": "7628e108-338b-4eaf-9d57-defc2c7e2b46", "metadata": {}, "outputs": [ @@ -637,7 +637,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 19, "id": "22a3f9e6-a550-4074-95eb-be3866b77718", "metadata": {}, "outputs": [ @@ -649,45 +649,64 @@ " 'response_metadata': {},\n", " 'type': 'human',\n", " 'name': None,\n", - " 'id': 'b62078f1-7c44-4a0e-b7b0-05e475ae3188',\n", + " 'id': '381cd144-b360-4c7d-8177-e2634446993c',\n", " 'example': False},\n", " {'content': 'Could you please specify what \"it\" refers to? Are you asking about a specific city, person, object, or something else?',\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {'finish_reason': 'stop'},\n", + " 'additional_kwargs': {'refusal': None},\n", + " 'response_metadata': {'token_usage': {'completion_tokens': 28,\n", + " 'prompt_tokens': 57,\n", + " 'total_tokens': 85,\n", + " 'completion_tokens_details': {'reasoning_tokens': 0}},\n", + " 'model_name': 'gpt-4o-2024-05-13',\n", + " 'system_fingerprint': 'fp_3537616b13',\n", + " 'finish_reason': 'stop',\n", + " 'logprobs': None},\n", " 'type': 'ai',\n", " 'name': None,\n", - " 'id': 'run-502c6cf3-d584-4e31-98a6-5e59f1d2a72f',\n", + " 'id': 'run-b23c6a05-d6c7-46fd-8b09-443a334feb6b-0',\n", " 'example': False,\n", " 'tool_calls': [],\n", " 'invalid_tool_calls': [],\n", - " 'usage_metadata': None}]},\n", + " 'usage_metadata': {'input_tokens': 57,\n", + " 'output_tokens': 28,\n", + " 'total_tokens': 85}}]},\n", " 'next': [],\n", - " 'config': {'configurable': {'thread_id': 'fcff410c-9adb-416f-a7ce-09b230afcac9',\n", - " 'thread_ts': '1ef303f9-7d8e-6d0a-8001-2b4ce14235da'}},\n", + " 'tasks': [],\n", " 'metadata': {'step': 1,\n", - " 'run_id': '1ef303f9-73e6-6c6b-b407-39938d3dfd7e',\n", + " 'run_id': '1ef78309-0a79-6667-a00b-1a04034cabff',\n", " 'source': 'loop',\n", - " 'writes': {'agent': {'messages': [{'id': 'run-502c6cf3-d584-4e31-98a6-5e59f1d2a72f',\n", + " 'writes': {'agent': {'messages': [{'id': 'run-b23c6a05-d6c7-46fd-8b09-443a334feb6b-0',\n", " 'name': None,\n", " 'type': 'ai',\n", " 'content': 'Could you please specify what \"it\" refers to? Are you asking about a specific city, person, object, or something else?',\n", " 'example': False,\n", " 'tool_calls': [],\n", - " 'usage_metadata': None,\n", - " 'additional_kwargs': {},\n", - " 'response_metadata': {'finish_reason': 'stop'},\n", + " 'usage_metadata': {'input_tokens': 57,\n", + " 'total_tokens': 85,\n", + " 'output_tokens': 28},\n", + " 'additional_kwargs': {'refusal': None},\n", + " 'response_metadata': {'logprobs': None,\n", + " 'model_name': 'gpt-4o-2024-05-13',\n", + " 'token_usage': {'total_tokens': 85,\n", + " 'prompt_tokens': 57,\n", + " 'completion_tokens': 28,\n", + " 'completion_tokens_details': {'reasoning_tokens': 0}},\n", + " 'finish_reason': 'stop',\n", + " 'system_fingerprint': 'fp_3537616b13'},\n", " 'invalid_tool_calls': []}]}},\n", + " 'parents': {},\n", " 'user_id': '',\n", " 'graph_id': 'agent',\n", - " 'thread_id': 'fcff410c-9adb-416f-a7ce-09b230afcac9',\n", + " 'thread_id': '14162c42-ab85-404f-a2f9-e7207493f74b',\n", " 'created_by': 'system',\n", + " 'run_attempt': 1,\n", " 'assistant_id': 'fe096781-5601-53d2-b2f6-0d3403f7e9ca'},\n", - " 'created_at': '2024-06-22T02:31:56.042330+00:00',\n", - " 'parent_config': {'configurable': {'thread_id': 'fcff410c-9adb-416f-a7ce-09b230afcac9',\n", - " 'thread_ts': '1ef303f9-7400-6e2c-8000-e8d5075bfa2a'}}}" + " 'created_at': '2024-09-21T15:45:46.150887+00:00',\n", + " 'checkpoint_id': '1ef78309-131f-673f-8001-55ea44389e6a',\n", + " 'parent_checkpoint_id': '1ef78309-0aab-6271-8000-caaf708a2185'}" ] }, - "execution_count": 23, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } diff --git a/docs/docs/how-tos/human_in_the_loop/edit-graph-state.ipynb b/docs/docs/how-tos/human_in_the_loop/edit-graph-state.ipynb index bf5a25dc5..9f59fb659 100644 --- a/docs/docs/how-tos/human_in_the_loop/edit-graph-state.ipynb +++ b/docs/docs/how-tos/human_in_the_loop/edit-graph-state.ipynb @@ -269,7 +269,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "id": "6098e5cb", "metadata": {}, "outputs": [], @@ -384,7 +384,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "id": "cfd140f0-a5a6-4697-8115-322242f197b5", "metadata": {}, "outputs": [ @@ -397,10 +397,10 @@ "search for the weather in sf now\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "[{'text': \"Certainly! I can help you search for the current weather in San Francisco. To do this, I'll use the search function to look up the most up-to-date weather information. Let me do that for you right away.\", 'type': 'text'}, {'id': 'toolu_01FSkinAVXR1C4D5kecrzAnj', 'input': {'query': 'current weather in San Francisco'}, 'name': 'search', 'type': 'tool_use'}]\n", + "[{'text': \"Certainly! I'll search for the current weather in San Francisco for you. Let me use the search function to find this information.\", 'type': 'text'}, {'id': 'toolu_01DxRhkj4fAvaGWoBhVuvfeL', 'input': {'query': 'current weather in San Francisco'}, 'name': 'search', 'type': 'tool_use'}]\n", "Tool Calls:\n", - " search (toolu_01FSkinAVXR1C4D5kecrzAnj)\n", - " Call ID: toolu_01FSkinAVXR1C4D5kecrzAnj\n", + " search (toolu_01DxRhkj4fAvaGWoBhVuvfeL)\n", + " Call ID: toolu_01DxRhkj4fAvaGWoBhVuvfeL\n", " Args:\n", " query: current weather in San Francisco\n" ] @@ -427,7 +427,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 5, "id": "1aa7b1b9-9322-4815-bc0d-eb083870ac15", "metadata": {}, "outputs": [ @@ -435,10 +435,11 @@ "data": { "text/plain": [ "{'configurable': {'thread_id': '3',\n", - " 'thread_ts': '1ef3e229-4126-628c-8002-2a809f9bb238'}}" + " 'checkpoint_ns': '',\n", + " 'checkpoint_id': '1ef7830a-c688-6fc6-8002-824126081ba0'}}" ] }, - "execution_count": 7, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } diff --git a/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb b/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb index 3c0f4dc6a..86180add1 100644 --- a/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb +++ b/docs/docs/how-tos/human_in_the_loop/wait-user-input.ipynb @@ -102,7 +102,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 5, "id": "58eae42d-be32-48da-8d0a-ab64471657d9", "metadata": {}, "outputs": [ @@ -173,7 +173,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 6, "id": "eb8e7d47-e7c9-4217-b72c-08394a2c4d3e", "metadata": {}, "outputs": [ @@ -208,23 +208,16 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 7, "id": "2165a1bc-1c5b-411f-9e9c-a2b9627e5d56", "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Tell me how you want to update the state: go to step 3!\n" - ] - }, { "name": "stdout", "output_type": "stream", "text": [ "--State after update--\n", - "StateSnapshot(values={'input': 'hello world', 'user_feedback': 'go to step 3!'}, next=('step_3',), config={'configurable': {'thread_id': '1', 'thread_ts': '1ef3e216-b8a2-6db4-8002-966ecca671d0'}}, metadata={'source': 'update', 'step': 2, 'writes': {'human_feedback': {'user_feedback': 'go to step 3!'}}}, created_at='2024-07-09T18:31:13.083519+00:00', parent_config=None)\n" + "StateSnapshot(values={'input': 'hello world', 'user_feedback': 'go to step 3!'}, next=('step_3',), config={'configurable': {'thread_id': '1', 'checkpoint_ns': '', 'checkpoint_id': '1ef7830e-b807-6142-8002-1b511e4caf96'}}, metadata={'source': 'update', 'step': 2, 'writes': {'human_feedback': {'user_feedback': 'go to step 3!'}}, 'parents': {}}, created_at='2024-09-21T15:48:17.660131+00:00', parent_config={'configurable': {'thread_id': '1', 'checkpoint_ns': '', 'checkpoint_id': '1ef7830e-36d1-6f1e-8001-4d4c913ae8a8'}}, tasks=(PregelTask(id='6b5486bf-eb6c-0e27-4784-cad2a69b86a2', name='step_3', path=('__pregel_pull', 'step_3'), error=None, interrupts=(), state=None),))\n" ] }, { @@ -233,7 +226,7 @@ "('step_3',)" ] }, - "execution_count": 63, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } diff --git a/docs/docs/tutorials/introduction.ipynb b/docs/docs/tutorials/introduction.ipynb index 3b0c367ad..67cec9de3 100644 --- a/docs/docs/tutorials/introduction.ipynb +++ b/docs/docs/tutorials/introduction.ipynb @@ -89,7 +89,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 10, "id": "e58df974-7579-4f25-9d91-66389b94eba2", "metadata": {}, "outputs": [], @@ -140,7 +140,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 11, "id": "bc8c9137-8261-42ea-8e83-3590981d23e2", "metadata": {}, "outputs": [], @@ -174,7 +174,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 12, "id": "e331e10d-ebcf-4144-9bd3-999b4d656dd3", "metadata": {}, "outputs": [], @@ -192,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 13, "id": "075f0929-3591-4852-b2d3-eaadde40662d", "metadata": {}, "outputs": [], @@ -210,7 +210,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 14, "id": "0bb67a01-cf5c-4625-8c07-6e8c0af50fca", "metadata": {}, "outputs": [], @@ -228,7 +228,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 15, "id": "32e4f36e-72ce-4ade-bd7e-94880e0d456b", "metadata": {}, "outputs": [ @@ -265,7 +265,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 17, "id": "7afb4c9a-7404-4e92-9945-36f372015f08", "metadata": {}, "outputs": [ @@ -273,55 +273,17 @@ "name": "stdout", "output_type": "stream", "text": [ - "User: what's langgraph all about?\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Assistant: LangGraph is a new open-source deep learning framework that focuses on enabling efficient training and deployment of large language models. Some key things to know about LangGraph:\n", + "User: What's LangGraph all about?\n", + "Assistant: LangGraph is an open-source project that aims to create a large, multilingual knowledge graph based on language data. The key goals of the LangGraph project are:\n", "\n", - "1. Efficient Training: LangGraph is designed to accelerate the training of large language models by leveraging advanced optimization techniques and parallelization strategies.\n", + "1. Building a multilingual knowledge graph that can be used for various natural language processing tasks, such as semantic search, question answering, and knowledge-based reasoning.\n", "\n", - "2. Modular Architecture: LangGraph has a modular architecture that allows for easy customization and extension of language models, making it flexible for a variety of NLP tasks.\n", + "2. Leveraging the power of large language models and unsupervised learning techniques to extract and integrate knowledge from a diverse set of linguistic sources, including Wikipedia, books, web pages, and other textual data.\n", "\n", - "3. Hardware Acceleration: The framework is optimized for both CPU and GPU hardware, allowing for efficient model deployment on a wide range of devices.\n", + "3. Providing a flexible and extensible framework for researchers and developers to work with the knowledge graph, explore its capabilities, and contribute to its development.\n", "\n", - "4. Scalability: LangGraph is designed to handle large-scale language models with billions of parameters, enabling the development of state-of-the-art NLP applications.\n", - "\n", - "5. Open-Source: LangGraph is an open-source project, allowing developers and researchers to collaborate, contribute, and build upon the framework.\n", - "\n", - "6. Performance: The goal of LangGraph is to provide superior performance and efficiency compared to existing deep learning frameworks, particularly for training and deploying large language models.\n", - "\n", - "Overall, LangGraph is a promising new deep learning framework that aims to address the challenges of building and deploying advanced natural language processing models at scale. It is an active area of research and development, with the potential to drive further advancements in the field of language AI.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "User: hm that doesn't seem right...\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Assistant: I'm sorry, I don't have enough context to determine what doesn't seem right. Could you please provide more details about what you're referring to? That would help me better understand and respond appropriately.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "User: q\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ + "The LangGraph project is still in early stages of development, but the long-term vision is to create a comprehensive, high-quality knowledge resource that can support a wide range of applications in the field of natural language processing and artificial intelligence. The project is open-source and welcomes contributions from the research community.\n", + "User: q\n", "Goodbye!\n" ] } @@ -329,6 +291,7 @@ "source": [ "while True:\n", " user_input = input(\"User: \")\n", + " print(\"User: \"+ user_input)\n", " if user_input.lower() in [\"quit\", \"exit\", \"q\"]:\n", " print(\"Goodbye!\")\n", " break\n", @@ -844,7 +807,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 3, "id": "6baafdf6-6803-4305-9381-9dc970468a4d", "metadata": {}, "outputs": [], @@ -866,7 +829,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 4, "id": "e6a51f1e-00de-4701-8931-de8cf19294ae", "metadata": {}, "outputs": [], @@ -924,7 +887,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 5, "id": "a06548bf-81fa-4436-b4c1-f68601fb4187", "metadata": {}, "outputs": [], @@ -942,7 +905,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 6, "id": "761d15fb-d5e2-4d50-a630-126d77e77294", "metadata": {}, "outputs": [ @@ -977,7 +940,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 7, "id": "be7b5abb-04ef-4d53-83d1-d4d3139cc43a", "metadata": {}, "outputs": [], @@ -995,7 +958,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 8, "id": "dba1b168-f8e0-496d-9bd6-37198fb4776e", "metadata": {}, "outputs": [ @@ -1008,7 +971,7 @@ "Hi there! My name is Will.\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "It's nice to meet you, Will! I'm an AI assistant created by Anthropic. I'm here to help you with any questions or tasks you may have. Please let me know how I can assist you today.\n" + "It's nice to meet you, Will! I'm an AI assistant created by Anthropic. I'm here to help with any questions or tasks you may have. Please let me know how I can assist you today.\n" ] } ], @@ -1035,7 +998,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "id": "f5447778-53d7-47f3-801b-f47bcf2185a0", "metadata": {}, "outputs": [ @@ -1048,7 +1011,7 @@ "Remember my name?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "Of course, your name is Will. It's nice to meet you again!\n" + "Yes, I remember your name is Will. It's a pleasure to meet you!\n" ] } ], @@ -1075,7 +1038,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "id": "4527cf9a-b191-4bde-858a-e33a74a48c55", "metadata": {}, "outputs": [ @@ -1088,7 +1051,7 @@ "Remember my name?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "I'm afraid I don't actually have the capability to remember your name. As an AI assistant, I don't have a persistent memory of our previous conversations or interactions. I respond based on the current context provided to me. Could you please restate your name or provide more information so I can try to assist you?\n" + "I'm afraid I don't actually have the capability to remember your name specifically. As an AI assistant, I don't have a persistent memory of individual users or their names. I respond to each new interaction based on the context provided to me in the moment. If you'd like, you can remind me of your name and I'll do my best to refer to you by it going forward.\n" ] } ], @@ -1115,17 +1078,17 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "id": "0be77c25-1423-4f2d-9b2d-28530cc761a4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "StateSnapshot(values={'messages': [HumanMessage(content='Hi there! My name is Will.', id='aad97d7f-8845-4f9e-b723-2af3b7c97590'), AIMessage(content=\"It's nice to meet you, Will! I'm an AI assistant created by Anthropic. I'm here to help you with any questions or tasks you may have. Please let me know how I can assist you today.\", response_metadata={'id': 'msg_01VCz7Y5jVmMZXibBtnECyvJ', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 375, 'output_tokens': 49}}, id='run-66cf1695-5ba8-4fd8-a79d-ded9ee3c3b33-0'), HumanMessage(content='Remember my name?', id='ac1e9971-dbee-4622-9e63-5015dee05c20'), AIMessage(content=\"Of course, your name is Will. It's nice to meet you again!\", response_metadata={'id': 'msg_01RsJ6GaQth7r9soxbF7TSpQ', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 431, 'output_tokens': 19}}, id='run-890149d3-214f-44e8-9717-57ec4ef68224-0')]}, next=(), config={'configurable': {'thread_id': '1', 'thread_ts': '2024-05-06T22:23:20.430350+00:00'}}, parent_config=None)" + "StateSnapshot(values={'messages': [HumanMessage(content='Hi there! My name is Will.', additional_kwargs={}, response_metadata={}, id='9e0f1409-6dac-4eb0-9d22-31b432fba97f'), AIMessage(content=\"It's nice to meet you, Will! I'm an AI assistant created by Anthropic. I'm here to help with any questions or tasks you may have. Please let me know how I can assist you today.\", additional_kwargs={}, response_metadata={'id': 'msg_014x6qZMoJJWfZXMXeuMb5Xq', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 375, 'output_tokens': 48}}, id='run-7519fe43-1a86-49b9-b776-6db053c7a5b9-0', usage_metadata={'input_tokens': 375, 'output_tokens': 48, 'total_tokens': 423}), HumanMessage(content='Remember my name?', additional_kwargs={}, response_metadata={}, id='50355ebf-3017-41a2-a9dc-8b2c9a3fd22e'), AIMessage(content=\"Yes, I remember your name is Will. It's a pleasure to meet you!\", additional_kwargs={}, response_metadata={'id': 'msg_01We29qsEaQYYxW99bVHvuXq', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 430, 'output_tokens': 20}}, id='run-7be0df03-e28b-4c94-bd66-4294011d1d8b-0', usage_metadata={'input_tokens': 430, 'output_tokens': 20, 'total_tokens': 450})]}, next=(), config={'configurable': {'thread_id': '1', 'checkpoint_ns': '', 'checkpoint_id': '1ef78322-a099-6dde-8004-0d1d663bf3a7'}}, metadata={'source': 'loop', 'writes': {'chatbot': {'messages': [AIMessage(content=\"Yes, I remember your name is Will. It's a pleasure to meet you!\", additional_kwargs={}, response_metadata={'id': 'msg_01We29qsEaQYYxW99bVHvuXq', 'model': 'claude-3-haiku-20240307', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 430, 'output_tokens': 20}}, id='run-7be0df03-e28b-4c94-bd66-4294011d1d8b-0', usage_metadata={'input_tokens': 430, 'output_tokens': 20, 'total_tokens': 450})]}}, 'step': 4, 'parents': {}}, created_at='2024-09-21T15:57:12.074573+00:00', parent_config={'configurable': {'thread_id': '1', 'checkpoint_ns': '', 'checkpoint_id': '1ef78322-9a67-6268-8003-9cbe7efebfa6'}}, tasks=())" ] }, - "execution_count": 10, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -1611,7 +1574,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 19, "id": "a6b3bcae-dd04-49da-a4ef-e05634657faf", "metadata": {}, "outputs": [ @@ -1621,10 +1584,10 @@ "text": [ "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "[{'id': 'toolu_01DTyDpJ1kKdNps5yxv3AGJd', 'input': {'query': 'LangGraph'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}]\n", + "[{'text': \"Okay, let's look up some information on LangGraph:\", 'type': 'text'}, {'id': 'toolu_01TnhD1x76tUrcwuoXAw5H2s', 'input': {'query': 'LangGraph'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}]\n", "Tool Calls:\n", - " tavily_search_results_json (toolu_01DTyDpJ1kKdNps5yxv3AGJd)\n", - " Call ID: toolu_01DTyDpJ1kKdNps5yxv3AGJd\n", + " tavily_search_results_json (toolu_01TnhD1x76tUrcwuoXAw5H2s)\n", + " Call ID: toolu_01TnhD1x76tUrcwuoXAw5H2s\n", " Args:\n", " query: LangGraph\n" ] @@ -1650,7 +1613,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 20, "id": "6a44bedc-ea91-4c22-976c-98b3d5a5e4a7", "metadata": {}, "outputs": [ @@ -1664,7 +1627,7 @@ "\n", "\n", "Last 2 messages;\n", - "[ToolMessage(content='LangGraph is a library for building stateful, multi-actor applications with LLMs.', id='14589ef1-15db-4a75-82a6-d57c40a216d0', tool_call_id='toolu_01DTyDpJ1kKdNps5yxv3AGJd'), AIMessage(content='LangGraph is a library for building stateful, multi-actor applications with LLMs.', id='1c657bfb-7690-44c7-a26d-d0d22453013d')]\n" + "[ToolMessage(content='LangGraph is a library for building stateful, multi-actor applications with LLMs.', id='0d1cc4e3-f99a-4cdf-a3d1-75a9086f1d8d', tool_call_id='toolu_01TnhD1x76tUrcwuoXAw5H2s'), AIMessage(content='LangGraph is a library for building stateful, multi-actor applications with LLMs.', additional_kwargs={}, response_metadata={}, id='c9794d07-6ca7-4207-9222-1252f74c79f4')]\n" ] } ], @@ -1715,7 +1678,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 21, "id": "d16d95c3-b465-42ac-8015-26b669d45d1f", "metadata": {}, "outputs": [ @@ -1723,10 +1686,11 @@ "data": { "text/plain": [ "{'configurable': {'thread_id': '1',\n", - " 'thread_ts': '2024-05-06T22:27:57.350721+00:00'}}" + " 'checkpoint_ns': '',\n", + " 'checkpoint_id': '1ef78318-9734-674e-8003-400e0489187e'}}" ] }, - "execution_count": 5, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -2298,7 +2262,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 35, "id": "c1955d79-a1e4-47d0-ba79-b45bd5752a23", "metadata": {}, "outputs": [ @@ -2311,12 +2275,12 @@ "I need some expert guidance for building this AI agent. Could you request assistance for me?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "[{'id': 'toolu_017XaQuVsoAyfXeTfDyv55Pc', 'input': {'request': 'I need some expert guidance for building this AI agent.'}, 'name': 'RequestAssistance', 'type': 'tool_use'}]\n", + "[{'text': 'Okay, I can request assistance from an expert to help guide you in building your AI agent using LangGraph.', 'type': 'text'}, {'id': 'toolu_01RBBniFBbULbRQaY9pRBV1a', 'input': {'request': 'I have a user who is interested in building an autonomous AI agent using the LangGraph library. They would benefit from some expert guidance and advice on how to approach this project effectively. Could an expert please provide some high-level suggestions and recommendations?'}, 'name': 'RequestAssistance', 'type': 'tool_use'}]\n", "Tool Calls:\n", - " RequestAssistance (toolu_017XaQuVsoAyfXeTfDyv55Pc)\n", - " Call ID: toolu_017XaQuVsoAyfXeTfDyv55Pc\n", + " RequestAssistance (toolu_01RBBniFBbULbRQaY9pRBV1a)\n", + " Call ID: toolu_01RBBniFBbULbRQaY9pRBV1a\n", " Args:\n", - " request: I need some expert guidance for building this AI agent.\n" + " request: I have a user who is interested in building an autonomous AI agent using the LangGraph library. They would benefit from some expert guidance and advice on how to approach this project effectively. Could an expert please provide some high-level suggestions and recommendations?\n" ] } ], @@ -2342,7 +2306,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 36, "id": "5320ba05-5696-4194-8278-5385c571264d", "metadata": {}, "outputs": [ @@ -2352,7 +2316,7 @@ "('human',)" ] }, - "execution_count": 10, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } @@ -2376,7 +2340,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 37, "id": "2cbac924-61ce-4282-9b1c-77f9090ea1f5", "metadata": {}, "outputs": [ @@ -2384,10 +2348,11 @@ "data": { "text/plain": [ "{'configurable': {'thread_id': '1',\n", - " 'thread_ts': '2024-05-06T22:31:39.973392+00:00'}}" + " 'checkpoint_ns': '',\n", + " 'checkpoint_id': '1ef7831f-5e19-6ac0-800a-9bac3345023c'}}" ] }, - "execution_count": 11, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } @@ -2611,7 +2576,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 29, "id": "bb8a02de-a21b-4ef6-a714-7d6e44435e3a", "metadata": {}, "outputs": [], @@ -2721,7 +2686,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 26, "id": "a7debb4a-2a3a-40b9-a48c-7052ec2c2726", "metadata": {}, "outputs": [ @@ -2756,7 +2721,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 30, "id": "69071b02-c011-4b7f-90b1-8e89e032322d", "metadata": {}, "outputs": [ @@ -2769,31 +2734,27 @@ "I'm learning LangGraph. Could you do some research on it for me?\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "[{'text': \"Okay, let me look into LangGraph for you. Here's what I found:\", 'type': 'text'}, {'id': 'toolu_011AQ2FT4RupVka2LVMV3Gci', 'input': {'query': 'LangGraph'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}]\n", + "[{'text': \"Okay, let's look into LangGraph for you. Here is some information I found:\", 'type': 'text'}, {'id': 'toolu_01BjngHLf5tB3gJqGg7LErdQ', 'input': {'query': 'LangGraph'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}]\n", "Tool Calls:\n", - " tavily_search_results_json (toolu_011AQ2FT4RupVka2LVMV3Gci)\n", - " Call ID: toolu_011AQ2FT4RupVka2LVMV3Gci\n", + " tavily_search_results_json (toolu_01BjngHLf5tB3gJqGg7LErdQ)\n", + " Call ID: toolu_01BjngHLf5tB3gJqGg7LErdQ\n", " Args:\n", " query: LangGraph\n", "=================================\u001b[1m Tool Message \u001b[0m=================================\n", "Name: tavily_search_results_json\n", "\n", - "[{\"url\": \"https://langchain-ai.github.io/langgraph/\", \"content\": \"LangGraph is framework agnostic (each node is a regular python function). It extends the core Runnable API (shared interface for streaming, async, and batch calls) to make it easy to: Seamless state management across multiple turns of conversation or tool usage. The ability to flexibly route between nodes based on dynamic criteria.\"}, {\"url\": \"https://blog.langchain.dev/langgraph-multi-agent-workflows/\", \"content\": \"As a part of the launch, we highlighted two simple runtimes: one that is the equivalent of the AgentExecutor in langchain, and a second that was a version of that aimed at message passing and chat models.\\n It's important to note that these three examples are only a few of the possible examples we could highlight - there are almost assuredly other examples out there and we look forward to seeing what the community comes up with!\\n LangGraph: Multi-Agent Workflows\\nLinks\\nLast week we highlighted LangGraph - a new package (available in both Python and JS) to better enable creation of LLM workflows containing cycles, which are a critical component of most agent runtimes. \\\"\\nAnother key difference between Autogen and LangGraph is that LangGraph is fully integrated into the LangChain ecosystem, meaning you take fully advantage of all the LangChain integrations and LangSmith observability.\\n As part of this launch, we're also excited to highlight a few applications built on top of LangGraph that utilize the concept of multiple agents.\\n\"}]\n", + "[{\"url\": \"https://www.datacamp.com/tutorial/langgraph-tutorial\", \"content\": \"LangGraph is a library within the LangChain ecosystem that simplifies the development of complex, multi-agent large language model (LLM) applications. Learn how to use LangGraph to create stateful, flexible, and scalable systems with nodes, edges, and state management.\"}, {\"url\": \"https://langchain-ai.github.io/langgraph/tutorials/\", \"content\": \"LangGraph is a framework for building language agents as graphs. Learn how to use LangGraph to create chatbots, code assistants, planning agents, reflection agents, and more with these notebooks.\"}]\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "Based on the search results, here's what I've learned about LangGraph:\n", - "\n", - "- LangGraph is a framework-agnostic tool that extends the Runnable API to make it easier to manage state and routing between different nodes or agents in a conversational workflow. \n", - "\n", - "- It's part of the LangChain ecosystem, so it integrates with other LangChain tools and observability features.\n", + "Based on the search results, LangGraph seems to be a library within the LangChain ecosystem that helps with building complex, multi-agent language model applications. It allows you to create stateful, flexible, and scalable systems using a graph-based approach with nodes, edges, and state management.\n", "\n", - "- LangGraph enables the creation of multi-agent workflows, where you can have different \"nodes\" or agents that can communicate and pass information to each other.\n", + "The key things I learned are:\n", "\n", - "- This allows for more complex conversational flows and the ability to chain together different capabilities, tools, or models.\n", + "- LangGraph simplifies the development of complex LLM-powered applications\n", + "- It allows you to create chatbots, code assistants, planning agents, and other language agents as graphs\n", + "- The graph-based approach with nodes and edges provides more flexibility and scalability compared to simpler language models\n", "\n", - "- The key benefits seem to be around state management, flexible routing between agents, and the ability to create more sophisticated and dynamic conversational workflows.\n", - "\n", - "Let me know if you need any clarification or have additional questions! I'm happy to do more research on LangGraph if you need further details.\n" + "Does this help summarize the key details about LangGraph? Let me know if you need any clarification or have additional questions!\n" ] } ], @@ -2815,7 +2776,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 31, "id": "acbec099-e5d2-497f-929e-c548d7bcbf77", "metadata": {}, "outputs": [ @@ -2828,31 +2789,21 @@ "Ya that's helpful. Maybe I'll build an autonomous agent with it!\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "[{'text': \"That's great that you're interested in building an autonomous agent using LangGraph! Here are a few additional thoughts on how you could approach that:\", 'type': 'text'}, {'id': 'toolu_01L3V9FhZG5Qx9jqRGfWGtS2', 'input': {'query': 'building autonomous agents with langgraph'}, 'name': 'tavily_search_results_json', 'type': 'tool_use'}]\n", - "Tool Calls:\n", - " tavily_search_results_json (toolu_01L3V9FhZG5Qx9jqRGfWGtS2)\n", - " Call ID: toolu_01L3V9FhZG5Qx9jqRGfWGtS2\n", - " Args:\n", - " query: building autonomous agents with langgraph\n", - "=================================\u001b[1m Tool Message \u001b[0m=================================\n", - "Name: tavily_search_results_json\n", - "\n", - "[{\"url\": \"https://github.com/langchain-ai/langgraphjs\", \"content\": \"LangGraph is a library for building stateful, multi-actor applications with LLMs, built on top of (and intended to be used with) LangChain.js.It extends the LangChain Expression Language with the ability to coordinate multiple chains (or actors) across multiple steps of computation in a cyclic manner. It is inspired by Pregel and Apache Beam.The current interface exposed is one inspired by ...\"}, {\"url\": \"https://github.com/langchain-ai/langgraph\", \"content\": \"LangGraph is a library for building stateful, multi-actor applications with LLMs. It extends the LangChain Expression Language with the ability to coordinate multiple chains (or actors) across multiple steps of computation in a cyclic manner. It is inspired by Pregel and Apache Beam.The current interface exposed is one inspired by NetworkX.. The main use is for adding cycles to your LLM ...\"}]\n", - "==================================\u001b[1m Ai Message \u001b[0m==================================\n", + "That's great that you're interested in building an autonomous agent using LangGraph! That sounds like an exciting project.\n", "\n", - "The key things to keep in mind:\n", + "Since you mentioned wanting to build an autonomous agent, here are a few additional thoughts and suggestions:\n", "\n", - "1. LangGraph is designed to help coordinate multiple \"agents\" or \"actors\" that can pass information back and forth. This allows you to build more complex, multi-step workflows.\n", + "- The graph-based approach of LangGraph lends itself well to building autonomous agents. The nodes can represent different capabilities, knowledge, or decision-making components, while the edges define how they interact.\n", "\n", - "2. You'll likely want to define different nodes or agents that handle specific tasks or capabilities. LangGraph makes it easy to route between these agents based on the state of the conversation.\n", + "- When building an autonomous agent, you'll likely want to incorporate features like memory, reasoning, planning, and task decomposition. LangGraph seems well-suited for implementing these types of complex, multi-faceted agents.\n", "\n", - "3. Make sure to leverage the LangChain ecosystem - things like prompts, memory, agents, tools etc. LangGraph integrates with these to give you a powerful set of building blocks.\n", + "- You may also want to consider integrating LangGraph with other LangChain components, like agents, chains, and tools. This could allow you to create a comprehensive autonomous system.\n", "\n", - "4. Pay close attention to state management - LangGraph helps you manage state across multiple interactions, which is crucial for an autonomous agent.\n", + "- Thinking through the agent's architecture, knowledge base, and decision-making process will be key. LangGraph provides the flexibility to design these elements in a modular, scalable way.\n", "\n", - "5. Consider how you'll handle things like user intent, context, and goal-driven behavior. LangGraph gives you the flexibility to implement these kinds of complex behaviors.\n", + "- It could be helpful to look at some of the LangGraph tutorials and example projects to get ideas and see how others have approached building autonomous agents.\n", "\n", - "Let me know if you have any other specific questions as you start prototyping your autonomous agent! I'm happy to provide more guidance.\n" + "Let me know if you have any other questions as you start planning and building your autonomous agent project using LangGraph. I'm happy to provide more suggestions or point you to relevant resources.\n" ] } ], @@ -2881,7 +2832,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 32, "id": "6c0dbed5-210d-40ad-b002-0bc52ef28fac", "metadata": {}, "outputs": [ @@ -2889,21 +2840,21 @@ "name": "stdout", "output_type": "stream", "text": [ - "Num Messages: 8 Next: ()\n", - "--------------------------------------------------------------------------------\n", - "Num Messages: 7 Next: ('chatbot',)\n", - "--------------------------------------------------------------------------------\n", - "Num Messages: 6 Next: ('action',)\n", + "Num Messages: 6 Next: ()\n", "--------------------------------------------------------------------------------\n", "Num Messages: 5 Next: ('chatbot',)\n", "--------------------------------------------------------------------------------\n", + "Num Messages: 4 Next: ('__start__',)\n", + "--------------------------------------------------------------------------------\n", "Num Messages: 4 Next: ()\n", "--------------------------------------------------------------------------------\n", "Num Messages: 3 Next: ('chatbot',)\n", "--------------------------------------------------------------------------------\n", - "Num Messages: 2 Next: ('action',)\n", + "Num Messages: 2 Next: ('tools',)\n", "--------------------------------------------------------------------------------\n", "Num Messages: 1 Next: ('chatbot',)\n", + "--------------------------------------------------------------------------------\n", + "Num Messages: 0 Next: ('__start__',)\n", "--------------------------------------------------------------------------------\n" ] } @@ -2930,7 +2881,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 33, "id": "de8d5521-8d71-4093-a657-4920c790802f", "metadata": {}, "outputs": [ @@ -2938,8 +2889,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "('action',)\n", - "{'configurable': {'thread_id': '1', 'thread_ts': '2024-05-06T22:33:10.211424+00:00'}}\n" + "()\n", + "{'configurable': {'thread_id': '1', 'checkpoint_ns': '', 'checkpoint_id': '1ef7831d-58f0-6ce4-8006-fe08b710077e'}}\n" ] } ], @@ -2953,12 +2904,12 @@ "id": "7e8c61f5-3a4a-4cce-b81b-43fe1dcc971f", "metadata": {}, "source": [ - "**Notice** that the checkpoint's config (`to_replay.config`) contains a `thread_ts` **timestamp**. Providing this `thread_ts` value tells LangGraph's checkpointer to **load** the state from that moment in time. Let's try it below:" + "**Notice** that the checkpoint's config (`to_replay.config`) contains a `checkpoint_id` **timestamp**. Providing this `checkpoint_id` value tells LangGraph's checkpointer to **load** the state from that moment in time. Let's try it below:" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 34, "id": "85f17be3-eaf6-495e-a846-49436916b4ab", "metadata": {}, "outputs": [ @@ -2966,34 +2917,28 @@ "name": "stdout", "output_type": "stream", "text": [ - "=================================\u001b[1m Tool Message \u001b[0m=================================\n", - "Name: tavily_search_results_json\n", - "\n", - "[{\"url\": \"https://valentinaalto.medium.com/getting-started-with-langgraph-66388e023754\", \"content\": \"Sign up\\nSign in\\nSign up\\nSign in\\nMember-only story\\nGetting Started with LangGraph\\nBuilding multi-agents application with graph frameworks\\nValentina Alto\\nFollow\\n--\\nShare\\nOver the last year, LangChain has established itself as one of the most popular AI framework available in the market. This new library, introduced in January\\u2026\\n--\\n--\\nWritten by Valentina Alto\\nData&AI Specialist at @Microsoft | MSc in Data Science | AI, Machine Learning and Running enthusiast\\nHelp\\nStatus\\nAbout\\nCareers\\nBlog\\nPrivacy\\nTerms\\nText to speech\\nTeams Since the concept of multi-agent applications \\u2014 the ones exhibiting different agents, each having a specific personality and tools to access \\u2014 is getting real and mainstream (see the rise of libraries projects like AutoGen), LangChain\\u2019s developers introduced a new library to make it easier to manage these kind of agentic applications. Nevertheless, those chains were lacking the capability of introducing cycles into their runtime, meaning that there is no out-of-the-box framework to enable the LLM to reason over the next best action in a kind of for-loop scenario. The main feature of LangChain \\u2014 as the name suggests \\u2014 is its ability to easily create the so-called chains.\"}, {\"url\": \"https://blog.langchain.dev/langgraph-multi-agent-workflows/\", \"content\": \"As a part of the launch, we highlighted two simple runtimes: one that is the equivalent of the AgentExecutor in langchain, and a second that was a version of that aimed at message passing and chat models.\\n It's important to note that these three examples are only a few of the possible examples we could highlight - there are almost assuredly other examples out there and we look forward to seeing what the community comes up with!\\n LangGraph: Multi-Agent Workflows\\nLinks\\nLast week we highlighted LangGraph - a new package (available in both Python and JS) to better enable creation of LLM workflows containing cycles, which are a critical component of most agent runtimes. \\\"\\nAnother key difference between Autogen and LangGraph is that LangGraph is fully integrated into the LangChain ecosystem, meaning you take fully advantage of all the LangChain integrations and LangSmith observability.\\n As part of this launch, we're also excited to highlight a few applications built on top of LangGraph that utilize the concept of multiple agents.\\n\"}]\n", "==================================\u001b[1m Ai Message \u001b[0m==================================\n", "\n", - "The key things I gathered are:\n", + "That's great that you're interested in building an autonomous agent using LangGraph! That sounds like an exciting project.\n", + "\n", + "Since you mentioned wanting to build an autonomous agent, here are a few additional thoughts and suggestions:\n", "\n", - "- LangGraph is well-suited for building multi-agent applications, where you have different agents with their own capabilities, tools, and personality.\n", + "- The graph-based approach of LangGraph lends itself well to building autonomous agents. The nodes can represent different capabilities, knowledge, or decision-making components, while the edges define how they interact.\n", "\n", - "- It allows you to create more complex workflows with cycles and feedback loops, which is critical for building autonomous agents that can reason about their next best actions.\n", + "- When building an autonomous agent, you'll likely want to incorporate features like memory, reasoning, planning, and task decomposition. LangGraph seems well-suited for implementing these types of complex, multi-faceted agents.\n", "\n", - "- The integration with LangChain means you can leverage other useful features like state management, observability, and integrations with various language models and data sources.\n", + "- You may also want to consider integrating LangGraph with other LangChain components, like agents, chains, and tools. This could allow you to create a comprehensive autonomous system.\n", "\n", - "Some tips for building an autonomous agent with LangGraph:\n", + "- Thinking through the agent's architecture, knowledge base, and decision-making process will be key. LangGraph provides the flexibility to design these elements in a modular, scalable way.\n", "\n", - "1. Define the different agents/nodes in your workflow and their specific responsibilities/capabilities.\n", - "2. Set up the connections and routing between the agents so they can pass information and decisions back and forth.\n", - "3. Implement logic within each agent to assess the current state and determine the optimal next action.\n", - "4. Use LangChain features like memory and toolkits to give your agents access to relevant information and abilities.\n", - "5. Monitor the overall system behavior and iteratively improve the agent interactions and decision-making.\n", + "- It could be helpful to look at some of the LangGraph tutorials and example projects to get ideas and see how others have approached building autonomous agents.\n", "\n", - "Let me know if you have any other questions! I'm happy to provide more guidance as you start building your autonomous agent with LangGraph.\n" + "Let me know if you have any other questions as you start planning and building your autonomous agent project using LangGraph. I'm happy to provide more suggestions or point you to relevant resources.\n" ] } ], "source": [ - "# The `thread_ts` in the `to_replay.config` corresponds to a state we've persisted to our checkpointer.\n", + "# The `checkpoint_id` in the `to_replay.config` corresponds to a state we've persisted to our checkpointer.\n", "for event in graph.stream(None, to_replay.config, stream_mode=\"values\"):\n", " if \"messages\" in event:\n", " event[\"messages\"][-1].pretty_print()"