In non-interactive sessions (scripts, Shiny apps, etc.), set a callback
function that will be called when the agent needs user input via
AskUserQuestion.
Arguments
- callback
A function that takes
questions(list matching the AskUserQuestion format). Each question hasquestion,header,options(list withlabelanddescription), andmultiSelect. Should return a named list mapping question text to selected label(s). For multi-select, join labels with ", ". Set to NULL to clear the callback.
Examples
if (FALSE) { # \dontrun{
# For a Shiny app:
set_ask_user_callback(function(questions) {
# Display questions in modal and collect answers
answers <- list()
for (q in questions) {
# Show q$question with q$options
# Collect user selection
answers[[q$question]] <- selected_label
}
answers
})
} # }