Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interrupt(). How to interrupt for the second time #2979

Closed
4 tasks done
Saisiva123 opened this issue Jan 10, 2025 · 2 comments
Closed
4 tasks done

Interrupt(). How to interrupt for the second time #2979

Saisiva123 opened this issue Jan 10, 2025 · 2 comments

Comments

@Saisiva123
Copy link

Checked other resources

  • This is a bug, not a usage question. For questions, please use GitHub Discussions.
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

def ask_user_node(state: LookupState) -> Command[Literal['lookup_node']]:
        agent_request = state['userAgentInteractionInfo']['agentRequest']

        if 'userResponse' in state['userAgentInteractionInfo']:
            del state['userAgentInteractionInfo']['userResponse']

        user_response = interrupt({
            'id': str(uuid.uuid4()),
            'request': agent_request
        })

        if user_response:
            return Command(goto='lookup_node',
                           resume={'userAgentInteractionInfo': {'agentRequest': agent_request}},
                           update={'messages': [HumanMessage(content=user_response, name="User_Response")], 'userAgentInteractionInfo': {'agentRequest': '', 'userResponse': ''}})

Error Message and Stack Trace (if applicable)

No response

Description

I know the default behavior of interrupt will invoke GraphInterrupt for the first time. When the same node has the interrupt its not halting the execution instead its taking the same old cached value, so is there any extra argument that I can pass so that the interrupt will halt the execution for the second time and wait for the user input

System Info

python -m langchain_core.sys_info

@Saisiva123
Copy link
Author

There are many developers who are facing this issue, it would be nicer for the langgraph team to consider this issue as priority.

@vbarda
Copy link
Collaborator

vbarda commented Jan 10, 2025

This is a duplicate of #2935

@vbarda vbarda closed this as completed Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants