node-red-contrib-ai-agent 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/orchestrator/orchestrator.js +5 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -126,10 +126,21 @@ Creates an HTTP request tool that can be used by the AI Agent to make external A
|
|
|
126
126
|
- **Headers**: JSON object of headers to include in the request
|
|
127
127
|
- **Body**: Content to send in the request body
|
|
128
128
|
|
|
129
|
+
Example: `https://api.example.com/users/${input.userId}`
|
|
130
|
+
|
|
129
131
|
**Template Variables:**
|
|
130
132
|
You can use template variables in the URL, headers, and body to reference properties from the input object that the AI provides when calling the tool.
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
### AI Tool Approval
|
|
135
|
+
Creates an approval tool that can be used by the AI Agent to request human intervention. When called, the agent's execution pauses until a human provides a response.
|
|
136
|
+
|
|
137
|
+
**Properties:**
|
|
138
|
+
- **Name**: Display name for the node
|
|
139
|
+
- **Tool Name**: Name of the tool (used by the AI to identify the tool)
|
|
140
|
+
- **Description**: Description of what the tool does (e.g., "Request approval for payments")
|
|
141
|
+
|
|
142
|
+
**Output 2 (Approval Request):** Sends a message with `msg.payload` containing the human question and `msg.approvalId` to be used for the response.
|
|
143
|
+
|
|
133
144
|
|
|
134
145
|
## Example: Basic Usage
|
|
135
146
|
|
|
@@ -91,7 +91,9 @@ Return a JSON object with a "tasks" array. Each task should have:
|
|
|
91
91
|
- "input": detailed instruction for the agent
|
|
92
92
|
- "status": "pending"
|
|
93
93
|
- "priority": a number (1-10, default 5)
|
|
94
|
-
- "dependsOn": an array of IDs of tasks that must be completed BEFORE this task can start (empty array if none)
|
|
94
|
+
- "dependsOn": an array of IDs of tasks that must be completed BEFORE this task can start (empty array if none)
|
|
95
|
+
|
|
96
|
+
Note: You can use "human_approval" as a task type if you need a human to verify something before proceeding.`;
|
|
95
97
|
|
|
96
98
|
if (strategy === 'advanced') {
|
|
97
99
|
prompt += `\n\nThink about parallel execution. Group related tasks and identify bottlenecks. Ensure dependencies are logical.`;
|
|
@@ -148,7 +150,8 @@ Last Task ${isError ? 'Error' : 'Result'}: ${JSON.stringify(isError ? msg.error
|
|
|
148
150
|
Evaluate the progress.
|
|
149
151
|
1. If the last task failed, propose a recovery strategy (retry, alternative task, or fail the goal).
|
|
150
152
|
2. If the goal is achieved, set status to "completed".
|
|
151
|
-
3.
|
|
153
|
+
3. If you need more information or approval from a human, add a task with type "human_approval".
|
|
154
|
+
4. Otherwise, continue execution. You may refine the plan by adding, removing, or modifying tasks.
|
|
152
155
|
|
|
153
156
|
Return a JSON object:
|
|
154
157
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-ai-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "AI Agent for Node-RED",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"ai-tool-http": "./tool-http/ai-tool-http.js",
|
|
63
63
|
"ai-memory-file": "./memory-file/memory-file.js",
|
|
64
64
|
"ai-memory-inmem": "./memory-inmem/memory-inmem.js",
|
|
65
|
-
"ai-orchestrator": "./orchestrator/orchestrator.js"
|
|
65
|
+
"ai-orchestrator": "./orchestrator/orchestrator.js",
|
|
66
|
+
"ai-tool-approval": "./tool-approval/ai-tool-approval.js"
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
}
|