Skip to content

Commit

Permalink
cr
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Jan 7, 2025
1 parent e39255a commit 8534212
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions libs/langgraph/langgraph/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,16 @@ def node(state: State):

class HumanInterruptConfig(TypedDict):
"""Configuration that defines what actions are allowed for a human interrupt.
This controls the available interaction options when the graph is paused for human input.
Attributes:
allow_ignore (bool): Whether the human can choose to ignore/skip the current step
allow_respond (bool): Whether the human can provide a text response/feedback
allow_respond (bool): Whether the human can provide a text response/feedback
allow_edit (bool): Whether the human can edit the provided content/state
allow_accept (bool): Whether the human can accept/approve the current state
"""

allow_ignore: bool
allow_respond: bool
allow_edit: bool
Expand All @@ -512,35 +513,37 @@ class HumanInterruptConfig(TypedDict):

class ActionRequest(TypedDict):
"""Represents a request for human action within the graph execution.
Contains the action type and any associated arguments needed for the action.
Attributes:
action (str): The type or name of action being requested (e.g., "Approve XYZ action")
args (dict): Key-value pairs of arguments needed for the action
"""

action: str
args: dict


class HumanInterrupt(TypedDict):
"""Represents an interrupt triggered by the graph that requires human intervention.
This is passed to the `interrupt` function when execution is paused for human input.
Attributes:
action_request (ActionRequest): The specific action being requested from the human
config (HumanInterruptConfig): Configuration defining what actions are allowed
description (Optional[str]): Optional detailed description of what input is needed
"""

action_request: ActionRequest
config: HumanInterruptConfig
description: Optional[str]


class HumanResponse(TypedDict):
"""The response provided by a human to an interrupt, which is returned when graph execution resumes.
Attributes:
type (Literal['accept', 'ignore', 'response', 'edit']): The type of response:
- "accept": Approves the current state without changes
Expand All @@ -552,5 +555,6 @@ class HumanResponse(TypedDict):
- str: For text responses
- ActionRequest: For edit actions with updated content
"""
type: Literal['accept', 'ignore', 'response', 'edit']
args: Union[None, str, ActionRequest]

type: Literal["accept", "ignore", "response", "edit"]
args: Union[None, str, ActionRequest]

0 comments on commit 8534212

Please sign in to comment.