Sets a callback that answers questions for every ask_user tool without its
own handler, including tool_ask_user. It is used instead of readline(),
even in interactive sessions. Because it is shared by the whole R process, it
can't tell concurrent agents or Shiny sessions apart; for those, give each
agent its own handler with tools_interactive().
Examples
if (FALSE) { # \dontrun{
# For a single-agent script: always pick the first option
set_ask_user_callback(function(questions) {
answers <- list()
for (q in questions) {
answers[[q$question]] <- q$options[[1]]$label
}
answers
})
} # }