eino icon indicating copy to clipboard operation
eino copied to clipboard

Support interactive Q&A node for user input during graph execution

Open SallyKAN opened this issue 10 months ago • 5 comments

Is your feature request related to a problem? Please describe.

I need to implement interactive workflows that require user input during graph execution. Currently, I couldn't find documentation or examples about how to create a Q&A node that can:

  • Pause graph execution
  • Wait for user input
  • Resume execution with the input

Describe the solution you'd like

A dedicated Q&A node type that supports:

  1. Defining question/prompt for user
  2. Pausing graph execution
  3. Collecting user input
  4. Resuming execution and passing input to downstream nodes

Describe alternatives you've considered

I've looked through the documentation and source code but haven't found existing solutions. Potential alternatives could be:

  1. Using external event system to handle user interactions
  2. Creating custom node implementation However, without clear guidance on graph execution control, these may not be proper solutions.

Additional context

This feature would enable building:

  • Interactive decision-making workflows
  • Dynamic parameter collection during execution
  • Conversational/dialog-based applications

Similar frameworks like LangGraph have implemented this capability through their "Human in the loop" feature:

  • LangGraph example: https://github.com/langchain-ai/langgraph/blob/main/examples/agent_human_in_loop.ipynb
  • Documentation: https://python.langchain.com/docs/langgraph/user_guide/human_in_loop

Having this feature would bring eino to parity with other leading graph execution frameworks in terms of interactive workflow support.

If this functionality already exists, I would appreciate being pointed to relevant documentation or examples.

SallyKAN avatar Feb 09 '25 14:02 SallyKAN

Have you considered using two separate graphs? Your 'break point' will be the end of the first graph, and your 'resume' will be the start of the second graph.

shentongmartin avatar Feb 10 '25 06:02 shentongmartin

Have you considered using two separate graphs? Your 'break point' will be the end of the first graph, and your 'resume' will be the start of the second graph.

I haven't considered implementing it using two separate graphs because from a business perspective, the question-answering component should ideally be part of a single graph or agent. Additionally, I haven't come across the concept of subgraphs or nested graphs in the documentation to implement this logic.

SallyKAN avatar Feb 11 '25 03:02 SallyKAN

I understand the point that you want the entire business process to be self-contained within one graph.

As for actual implementation using separate graphs, it works like this:

  1. first graph: the last node is the interruption point. The graph's output is what you want your user to see after interruption, such as the question you want him to answer.
  2. second graph: the first node is after the interruption point. The graph's input is what the user provides additionally, such as answer to your question.

shentongmartin avatar Feb 11 '25 03:02 shentongmartin

@SallyKAN did you ever find a way to do Human in the loop with eino? I'm currently wondering the same thing and haven't been able to come up with a clear solution.

The two graph approach doesn't work because its not a pre-determined thing.

Use case. Certain tool calls elicit a human in the loop to review and approve the intent + tool before continuing

epuerta9 avatar May 03 '25 17:05 epuerta9

eino has supported checkpoint&interrupt, You can refer to this example: https://github.com/cloudwego/eino-examples/tree/main/compose/graph/react_with_interrupt

meguminnnnnnnnn avatar May 12 '25 07:05 meguminnnnnnnnn

original requirement should be fulfilled. Closing the issue.

shentongmartin avatar Aug 28 '25 08:08 shentongmartin