requestInput

fun FlowCollector<Nothing>.requestInput(interruptId: String = Uuid.random(), message: String? = null, responseSchema: Schema? = null): Nothing

From a node's body, asks the user for input once per run and ends it. With rerunOnResume = true the body reruns and reads the answer from ctx.resumeInputs[interruptId]; ctx.resumeInputs[id] ?: requestInput(id) asks again on a null answer responseSchema allows. Otherwise the answer, checked against any responseSchema, is the node's output.

Catching the throw (runCatching, catch (t: Throwable)) cancels the request, and the rest of the body runs; catch (e: Exception) misses it. The receiver keeps it out of code that has no node flow, such as a tool.


inline fun <P> FlowCollector<Nothing>.requestInput(interruptId: String = Uuid.random(), message: String? = null, payload: P, responseSchema: Schema? = null): Nothing

Like the overload without a payload, and also sends payload in its JSON form under P's serializer, as Context.setOutput writes an output.

Throws

if P has no serializer or payload has no JSON form.