@loopstack/hitl-ask-user-example-workflow
Demonstrates how to prompt the user for free-text input from inside a workflow using the AskUserWorkflow from @loopstack/hitl. The user’s answer is captured and echoed back as an assistant message.
By using this example you’ll get…
- A parent workflow that launches
AskUserWorkflowas a sub-workflow with a callback - A concrete pattern for waiting on human input without blocking the worker
- An
AskUserDocumentrendered in the UI while the workflow is paused
Installation
npm install @loopstack/hitl-ask-user-example-workflowThe package depends on @loopstack/hitl.
How It Works
- The workflow starts and calls
AskUserWorkflow.run({ question })as a sub-workflow. - The sub-workflow renders an
AskUserDocumentand stops atwaiting_for_user. - When the user submits an answer, the sub-workflow finishes and the parent’s callback fires.
- The parent saves a
MessageDocumentwith the answer and ends.
Public API
HitlAskUserExampleModuleHitlAskUserExampleWorkflow
Dependencies
@loopstack/common@loopstack/hitl
Last updated on