From 6087b1969e95e3621738f0873d7cf337546b54cc Mon Sep 17 00:00:00 2001 From: Bagatur <22008038+baskaryan@users.noreply.github.com> Date: Mon, 20 Jan 2025 18:28:57 -0800 Subject: [PATCH] python[patch]: call create_react_agent model node without is_last_step (#3114) So that you can call agent.nodes['agent'].invoke({'messages': []}) without needing to specify is_last_step. very helpful for evaluating just the model node of the agent --- libs/langgraph/langgraph/prebuilt/chat_agent_executor.py | 4 ++-- libs/langgraph/pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py b/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py index a14007713..ceeba34b3 100644 --- a/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py +++ b/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py @@ -635,7 +635,7 @@ def call_model(state: AgentState, config: RunnableConfig) -> AgentState: if ( ( "remaining_steps" not in state - and state["is_last_step"] + and state.get("is_last_step", False) and has_tool_calls ) or ( @@ -672,7 +672,7 @@ async def acall_model(state: AgentState, config: RunnableConfig) -> AgentState: if ( ( "remaining_steps" not in state - and state["is_last_step"] + and state.get("is_last_step", False) and has_tool_calls ) or ( diff --git a/libs/langgraph/pyproject.toml b/libs/langgraph/pyproject.toml index a0b366809..742c9bd0e 100644 --- a/libs/langgraph/pyproject.toml +++ b/libs/langgraph/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langgraph" -version = "0.2.64" +version = "0.2.65" description = "Building stateful, multi-actor applications with LLMs" authors = [] license = "MIT"