Vanilla agents for GraphAI.
yarn add @graphai/vanilla
import { GraphAI } from "graphai";
import {
arrayFlatAgent,
arrayJoinAgent,
arrayToObjectAgent,
compareAgent,
consoleAgent,
copy2ArrayAgent,
copyAgent,
copyMessageAgent,
countingAgent,
dataSumTemplateAgent,
dotProductAgent,
echoAgent,
images2messageAgent,
jsonParserAgent,
lookupDictionaryAgent,
mapAgent,
mergeNodeIdAgent,
mergeObjectAgent,
nestedAgent,
popAgent,
propertyFilterAgent,
pushAgent,
shiftAgent,
sleeperAgent,
sortByValuesAgent,
streamMockAgent,
stringCaseVariantsAgent,
stringEmbeddingsAgent,
stringSplitterAgent,
stringTemplateAgent,
stringUpdateTextAgent,
totalAgent,
vanillaFetchAgent
} from "@graphai/vanilla";
const agents = {
arrayFlatAgent,
arrayJoinAgent,
arrayToObjectAgent,
compareAgent,
consoleAgent,
copy2ArrayAgent,
copyAgent,
copyMessageAgent,
countingAgent,
dataSumTemplateAgent,
dotProductAgent,
echoAgent,
images2messageAgent,
jsonParserAgent,
lookupDictionaryAgent,
mapAgent,
mergeNodeIdAgent,
mergeObjectAgent,
nestedAgent,
popAgent,
propertyFilterAgent,
pushAgent,
shiftAgent,
sleeperAgent,
sortByValuesAgent,
streamMockAgent,
stringCaseVariantsAgent,
stringEmbeddingsAgent,
stringSplitterAgent,
stringTemplateAgent,
stringUpdateTextAgent,
totalAgent,
vanillaFetchAgent
};
const graph = new GraphAI(graph_data, agents);
const result = await graph.run();
- arrayFlatAgent - Array Flat Agent
- arrayJoinAgent - Array Join Agent
- arrayToObjectAgent - Array To Object Agent
- compareAgent - compare
- consoleAgent - Just text to console.info
- copy2ArrayAgent - Copy2Array agent
- copyAgent - Returns namedInputs
- copyMessageAgent - CopyMessage agent
- countingAgent - Counting agent
- dataSumTemplateAgent - Returns the sum of input values
- dotProductAgent - dotProduct Agent
- echoAgent - Echo agent
- images2messageAgent - Returns the message data for llm include image
- jsonParserAgent - Template agent
- lookupDictionaryAgent - Select elements with params
- mapAgent - Map Agent
- mergeNodeIdAgent - merge node id agent
- mergeObjectAgent - Returns namedInputs
- nestedAgent - nested Agent
- popAgent - Pop Agent
- propertyFilterAgent - Filter properties based on property name either with 'include', 'exclude', 'alter', 'swap', 'inject', 'inspect'
- pushAgent - push Agent
- shiftAgent - shift Agent
- sleeperAgent - sleeper Agent for test and debug
- sortByValuesAgent - sortByValues Agent
- streamMockAgent - Stream mock agent
- stringCaseVariantsAgent - Format String Cases agent
- stringEmbeddingsAgent - Embeddings Agent
- stringSplitterAgent - This agent strip one long string into chunks using following parameters
- stringTemplateAgent - Template agent
- stringUpdateTextAgent -
- totalAgent - Returns the sum of input values
- vanillaFetchAgent - Retrieves JSON data from the specified URL
- arrayFlatAgent
- arrayJoinAgent
- arrayToObjectAgent
- compareAgent
- consoleAgent
- copy2ArrayAgent
- copyAgent
- copyMessageAgent
- countingAgent
- dataSumTemplateAgent
- dotProductAgent
- echoAgent
- images2messageAgent
- jsonParserAgent
- lookupDictionaryAgent
- mapAgent
- mergeNodeIdAgent
- mergeObjectAgent
- nestedAgent
- popAgent
- propertyFilterAgent
- pushAgent
- shiftAgent
- sleeperAgent
- sortByValuesAgent
- streamMockAgent
- stringCaseVariantsAgent
- stringEmbeddingsAgent
- stringSplitterAgent
- stringTemplateAgent
- stringUpdateTextAgent
- totalAgent
- vanillaFetchAgent
- arrayFlatAgent
- inputs
- array(array)
- The array to be flattened
- array(array)
- params
- depth(number)
- flattening depth
- depth(number)
- inputs
{
"inputs": {
"array": [
[
1
],
[
2
],
[
3
]
]
},
"params": {}
}
{
"inputs": {
"array": [
[
1
],
[
2
],
[
[
3
]
]
]
},
"params": {}
}
{
"inputs": {
"array": [
[
1
],
[
2
],
[
[
3
]
]
]
},
"params": {
"depth": 2
}
}
{
"inputs": {
"array": [
[
"a"
],
[
"b"
],
[
"c"
]
]
},
"params": {}
}
- arrayJoinAgent
- inputs
- array(array)
- array join
- array(array)
- params
- separator(string)
- array join separator
- flat(number)
- array flat depth
- separator(string)
- inputs
{
"inputs": {
"array": [
[
1
],
[
2
],
[
3
]
]
},
"params": {}
}
{
"inputs": {
"array": [
[
1
],
[
2
],
[
[
3
]
]
]
},
"params": {}
}
{
"inputs": {
"array": [
[
"a"
],
[
"b"
],
[
"c"
]
]
},
"params": {}
}
{
"inputs": {
"array": [
[
1
],
[
2
],
[
3
]
]
},
"params": {
"separator": "|"
}
}
{
"inputs": {
"array": [
[
[
1
]
],
[
[
2
],
[
3
]
]
]
},
"params": {
"separator": "|"
}
}
{
"inputs": {
"array": [
[
[
1
]
],
[
[
2
],
[
3
]
]
]
},
"params": {
"separator": "|",
"flat": 1
}
}
{
"inputs": {
"array": [
[
[
[
1
]
],
[
[
2
],
[
3
]
]
]
]
},
"params": {
"separator": "|",
"flat": 1
}
}
{
"inputs": {
"array": [
[
[
[
1
]
],
[
[
2
],
[
3
]
]
]
]
},
"params": {
"separator": "|",
"flat": 2
}
}
- arrayToObjectAgent
- inputs
- items(array)
- the array to pop an item from
- items(array)
- inputs
{
"inputs": {
"items": [
{
"id": 1,
"data": "a"
},
{
"id": 2,
"data": "b"
}
]
},
"params": {
"key": "id"
}
}
- compareAgent
- inputs
- array(array)
- A 3-element array in the form [leftOperand, operator, rightOperand]. Used for direct comparison logic.
- leftValue(string,number,boolean)
- Left-hand operand used when 'array' is not provided. Used with 'rightValue' and 'params.operator'.
- rightValue(string,number,boolean)
- Right-hand operand used when 'array' is not provided. Used with 'leftValue' and 'params.operator'.
- array(array)
- params
- operator(string)
- The comparison operator to apply, such as '==', '!=', '>', '>=', '<', '<=', '||', '&&', or 'XOR'. Required if 'array' does not include the operator.
- value(object)
- An optional mapping for the comparison result. If provided, it must contain keys 'true' and/or 'false' to return custom values instead of booleans.
- operator(string)
- inputs
{
"inputs": {
"array": [
"abc",
"==",
"abc"
]
},
"params": {
"value": {
"true": "a",
"false": "b"
}
}
}
{
"inputs": {
"array": [
"abc",
"==",
"abca"
]
},
"params": {
"value": {
"true": "a",
"false": "b"
}
}
}
{
"inputs": {
"array": [
"abc",
"==",
"abc"
]
},
"params": {}
}
{
"inputs": {
"array": [
"abc",
"==",
"abcd"
]
},
"params": {}
}
{
"inputs": {
"array": [
"abc",
"!=",
"abc"
]
},
"params": {}
}
{
"inputs": {
"array": [
"abc",
"!=",
"abcd"
]
},
"params": {}
}
{
"inputs": {
"array": [
"10",
">",
"5"
]
},
"params": {}
}
{
"inputs": {
"array": [
"10",
">",
"15"
]
},
"params": {}
}
{
"inputs": {
"array": [
10,
">",
5
]
},
"params": {}
}
{
"inputs": {
"array": [
10,
">",
15
]
},
"params": {}
}
{
"inputs": {
"array": [
"10",
">=",
"5"
]
},
"params": {}
}
{
"inputs": {
"array": [
"10",
">=",
"10"
]
},
"params": {}
}
{
"inputs": {
"array": [
"10",
">=",
"19"
]
},
"params": {}
}
{
"inputs": {
"array": [
10,
">=",
5
]
},
"params": {}
}
{
"inputs": {
"array": [
10,
">=",
10
]
},
"params": {}
}
{
"inputs": {
"array": [
10,
">=",
19
]
},
"params": {}
}
{
"inputs": {
"array": [
"10",
"<",
"5"
]
},
"params": {}
}
{
"inputs": {
"array": [
"10",
"<",
"15"
]
},
"params": {}
}
{
"inputs": {
"array": [
10,
"<",
5
]
},
"params": {}
}
{
"inputs": {
"array": [
10,
"<",
15
]
},
"params": {}
}
{
"inputs": {
"array": [
"10",
"<=",
"5"
]
},
"params": {}
}
{
"inputs": {
"array": [
"10",
"<=",
"10"
]
},
"params": {}
}
{
"inputs": {
"array": [
"10",
"<=",
"19"
]
},
"params": {}
}
{
"inputs": {
"array": [
10,
"<=",
5
]
},
"params": {}
}
{
"inputs": {
"array": [
10,
"<=",
10
]
},
"params": {}
}
{
"inputs": {
"array": [
10,
"<=",
19
]
},
"params": {}
}
{
"inputs": {
"array": [
true,
"||",
false
]
},
"params": {}
}
{
"inputs": {
"array": [
false,
"||",
false
]
},
"params": {}
}
{
"inputs": {
"array": [
true,
"&&",
false
]
},
"params": {}
}
{
"inputs": {
"array": [
true,
"&&",
true
]
},
"params": {}
}
{
"inputs": {
"array": [
true,
"XOR",
false
]
},
"params": {}
}
{
"inputs": {
"array": [
false,
"XOR",
true
]
},
"params": {}
}
{
"inputs": {
"array": [
false,
"XOR",
false
]
},
"params": {}
}
{
"inputs": {
"array": [
true,
"XOR",
true
]
},
"params": {}
}
{
"inputs": {
"array": [
[
"aaa",
"==",
"aaa"
],
"||",
[
"aaa",
"==",
"bbb"
]
]
},
"params": {}
}
{
"inputs": {
"array": [
[
"aaa",
"==",
"aaa"
],
"&&",
[
"aaa",
"==",
"bbb"
]
]
},
"params": {}
}
{
"inputs": {
"array": [
[
[
"aaa",
"==",
"aaa"
],
"&&",
[
"bbb",
"==",
"bbb"
]
],
"||",
[
"aaa",
"&&",
"bbb"
]
]
},
"params": {}
}
{
"inputs": {
"array": [
"abc",
"abc"
]
},
"params": {
"value": {
"true": "a",
"false": "b"
},
"operator": "=="
}
}
{
"inputs": {
"array": [
"abc",
"abca"
]
},
"params": {
"value": {
"true": "a",
"false": "b"
},
"operator": "=="
}
}
{
"inputs": {
"array": [
"abc",
"abc"
]
},
"params": {
"operator": "=="
}
}
{
"inputs": {
"array": [
"abc",
"abcd"
]
},
"params": {
"operator": "=="
}
}
{
"inputs": {
"array": [
"abc",
"abc"
]
},
"params": {
"operator": "!="
}
}
{
"inputs": {
"array": [
"abc",
"abcd"
]
},
"params": {
"operator": "!="
}
}
{
"inputs": {
"array": [
"10",
"5"
]
},
"params": {
"operator": ">"
}
}
{
"inputs": {
"array": [
"10",
"15"
]
},
"params": {
"operator": ">"
}
}
{
"inputs": {
"array": [
10,
5
]
},
"params": {
"operator": ">"
}
}
{
"inputs": {
"array": [
10,
15
]
},
"params": {
"operator": ">"
}
}
{
"inputs": {
"array": [
"10",
"5"
]
},
"params": {
"operator": ">="
}
}
{
"inputs": {
"array": [
"10",
"10"
]
},
"params": {
"operator": ">="
}
}
{
"inputs": {
"array": [
"10",
"19"
]
},
"params": {
"operator": ">="
}
}
{
"inputs": {
"array": [
10,
5
]
},
"params": {
"operator": ">="
}
}
{
"inputs": {
"array": [
10,
10
]
},
"params": {
"operator": ">="
}
}
{
"inputs": {
"array": [
10,
19
]
},
"params": {
"operator": ">="
}
}
{
"inputs": {
"array": [
"10",
"5"
]
},
"params": {
"operator": "<"
}
}
{
"inputs": {
"array": [
"10",
"15"
]
},
"params": {
"operator": "<"
}
}
{
"inputs": {
"array": [
10,
5
]
},
"params": {
"operator": "<"
}
}
{
"inputs": {
"array": [
10,
15
]
},
"params": {
"operator": "<"
}
}
{
"inputs": {
"array": [
true,
false
]
},
"params": {
"operator": "||"
}
}
{
"inputs": {
"array": [
false,
false
]
},
"params": {
"operator": "||"
}
}
{
"inputs": {
"array": [
true,
false
]
},
"params": {
"operator": "&&"
}
}
{
"inputs": {
"array": [
true,
true
]
},
"params": {
"operator": "&&"
}
}
{
"inputs": {
"array": [
true,
false
]
},
"params": {
"operator": "XOR"
}
}
{
"inputs": {
"array": [
false,
true
]
},
"params": {
"operator": "XOR"
}
}
{
"inputs": {
"array": [
false,
false
]
},
"params": {
"operator": "XOR"
}
}
{
"inputs": {
"array": [
true,
true
]
},
"params": {
"operator": "XOR"
}
}
{
"inputs": {
"leftValue": "abc",
"rightValue": "abc"
},
"params": {
"value": {
"true": "a",
"false": "b"
},
"operator": "=="
}
}
{
"inputs": {
"leftValue": "abc",
"rightValue": "abca"
},
"params": {
"value": {
"true": "a",
"false": "b"
},
"operator": "=="
}
}
- consoleAgent
- inputs
- text(string)
- text
- text(string)
- inputs
{
"inputs": {
"text": "hello"
},
"params": {}
}
- copy2ArrayAgent
- inputs
- item(undefined)
- The item to be copied into each element of the resulting array.
- item(undefined)
- params
- count(integer)
- The number of times to copy the input item into the output array.
- count(integer)
- inputs
{
"inputs": {
"item": {
"message": "hello"
}
},
"params": {
"count": 10
}
}
{
"inputs": {
"message": "hello"
},
"params": {
"count": 10
}
}
{
"inputs": {
"item": "hello"
},
"params": {
"count": 10
}
}
- copyAgent
-
inputs
-
params
- namedKey(string)
- If specified, the agent will return only the value associated with this key from namedInputs.
- namedKey(string)
-
{
"inputs": {
"color": "red",
"model": "Model 3"
},
"params": {}
}
{
"inputs": {
"array": [
"Hello World",
"Discarded"
]
},
"params": {}
}
{
"inputs": {
"color": "red",
"model": "Model 3"
},
"params": {
"namedKey": "color"
}
}
- copyMessageAgent
-
inputs
-
params
- count(integer)
- The number of times the message should be duplicated in the array.
- message(string)
- The message string to be repeated.
- count(integer)
-
{
"inputs": {},
"params": {
"count": 4,
"message": "hello"
}
}
- countingAgent
-
inputs
-
params
- count(integer)
- The number of integers to generate, starting from 0 up to count - 1.
- count(integer)
-
{
"inputs": {},
"params": {
"count": 4
}
}
- dataSumTemplateAgent
- inputs
- array(array)
- the array of numbers to calculate the sum of
- array(array)
- inputs
{
"inputs": {
"array": [
1
]
},
"params": {}
}
{
"inputs": {
"array": [
1,
2
]
},
"params": {}
}
{
"inputs": {
"array": [
1,
2,
3
]
},
"params": {}
}
{
"inputs": {
"array": [
1
]
},
"params": {
"flatResponse": true
}
}
{
"inputs": {
"array": [
1,
2
]
},
"params": {
"flatResponse": true
}
}
{
"inputs": {
"array": [
1,
2,
3
]
},
"params": {
"flatResponse": true
}
}
- dotProductAgent
- inputs
- matrix(array)
- A two-dimensional array of numbers. Each inner array represents a vector to be compared.
- vector(array)
- A single vector of numbers to compute dot products with each vector in the matrix.
- matrix(array)
- params
- inputs
{
"inputs": {
"matrix": [
[
1,
2
],
[
3,
4
],
[
5,
6
]
],
"vector": [
3,
2
]
},
"params": {}
}
{
"inputs": {
"matrix": [
[
1,
2
],
[
2,
3
]
],
"vector": [
1,
2
]
},
"params": {}
}
- echoAgent
-
inputs
-
params
- filterParams(boolean)
- If true, returns 'filterParams' instead of the full 'params'.
- filterParams(boolean)
-
{
"inputs": {},
"params": {
"text": "this is test"
}
}
{
"inputs": {},
"params": {
"text": "If you add filterParams option, it will respond to filterParams",
"filterParams": true
}
}
- images2messageAgent
- inputs
- array(array)
- An array of base64-encoded image data strings or image URLs. These will be converted into OpenAI Vision-compatible image message format.
- prompt(string)
- Optional prompt text to include as the first message content before images.
- array(array)
- params
- imageType(string)
- The type of image input: 'png', 'jpg', etc. for base64, or 'http' for image URLs.
- detail(string)
- The level of image detail requested by the model (e.g., 'auto', 'low', 'high'). Optional.
- imageType(string)
- inputs
{
"inputs": {
"array": [
"abcabc",
"122123"
]
},
"params": {
"imageType": "png"
}
}
{
"inputs": {
"array": [
"abcabc",
"122123"
],
"prompt": "hello"
},
"params": {
"imageType": "jpg",
"detail": "high"
}
}
{
"inputs": {
"array": [
"http://example.com/1.jpg",
"http://example.com/2.jpg"
]
},
"params": {
"imageType": "http"
}
}
- jsonParserAgent
- inputs
- text(string)
- A JSON string, possibly embedded in a Markdown code block. If provided, it will be parsed into a data object.
- data(undefined)
- Raw data to be converted into a formatted JSON string in the 'text' output.
- text(string)
- params
- inputs
{
"inputs": {
"data": {
"apple": "red",
"lemon": "yellow"
}
},
"params": {}
}
{
"inputs": {
"text": "{\n \"apple\": \"red\",\n \"lemon\": \"yellow\"\n}"
},
"params": {}
}
{
"inputs": {
"text": "```\n{\"apple\":\"red\",\"lemon\":\"yellow\"}\n```"
},
"params": {}
}
{
"inputs": {
"text": "```json\n{\"apple\":\"red\",\"lemon\":\"yellow\"}\n```"
},
"params": {}
}
{
"inputs": {
"text": "```JSON\n{\"apple\":\"red\",\"lemon\":\"yellow\"}\n```"
},
"params": {}
}
- lookupDictionaryAgent
- inputs
- namedKey(string)
- The key to look up in the dictionary provided by 'params'.
- supressError(boolean)
- If true, prevents the agent from throwing an error when the key is missing in 'params'. Optional.
- namedKey(string)
- params
- inputs
{
"inputs": {
"namedKey": "openai"
},
"params": {
"openai": {
"model": "gpt4-o",
"temperature": 0.7
},
"groq": {
"model": "llama3-8b-8192",
"temperature": 0.6
},
"gemini": {
"model": "gemini-2.0-pro-exp-02-05",
"temperature": 0.7
}
}
}
{
"inputs": {
"namedKey": "gemini"
},
"params": {
"openai": {
"model": "gpt4-o",
"temperature": 0.7
},
"groq": {
"model": "llama3-8b-8192",
"temperature": 0.6
},
"gemini": {
"model": "gemini-2.0-pro-exp-02-05",
"temperature": 0.7
}
}
}
- mapAgent
{
"inputs": {
"rows": [
"apple",
"orange",
"banana",
"lemon"
],
"color": [
"red",
"orange",
"yellow",
"yellow"
]
},
"params": {
"compositeResult": true,
"expandKeys": [
"color"
]
}
}
{
"inputs": {
"rows": [
1,
2
]
},
"params": {}
}
{
"inputs": {
"rows": [
1,
2
]
},
"params": {
"rowKey": "myKey"
}
}
{
"inputs": {
"rows": [
"apple",
"orange",
"banana",
"lemon",
"melon",
"pineapple",
"tomato"
]
},
"params": {}
}
{
"inputs": {
"rows": [
{
"fruit": "apple"
},
{
"fruit": "orange"
}
]
},
"params": {}
}
{
"inputs": {
"rows": [
{
"fruit": "apple"
},
{
"fruit": "orange"
}
],
"name": "You",
"verb": "like"
},
"params": {}
}
{
"inputs": {
"rows": [
1,
2
]
},
"params": {
"resultAll": true
}
}
{
"inputs": {
"rows": [
1,
2
]
},
"params": {
"resultAll": true
}
}
{
"inputs": {
"rows": [
1,
2
]
},
"params": {
"compositeResult": true
}
}
{
"inputs": {
"rows": [
"apple",
"orange",
"banana",
"lemon",
"melon",
"pineapple",
"tomato"
]
},
"params": {
"compositeResult": true
}
}
{
"inputs": {
"rows": [
"apple",
"orange",
"banana",
"lemon",
"melon",
"pineapple",
"tomato"
]
},
"params": {
"compositeResult": true,
"compositeResultKey": "node2"
}
}
{
"inputs": {
"rows": [
1,
2
]
},
"params": {
"resultAll": true,
"compositeResult": true
}
}
{
"inputs": {
"rows": [
1,
2
]
},
"params": {
"resultAll": true,
"compositeResult": true
}
}
- mergeNodeIdAgent
- inputs
- array(array)
- An array of objects to be merged together into a single object. Each object represents a partial result or state.
- array(array)
- params
- inputs
{
"inputs": {
"array": [
{
"message": "hello"
}
]
},
"params": {}
}
- mergeObjectAgent
- inputs
- items(array)
- An array of objects whose key-value pairs will be merged into a single object. Later objects override earlier ones on key conflict.
- items(array)
- params
- inputs
{
"inputs": {
"items": [
{
"color": "red"
},
{
"model": "Model 3"
}
]
},
"params": {}
}
- nestedAgent
{
"inputs": {
"message": "hello"
},
"params": {}
}
{
"inputs": {
"message": "hello"
},
"params": {
"resultNodeId": "test"
}
}
{
"inputs": {
"loopCount": 5
},
"params": {
"resultNodeId": "test"
}
}
- popAgent
- inputs
- array(array)
- the array to pop an item from
- array(array)
- inputs
{
"inputs": {
"array": [
1,
2,
3
]
},
"params": {}
}
{
"inputs": {
"array": [
"a",
"b",
"c"
]
},
"params": {}
}
{
"inputs": {
"array": [
1,
2,
3
],
"array2": [
"a",
"b",
"c"
]
},
"params": {}
}
- propertyFilterAgent
- inputs
{
"inputs": {
"array": [
{
"color": "red",
"model": "Model 3",
"type": "EV",
"maker": "Tesla",
"range": 300
}
]
},
"params": {
"include": [
"color",
"model"
]
}
}
{
"inputs": {
"item": {
"color": "red",
"model": "Model 3",
"type": "EV",
"maker": "Tesla",
"range": 300
}
},
"params": {
"include": [
"color",
"model"
]
}
}
{
"inputs": {
"array": [
[
{
"color": "red",
"model": "Model 3",
"type": "EV",
"maker": "Tesla",
"range": 300
},
{
"color": "blue",
"model": "Model Y",
"type": "EV",
"maker": "Tesla",
"range": 400
}
],
"Tesla Motors"
]
},
"params": {
"include": [
"color",
"model"
]
}
}
{
"inputs": {
"array": [
[
{
"color": "red",
"model": "Model 3",
"type": "EV",
"maker": "Tesla",
"range": 300
},
{
"color": "blue",
"model": "Model Y",
"type": "EV",
"maker": "Tesla",
"range": 400
}
],
"Tesla Motors"
]
},
"params": {
"exclude": [
"color",
"model"
]
}
}
{
"inputs": {
"item": {
"color": "red",
"model": "Model 3",
"type": "EV",
"maker": "Tesla",
"range": 300
}
},
"params": {
"exclude": [
"color",
"model"
]
}
}
{
"inputs": {
"array": [
[
{
"color": "red",
"model": "Model 3",
"type": "EV",
"maker": "Tesla",
"range": 300
},
{
"color": "blue",
"model": "Model Y",
"type": "EV",
"maker": "Tesla",
"range": 400
}
],
"Tesla Motors"
]
},
"params": {
"alter": {
"color": {
"red": "blue",
"blue": "red"
}
}
}
}
{
"inputs": {
"item": {
"color": "red",
"model": "Model 3",
"type": "EV",
"maker": "Tesla",
"range": 300
}
},
"params": {
"alter": {
"color": {
"red": "blue",
"blue": "red"
}
}
}
}
{
"inputs": {
"array": [
[
{
"color": "red",
"model": "Model 3",
"type": "EV",
"maker": "Tesla",
"range": 300
},
{
"color": "blue",
"model": "Model Y",
"type": "EV",
"maker": "Tesla",
"range": 400
}
],
"Tesla Motors"
]
},
"params": {
"swap": {
"maker": "model"
}
}
}
{
"inputs": {
"item": {
"color": "red",
"model": "Model 3",
"type": "EV",
"maker": "Tesla",
"range": 300
}
},
"params": {
"swap": {
"maker": "model"
}
}
}
{
"inputs": {
"array": [
[
{
"color": "red",
"model": "Model 3",
"type": "EV",
"maker": "Tesla",
"range": 300
},
{
"color": "blue",
"model": "Model Y",
"type": "EV",
"maker": "Tesla",
"range": 400
}
],
"Tesla Motors"
]
},
"params": {
"inject": [
{
"propId": "maker",
"from": 1
}
]
}
}
{
"inputs": {
"array": [
[
{
"color": "red",
"model": "Model 3",
"type": "EV",
"maker": "Tesla",
"range": 300
},
{
"color": "blue",
"model": "Model Y",
"type": "EV",
"maker": "Tesla",
"range": 400
}
],
"Tesla Motors"
]
},
"params": {
"inject": [
{
"propId": "maker",
"from": 1,
"index": 0
}
]
}
}
{
"inputs": {
"array": [
[
{
"color": "red",
"model": "Model 3",
"type": "EV",
"maker": "Tesla",
"range": 300
},
{
"color": "blue",
"model": "Model Y",
"type": "EV",
"maker": "Tesla",
"range": 400
}
],
"Tesla Motors"
]
},
"params": {
"inspect": [
{
"propId": "isTesla",
"equal": "Tesla Motors"
},
{
"propId": "isGM",
"notEqual": "Tesla Motors",
"from": 1
}
]
}
}
- pushAgent
- inputs
- array(array)
- the array to push an item to
- item(undefined)
- the item push into the array
- items(array)
- items push into the array
- array(array)
- inputs
{
"inputs": {
"array": [
1,
2
],
"item": 3
},
"params": {}
}
{
"inputs": {
"array": [
true,
false
],
"item": false
},
"params": {}
}
{
"inputs": {
"array": [
{
"apple": 1
}
],
"item": {
"lemon": 2
}
},
"params": {}
}
{
"inputs": {
"array": [
{
"apple": 1
}
],
"items": [
{
"lemon": 2
},
{
"banana": 3
}
]
},
"params": {}
}
- shiftAgent
- inputs
- array(array)
- the array to shift an item from
- array(array)
- inputs
{
"inputs": {
"array": [
1,
2,
3
]
},
"params": {}
}
{
"inputs": {
"array": [
"a",
"b",
"c"
]
},
"params": {}
}
- sleeperAgent
-
inputs
-
params
- duration(number)
- Optional duration in milliseconds to pause execution before returning the input. Defaults to 10ms.
- duration(number)
-
{
"inputs": {},
"params": {
"duration": 1
}
}
{
"inputs": {
"array": [
{
"a": 1
},
{
"b": 2
}
]
},
"params": {
"duration": 1
}
}
- sortByValuesAgent
- inputs
- array(array)
- The array of items to be sorted. Each item will be paired with a corresponding numeric value from the 'values' array.
- values(array)
- An array of numeric values used to determine the sort order of the 'array' items. Must be the same length as 'array'.
- array(array)
- params
- assendant(boolean)
- If true, sorts in ascending order; otherwise, in descending order (default).
- assendant(boolean)
- inputs
{
"inputs": {
"array": [
"banana",
"orange",
"lemon",
"apple"
],
"values": [
2,
5,
6,
4
]
},
"params": {}
}
{
"inputs": {
"array": [
"banana",
"orange",
"lemon",
"apple"
],
"values": [
2,
5,
6,
4
]
},
"params": {
"assendant": true
}
}
- streamMockAgent
- inputs
{
"inputs": {},
"params": {
"message": "this is params test"
}
}
{
"inputs": {
"message": "this is named inputs test"
},
"params": {}
}
- stringCaseVariantsAgent
- inputs
- text(string)
- The input string to be transformed into various casing styles.
- text(string)
- params
- suffix(string)
- An optional suffix to append to the input string before transforming cases.
- suffix(string)
- inputs
{
"inputs": {
"text": "this is a pen"
},
"params": {}
}
{
"inputs": {
"text": "string case variants"
},
"params": {
"suffix": "agent"
}
}
- stringSplitterAgent
- inputs
- text(string)
- text to be chuncked
- text(string)
- inputs
{
"inputs": {
"text": "Here's to the crazy ones, the misfits, the rebels, the troublemakers, the round pegs in the square holes ... the ones who see things differently -- they're not fond of rules, and they have no respect for the status quo. ... You can quote them, disagree with them, glorify or vilify them, but the only thing you can't do is ignore them because they change things. ... They push the human race forward, and while some may see them as the crazy ones, we see genius, because the people who are crazy enough to think that they can change the world, are the ones who do."
},
"params": {
"chunkSize": 64
}
}
- stringTemplateAgent
-
inputs
-
params
- template(undefined)
- The template structure where placeholders like ${key} will be replaced with values from 'inputs'.
- template(undefined)
-
{
"inputs": {
"message1": "hello",
"message2": "test"
},
"params": {
"template": "${message1}: ${message2}"
}
}
{
"inputs": {
"message1": "hello",
"message2": "test"
},
"params": {
"template": [
"${message1}: ${message2}",
"${message2}: ${message1}"
]
}
}
{
"inputs": {
"message1": "hello",
"message2": "test"
},
"params": {
"template": {
"apple": "${message1}",
"lemon": "${message2}"
}
}
}
{
"inputs": {
"message1": "hello",
"message2": "test"
},
"params": {
"template": [
{
"apple": "${message1}",
"lemon": "${message2}"
}
]
}
}
{
"inputs": {
"message1": "hello",
"message2": "test"
},
"params": {
"template": {
"apple": "${message1}",
"lemon": [
"${message2}"
]
}
}
}
{
"inputs": {
"agent": "openAiAgent",
"row": "hello world",
"params": {
"text": "message"
}
},
"params": {
"template": {
"version": 0.5,
"nodes": {
"ai": {
"agent": "${agent}",
"isResult": true,
"params": "${params}",
"inputs": {
"prompt": "${row}"
}
}
}
}
}
}
- stringUpdateTextAgent
- inputs
- newText(string)
- The new text to use if provided and not empty.
- oldText(string)
- The fallback text used if 'newText' is empty or not provided.
- newText(string)
- params
- inputs
{
"inputs": {
"newText": "new",
"oldText": "old"
},
"params": {}
}
{
"inputs": {
"newText": "",
"oldText": "old"
},
"params": {}
}
{
"inputs": {},
"params": {}
}
{
"inputs": {
"oldText": "old"
},
"params": {}
}
- totalAgent
- inputs
- array(array)
- An array of objects or arrays of objects. Each inner object must have numeric values which will be aggregated by key.
- array(array)
- params
- flatResponse(boolean)
- If true, the result will be returned as a plain object (e.g., { a: 6 }); otherwise, wrapped in { data: {...} }.
- flatResponse(boolean)
- inputs
{
"inputs": {
"array": [
{
"a": 1
},
{
"a": 2
},
{
"a": 3
}
]
},
"params": {}
}
{
"inputs": {
"array": [
[
{
"a": 1,
"b": -1
},
{
"c": 10
}
],
[
{
"a": 2,
"b": -1
}
],
[
{
"a": 3,
"b": -2
},
{
"d": -10
}
]
]
},
"params": {}
}
{
"inputs": {
"array": [
{
"a": 1
}
]
},
"params": {}
}
{
"inputs": {
"array": [
{
"a": 1
},
{
"a": 2
}
]
},
"params": {}
}
{
"inputs": {
"array": [
{
"a": 1
},
{
"a": 2
},
{
"a": 3
}
]
},
"params": {}
}
{
"inputs": {
"array": [
{
"a": 1,
"b": 1
},
{
"a": 2,
"b": 2
},
{
"a": 3,
"b": 0
}
]
},
"params": {}
}
{
"inputs": {
"array": [
{
"a": 1
},
{
"a": 2,
"b": 2
},
{
"a": 3,
"b": 0
}
]
},
"params": {}
}
{
"inputs": {
"array": [
{
"a": 1
},
{
"a": 2
},
{
"a": 3
}
]
},
"params": {
"flatResponse": true
}
}
{
"inputs": {
"array": [
[
{
"a": 1,
"b": -1
},
{
"c": 10
}
],
[
{
"a": 2,
"b": -1
}
],
[
{
"a": 3,
"b": -2
},
{
"d": -10
}
]
]
},
"params": {
"flatResponse": true
}
}
{
"inputs": {
"array": [
{
"a": 1
}
]
},
"params": {
"flatResponse": true
}
}
{
"inputs": {
"array": [
{
"a": 1
},
{
"a": 2
}
]
},
"params": {
"flatResponse": true
}
}
{
"inputs": {
"array": [
{
"a": 1
},
{
"a": 2
},
{
"a": 3
}
]
},
"params": {
"flatResponse": true
}
}
{
"inputs": {
"array": [
{
"a": 1,
"b": 1
},
{
"a": 2,
"b": 2
},
{
"a": 3,
"b": 0
}
]
},
"params": {
"flatResponse": true
}
}
{
"inputs": {
"array": [
{
"a": 1
},
{
"a": 2,
"b": 2
},
{
"a": 3,
"b": 0
}
]
},
"params": {
"flatResponse": true
}
}
- vanillaFetchAgent
- inputs
- url(string)
- The request URL. Can be provided in either 'inputs' or 'params'.
- method(string)
- The HTTP method to use (GET, POST, PUT, etc.). Defaults to GET if not specified and no body is provided; otherwise POST.
- headers(object)
- Optional HTTP headers to include in the request. Values from both inputs and params are merged.
- queryParams(object)
- Optional query parameters to append to the URL.
- body(undefined)
- Optional request body to send with POST, PUT, or PATCH methods.
- url(string)
- params
- url(string)
- The request URL (overridden if also specified in inputs).
- method(string)
- The HTTP method (overridden if also specified in inputs).
- headers(object)
- Additional headers. Merged with inputs.headers.
- queryParams(object)
- Query parameters to append to the URL.
- body(undefined)
- Request body to be sent, used with POST/PUT/PATCH.
- debug(boolean)
- If true, returns the prepared request details instead of performing the actual fetch.
- supressError(boolean)
- If true, suppresses thrown errors and returns the error response instead.
- flatResponse(boolean)
- If true, returns the raw response. If false, wraps the response in an object with a 'data' key. Default is false.
- type(string)
- Response type to parse. Either 'json' or 'text'. Defaults to 'json'.
- url(string)
- inputs
{
"inputs": {
"url": "https://example.com",
"queryParams": {
"foo": "bar"
},
"headers": {
"x-myHeader": "secret"
}
},
"params": {
"debug": true
}
}
{
"inputs": {
"url": "https://example.com",
"body": {
"foo": "bar"
}
},
"params": {
"debug": true
}
}
{
"inputs": {
"url": "https://example.com",
"body": {
"foo": "bar"
},
"method": "PUT"
},
"params": {
"debug": true
}
}
{
"inputs": {
"url": "https://example.com",
"method": "options"
},
"params": {
"debug": true
}
}
{
"inputs": {},
"params": {
"url": "https://example.com",
"body": {
"foo": "bar"
},
"method": "PUT",
"debug": true
}
}
{
"inputs": {
"method": "DELETE",
"headers": {
"authentication": "bearer XXX"
}
},
"params": {
"url": "https://example.com",
"body": {
"foo": "bar"
},
"method": "PUT",
"headers": {
"Content-Type": "application/json"
},
"debug": true
}
}
{
"version": 0.5,
"nodes": {
"source": {
"value": {
"version": 0.5,
"loop": {
"count": 5
},
"nodes": {
"array": {
"value": [],
"update": ":reducer.array"
},
"item": {
"agent": "sleepAndMergeAgent",
"params": {
"duration": 10,
"value": "hello"
}
},
"reducer": {
"isResult": true,
"agent": "pushAgent",
"inputs": {
"array": ":array",
"item": ":item"
}
}
}
}
},
"nested": {
"agent": "nestedAgent",
"graph": ":source",
"isResult": true
}
}
}
{
"version": 0.5,
"nodes": {
"source": {
"value": "{\"version\":0.5,\"loop\":{\"count\":5},\"nodes\":{\"array\":{\"value\":[],\"update\":\":reducer.array\"},\"item\":{\"agent\":\"sleepAndMergeAgent\",\"params\":{\"duration\":10,\"value\":\"hello\"}},\"reducer\":{\"isResult\":true,\"agent\":\"pushAgent\",\"inputs\":{\"array\":\":array\",\"item\":\":item\"}}}}"
},
"parser": {
"agent": "jsonParserAgent",
"inputs": {
"text": ":source"
}
},
"nested": {
"agent": "nestedAgent",
"graph": ":parser.data",
"isResult": true
}
}
}
{
"version": 0.5,
"nodes": {
"source": {
"value": "```json\n{\"version\":0.5,\"loop\":{\"count\":5},\"nodes\":{\"array\":{\"value\":[],\"update\":\":reducer.array\"},\"item\":{\"agent\":\"sleepAndMergeAgent\",\"params\":{\"duration\":10,\"value\":\"hello\"}},\"reducer\":{\"isResult\":true,\"agent\":\"pushAgent\",\"inputs\":{\"array\":\":array\",\"item\":\":item\"}}}}\n```\n"
},
"parser": {
"agent": "jsonParserAgent",
"inputs": {
"text": ":source"
}
},
"nested": {
"agent": "nestedAgent",
"graph": ":parser.data",
"isResult": true
}
}
}
{
"version": 0.5,
"nodes": {
"source": {
"value": "Hello World"
},
"nestedNode": {
"agent": "nestedAgent",
"inputs": {
"inner0": ":source"
},
"isResult": true,
"graph": {
"nodes": {
"resultInner": {
"agent": "copyAgent",
"inputs": {
"text": ":inner0"
},
"isResult": true
}
}
}
}
}
}
{
"version": 0.5,
"nodes": {
"source": {
"value": "Hello World"
},
"nestedNode": {
"agent": "nestedAgent",
"inputs": {
"source": ":source"
},
"isResult": true,
"graph": {
"nodes": {
"result": {
"agent": "copyAgent",
"inputs": {
"text": ":source"
},
"isResult": true
}
}
}
}
}
}
{
"version": 0.5,
"nodes": {
"source": {
"value": {
"fruits": [
"apple",
"orange",
"banana",
"lemon",
"melon",
"pineapple",
"tomato"
]
}
},
"nestedNode": {
"agent": "mapAgent",
"inputs": {
"rows": ":source.fruits"
},
"graph": {
"version": 0.5,
"nodes": {
"node2": {
"agent": "stringTemplateAgent",
"params": {
"template": "I love ${m}."
},
"inputs": {
"m": ":row"
},
"isResult": true
}
}
},
"params": {
"compositeResult": true
}
},
"result": {
"agent": "sleepAndMergeAgent",
"inputs": {
"array": [
":nestedNode.node2"
]
},
"isResult": true
}
}
}
{
"version": 0.5,
"nodes": {
"source1": {
"value": [
"hello",
"hello2"
]
},
"nestedNode": {
"agent": "mapAgent",
"inputs": {
"rows": ":source1"
},
"graph": {
"version": 0.5,
"nodes": {
"node1": {
"agent": "copyAgent",
"params": {
"namedKey": "row"
},
"inputs": {
"row": ":row"
},
"isResult": true
}
}
},
"params": {
"compositeResult": true
}
},
"result": {
"agent": "copyAgent",
"params": {
"namedKey": "result"
},
"inputs": {
"result": [
":nestedNode.node1"
]
},
"isResult": true
}
}
}
{
"version": 0.5,
"nodes": {
"source1": {
"value": [
"hello",
"hello2"
]
},
"nestedNode": {
"agent": "mapAgent",
"inputs": {
"rows": ":source1"
},
"graph": {
"version": 0.5,
"nodes": {
"node1": {
"agent": "copyAgent",
"params": {
"namedKey": "row"
},
"inputs": {
"row": ":row"
},
"isResult": true
}
}
},
"params": {
"compositeResult": true
}
},
"result": {
"agent": "copyAgent",
"params": {
"namedKey": "result"
},
"inputs": {
"result": ":nestedNode.node1"
}
}
}
}
{
"version": 0.5,
"nodes": {
"source1": {
"value": [
"hello",
"hello2"
]
},
"nestedNode": {
"agent": "mapAgent",
"inputs": {
"rows": ":source1"
},
"graph": {
"version": 0.5,
"nodes": {
"node1": {
"agent": "copyAgent",
"params": {
"namedKey": "row"
},
"inputs": {
"row": ":row"
},
"isResult": true
}
}
},
"params": {
"compositeResult": true
}
},
"result": {
"agent": "copyAgent",
"params": {
"flat": 2,
"namedKey": "res"
},
"inputs": {
"res": ":nestedNode.node1"
}
}
}
}
{
"version": 0.5,
"loop": {
"count": 10
},
"nodes": {
"array": {
"value": [],
"update": ":reducer.array"
},
"item": {
"agent": "sleepAndMergeAgent",
"params": {
"duration": 10,
"value": "hello"
}
},
"reducer": {
"isResult": true,
"agent": "pushAgent",
"inputs": {
"array": ":array",
"item": ":item"
}
}
}
}
{
"version": 0.5,
"loop": {
"while": ":source"
},
"nodes": {
"source": {
"value": [
"orange",
"banana",
"lemon"
],
"update": ":popper.array"
},
"result": {
"value": [],
"update": ":reducer.array"
},
"popper": {
"inputs": {
"array": ":source"
},
"agent": "popAgent"
},
"reducer": {
"agent": "pushAgent",
"inputs": {
"array": ":result",
"item": ":popper.item"
}
}
}
}
{
"version": 0.5,
"nodes": {
"source": {
"value": "hello"
},
"parent": {
"agent": "nestedAgent",
"inputs": {
"source": ":source"
},
"isResult": true,
"graph": {
"loop": {
"count": 10
},
"nodes": {
"array": {
"value": [],
"update": ":reducer.array"
},
"item": {
"agent": "copyAgent",
"inputs": {
"value": ":source"
}
},
"reducer": {
"agent": "pushAgent",
"inputs": {
"array": ":array",
"item": ":item.value"
},
"isResult": true
}
}
}
}
}
}
{
"version": 0.5,
"nodes": {
"fruits": {
"value": [
"orange",
"banana",
"lemon"
]
},
"parent": {
"agent": "nestedAgent",
"isResult": true,
"inputs": {
"fruits": ":fruits"
},
"graph": {
"loop": {
"while": ":fruits"
},
"nodes": {
"fruits": {
"value": [],
"update": ":popper.array"
},
"result": {
"value": [],
"update": ":reducer.array",
"isResult": true
},
"popper": {
"inputs": {
"array": ":fruits"
},
"agent": "popAgent"
},
"reducer": {
"agent": "pushAgent",
"inputs": {
"array": ":result",
"item": ":popper.item"
}
}
}
}
}
}
}
{
"version": 0.5,
"nodes": {
"source": {
"value": "hello"
},
"parent": {
"agent": "nestedAgent",
"inputs": {
"inner_source": ":source"
},
"isResult": true,
"graph": {
"loop": {
"count": 10
},
"nodes": {
"array": {
"value": [],
"update": ":reducer.array"
},
"item": {
"agent": "copyAgent",
"inputs": {
"value": ":inner_source"
}
},
"reducer": {
"agent": "pushAgent",
"inputs": {
"array": ":array",
"item": ":item.value"
},
"isResult": true
}
}
}
}
}
}
{
"version": 0.5,
"nodes": {
"source": {
"value": {
"content": [
{
"level1": {
"level2": "hello1"
}
},
{
"level1": {
"level2": "hello2"
}
}
]
}
},
"mapNode": {
"agent": "mapAgent",
"inputs": {
"rows": ":source.content"
},
"graph": {
"version": 0.5,
"nodes": {
"workingMemory": {
"value": {}
},
"forked": {
"agent": "sleepAndMergeAgent",
"inputs": {
"array": [
":row.level1"
]
}
},
"forked2": {
"agent": "sleepAndMergeAgent",
"inputs": {
"array": [
":forked"
]
},
"isResult": true
}
}
},
"params": {
"compositeResult": true
}
},
"copyAgent": {
"agent": "copyAgent",
"params": {
"namedKey": "result"
},
"inputs": {
"result": [
":mapNode"
]
}
}
}
}
{
"version": 0.5,
"nodes": {
"echo": {
"agent": "echoAgent",
"params": {
"message": "hello"
}
},
"copyAgent": {
"agent": "copyAgent",
"params": {
"namedKey": "text"
},
"inputs": {
"text": [
":echo"
]
}
},
"copyAgent2": {
"agent": "copyAgent",
"params": {
"namedKey": "text"
},
"inputs": {
"text": [
":copyAgent.$0"
]
}
}
}
}
{
"version": 0.5,
"nodes": {
"echo": {
"agent": "echoAgent",
"params": {
"message": [
"hello",
"hello"
]
}
},
"mapNode": {
"agent": "mapAgent",
"inputs": {
"rows": ":echo.message"
},
"graph": {
"version": 0.5,
"nodes": {
"copyAgent": {
"agent": "copyAgent",
"params": {
"namedKey": "row"
},
"inputs": {
"row": ":row"
},
"isResult": true
}
}
},
"params": {
"compositeResult": true
}
},
"copyAgent2": {
"agent": "copyAgent",
"params": {
"namedKey": "array"
},
"inputs": {
"array": [
":mapNode.copyAgent"
]
}
}
}
}
{
"version": 0.5,
"nodes": {
"echo": {
"agent": "echoAgent",
"params": {
"message": [
"hello",
"hello"
]
}
},
"mapNode": {
"agent": "mapAgent",
"inputs": {
"rows": ":echo.message"
},
"graph": {
"version": 0.5,
"nodes": {
"copyAgent": {
"agent": "copyAgent",
"params": {
"namedKey": "row"
},
"inputs": {
"row": [
":row"
]
}
},
"copyAgent2": {
"agent": "copyAgent",
"params": {
"namedKey": "text"
},
"inputs": {
"text": ":copyAgent"
}
},
"copyAgent3": {
"agent": "copyAgent",
"params": {
"namedKey": "text"
},
"inputs": {
"text": ":copyAgent2.$0"
},
"isResult": true
}
}
},
"params": {
"compositeResult": true
}
},
"copyAgent4": {
"agent": "copyAgent",
"params": {
"namedKey": "text"
},
"inputs": {
"text": ":mapNode.copyAgent3"
}
}
}
}
{
"version": 0.5,
"nodes": {
"echo": {
"agent": "echoAgent",
"params": {
"message": [
"hello",
"hello"
]
}
},
"mapNode": {
"agent": "mapAgent",
"inputs": {
"rows": ":echo.message"
},
"graph": {
"version": 0.5,
"nodes": {
"copyAgent": {
"agent": "copyAgent",
"params": {
"namedKey": "row"
},
"inputs": {
"row": ":row"
}
},
"copyAgent2": {
"agent": "copyAgent",
"params": {
"namedKey": "array"
},
"inputs": {
"array": [
":copyAgent",
":row"
]
},
"isResult": true
}
}
},
"params": {
"compositeResult": true
}
},
"copyAgent3": {
"agent": "copyAgent",
"params": {
"namedKey": "text"
},
"inputs": {
"text": ":mapNode.copyAgent2"
}
}
}
}
{
"version": 0.5,
"nodes": {
"echo": {
"agent": "echoAgent",
"params": {
"message": "hello"
}
},
"copyAgent": {
"agent": "copyAgent",
"params": {
"namedKey": "array"
},
"inputs": {
"array": [
":echo",
":echo",
":echo"
]
}
},
"copyAgent2": {
"agent": "copyAgent",
"params": {
"namedKey": "array"
},
"inputs": {
"array": [
":copyAgent",
":copyAgent"
]
}
},
"copyAgent3": {
"agent": "copyAgent",
"params": {
"namedKey": "array"
},
"inputs": {
"array": [
":copyAgent2",
":copyAgent2"
]
}
}
}
}