Nodes Specifications
interface Node {
id: string; // Auto-generated by the API.
entrypoints: {
intents: string[]; // List of intents that trigger the node.
nodes?: NodeId[]; // List of IDs of Node that are allowed to enter this node. If specified, then this node cannot be entered unless the agent is at one of the specified nodes.
};
contents: {
rephrase?: boolean; // If true, the selected text will be rephrased by the agent, without any other context, to avoid repetition but to keep a general idea. Require text or texts. Prevents usage of tools.
text?: string; // A text that will be returned verbatim by the agent. Prevents usage of tools.
texts?: string[]; // If using texts instead of text, the agent will randomly select one of the texts to return. Prevents usage of tools.
instructions?: string; // Instructions for the agent to follow when handling the message in this node.
/**
* Configuration of specific tools for this node.
*/
tools?: {
/**
* Prevent the agent from using any tools other than those listed when at this node.
* Any tools marked as `restricted` listed in `exclusive` will be allowed as well (even if not specified in the `allowed` array).
*/
exclusive?: string[];
/**
* Prevent the agent from using the tools listed when at this node.
*/
forbidden?: string[];
/**
* By default, tools marked as `restricted` cannot be used by the agent. If a tool is listed in the `allowed` array, the agent can use it when at this node.
*/
allowed: string[];
},
suggestions?: { // Prevents AI generation of suggestions and will return the listed static suggestions instead.
id: string; // Unique ID of the suggestion.
text: string; // Text of the suggestion to be return to the user.
}[];
};
exits: {
nodes: NodeId[];
/**
* Will force the brain to choose one of the nodes in the nodes array, or default to the defaultExitNode.
*/
forceNodes: boolean;
/**
* If forceNode is true, and no node intent match from the nodes array, the defaultExitNode will be used.
* The node must be listed in the nodes array.
*/
defaultExitNode?: NodeId;
/**
* Add requirements to allow leaving the node. As long as the requirements are not met, the agent will not continue forward and will remain at this node
* attempting to fulfill the requirements, staying into a loop.
*/
requirements: {
maxIterations: 5, // Maximum number of iterations to perform before the agent is forced to abandon the node.
/**
* If the maxIterations is reached without satisfying the requirements, the agent will be forced to go to the onFailure node.
* The onFailure node doesn't have to be listed in the exits nodes array.
*/
onFailure: NodeId;
evaluation: {
instructions: string[]; // // A set of instructions to evaluate the requirements. If each instruction is satisfied (check by AI), the agent can leave the node.
}
},
};
}