[PR #5785] fix(langgraph): Mark is_last_step and remaining_steps as NotRequired in AgentState #4646

Closed
opened 2026-02-20 17:50:31 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/5785

State: closed
Merged: No


Fixes #5784

This PR modifies the AgentState in chat_agent_executor.py to make is_last_step and remaining_steps optional by using NotRequired from typing_extensions.

Changes include:

  • Updated imports to include NotRequired
  • Modified AgentState TypedDict to use NotRequired for is_last_step and remaining_steps
  • Added is_last_step to AgentStatePydantic
  • Updated docstring and validation logic to reflect optional fields

All tests pass, and the changes ensure these fields are truly optional in the state management.

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/5785 **State:** closed **Merged:** No --- Fixes #5784 This PR modifies the `AgentState` in `chat_agent_executor.py` to make `is_last_step` and `remaining_steps` optional by using `NotRequired` from `typing_extensions`. Changes include: - Updated imports to include `NotRequired` - Modified `AgentState` TypedDict to use `NotRequired` for `is_last_step` and `remaining_steps` - Added `is_last_step` to `AgentStatePydantic` - Updated docstring and validation logic to reflect optional fields All tests pass, and the changes ensure these fields are truly optional in the state management.
yindo added the pull-request label 2026-02-20 17:50:31 -05:00
yindo closed this issue 2026-02-20 17:50:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#4646