GraphAI - About anyInput
About anyInput
anyInput
is an option that allows the agent to execute as soon as one of the multiple inputs defined in inputs
arrives.
Normally, processing begins only after all inputs are available. However, with anyInput
, processing can begin as soon as the first input is available.
This is useful in cases where responsiveness is prioritized, or when partial data is sufficient for processing.
inputs: {
a: ":anode.data",
b: ":bnode.data",
c: ":cnode.data",
}
In a case like the above, if bnode
finishes execution first, the input will become:
inputs: {
b: ":bnode.data",
}
When using with arrays
inputs: {
array: [
":anode.data",
":bnode.data",
":cnode.data",
]
}
In a typical case, this would become:
inputs: {
array: [
undefined,
":bnode.data",
undefined,
]
}
Since this is inconvenient, GraphAI filters it to:
inputs: {
array: [
":bnode.data",
]
}
In cases like:
inputs: {
array: [
":bnode.array",
]
}
where an array is selected (commonly used in LLM messages), you may end up with an array within an array, which is inconvenient. In such cases, it's better to use arrayFlatAgent
.
Usually used with if / unless
Typically, you use a node with if
/ unless
to branch the data before using this.
Usage Example (Implementation Sample)

人工知能を活用したアプリケーションやサービスを活用し、内発的動機付けで行動するエンジニア、起業家、社会起業家をサポートするコミュニティーです。 singularitysociety.org Supported by 週刊 Life is beautiful
Discussion