node-red-contrib-ai-agent 0.4.0 → 0.5.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 CHANGED
@@ -19,6 +19,7 @@ Your feedback and contributions are highly appreciated!
19
19
  ## Features
20
20
 
21
21
  - **AI Agent Node**: Process messages with AI, maintaining conversation context
22
+ - **AI Agent Orchestrator Node**: Participates in orchestrated flows via Chain Discovery
22
23
  - **Memory Nodes**:
23
24
  - **In-Memory**: Store conversation context in memory (volatile)
24
25
  - **File-based**: Persist conversation context to disk
@@ -61,6 +62,14 @@ Processes messages using the configured AI model and maintains conversation cont
61
62
  - **System Prompt**: Initial instructions for the AI
62
63
  - **Response Type**: Format of the response (text or JSON object)
63
64
 
65
+ ### AI Agent Orchestrator
66
+ A specialized version of the AI Agent designed for multi-agent workflows. It "tags" messages in a pipeline so the **AI Orchestrator** can discover it.
67
+
68
+ **Properties:**
69
+ - **Name**: Display name for the node
70
+ - **Capabilities**: Comma-separated list of skills (e.g., `coding, research`)
71
+ - **System Prompt**: Instructions for this specific expert
72
+
64
73
  ### Memory (In-Memory)
65
74
  A configuration node that initializes the conversation context in memory. The agent node uses this configuration to manage the conversation context.
66
75
 
@@ -91,13 +100,13 @@ Configures the AI model and API settings.
91
100
  - **Name**: Display name for the node
92
101
 
93
102
  ### AI Orchestrator
94
- Coordinates multiple AI agents by creating and executing plans. It uses an autonomy loop (observe-think-act-reflect) to achieve complex goals.
103
+ Coordinates multiple AI agents by creating and executing plans. It uses **Chain Discovery** to identify available agents from its input message.
95
104
 
96
105
  **Key Features:**
106
+ - **Chain Discovery**: Implicitly discovers agents wired in a pipeline before it.
107
+ - **Zero-Wire Execution**: Calls discovered agents directly via code (no messy routing wires).
97
108
  - **Non-linear Planning**: Supports task dependencies (tasks wait for their predecessors).
98
- - **Task Prioritization**: Executes higher priority tasks first within dependency constraints.
99
- - **Dynamic Plan Revision**: Refines the plan based on task outcomes and agent feedback.
100
- - **Error Recovery**: Automatically handles task failures with recovery strategies (retry, pivot, or fail).
109
+ - **Error Recovery**: Automatically handles task failures with recovery strategies.
101
110
 
102
111
  **Properties:**
103
112
  - **Max Iterations**: Maximum cycles for the autonomy loop
@@ -186,17 +195,16 @@ For more complex scenarios, you can chain multiple agents to process messages in
186
195
 
187
196
  Each agent will maintain its own conversation context based on its memory configuration.
188
197
 
189
- ## Example: Autonomous Orchestration
198
+ ## Example: Autonomous Orchestration (Chain Discovery)
190
199
 
191
- The AI Orchestrator can manage complex, multi-step tasks:
200
+ The AI Orchestrator can manage complex, multi-step tasks by utilizing specialized agents in a pipeline:
192
201
 
193
- 1. Add an **AI Orchestrator** node
194
- 2. Connect its first output to an **AI Agent**
195
- 3. Connect the agent's output back to the **AI Orchestrator** input
196
- 4. Connect the orchestrator's second output to a **Debug** node
197
- 5. Configure the orchestrator with a goal (e.g., "Write a blog post and then translate it to Spanish")
202
+ 1. Add an **AI Orchestrator** node.
203
+ 2. Add one or more **AI Agent Orchestrator** nodes (e.g., "Coder", "Researcher").
204
+ 3. Connect them in a line: `[Inject Goal] --> [Coder] --> [Researcher] --> [Orchestrator] --> [Debug]`.
205
+ 4. The Orchestrator will automatically discover the "Coder" and "Researcher" via the message pipeline and call them as needed to achieve the goal.
198
206
 
199
- The orchestrator will create a plan (optionally with dependencies and priorities), dispatch the first available task to the agent, reflect on the result, and then dispatch the next task until completion. If a task fails, it can revise the plan to recover.
207
+ This linear architecture keeps your flows clean while allowing for powerful, multi-agent collaboration.
200
208
 
201
209
  ## Best Practices
202
210
 
@@ -1,96 +1,96 @@
1
- <script type="text/javascript">
2
- RED.nodes.registerType('ai-agent', {
3
- category: 'AI Agent',
4
- color: '#a6bbcf',
5
- defaults: {
6
- name: { value: '' },
7
- systemPrompt: {
8
- value: 'You are a helpful AI assistant.',
9
- required: true
10
- },
11
- responseType: {
12
- value: 'text',
13
- required: true,
14
- validate: function(val) {
15
- return ['text', 'object'].includes(val);
16
- }
17
- }
18
- },
19
- inputs: 1,
20
- outputs: 1,
21
- icon: 'agent/ai-agent-icon.svg',
22
- label: function() {
23
- return this.name || 'AI Agent';
24
- },
25
- paletteLabel: 'AI Agent',
26
- oneditprepare: function() {
27
- // Always show OpenRouter help since we only support OpenRouter now
28
- $('#openrouter-help').show();
29
- }
30
- });
31
- </script>
32
-
33
- <!-- START: Template -->
34
- <script type="text/x-red" data-template-name="ai-agent">
35
- <div class="form-row">
36
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
37
- <input type="text" id="node-input-name" placeholder="AI Agent">
38
- </div>
39
-
40
- <div class="form-row">
41
- <label for="node-input-systemPrompt"><i class="fa fa-comment"></i> System Prompt</label>
42
- <textarea type="text" id="node-input-systemPrompt" placeholder="You are a helpful AI assistant." style="width: 100%; height: 80px; resize: vertical; font-family: monospace;"></textarea>
43
- </div>
44
-
45
- <div class="form-row">
46
- <label><i class="fa fa-robot"></i> AI Agent</label>
47
- <div class="form-tips" style="width: 70%;">
48
- <p>This node uses OpenRouter for AI responses. Connect an <b>AI Model</b> node to configure the model and API key.</p>
49
- </div>
50
- </div>
51
-
52
- <div class="form-row">
53
- <label for="node-input-responseType"><i class="fa fa-reply"></i> Response Format</label>
54
- <select id="node-input-responseType" style="width: 100%;">
55
- <option value="text">Text Only</option>
56
- <option value="object">Structured Object</option>
57
- </select>
58
- </div>
59
-
60
- <div id="openrouter-help" class="form-tips" style="display: none; margin-top: 15px; padding: 10px; background: #f8f9fa; border-radius: 4px; border-left: 3px solid #3b78e7;">
61
- <p><i class="fa fa-info-circle"></i> <strong>Note:</strong> When using OpenRouter, connect an AI Model node to provide the model and API key configuration.</p>
62
- <p>The AI Model node will add an <code>aiagent</code> property to the message with the required configuration.</p>
63
- </div>
64
- </script>
65
- <!-- END: Template -->
66
-
67
- <!-- START: Help -->
68
- <script type="text/x-red" data-help-name="ai-agent">
69
- <h3>AI Agent Node</h3>
70
- <p>An intelligent agent that processes and responds to messages with configurable behavior.</p>
71
-
72
- <h4>Features</h4>
73
- <ul>
74
- <li>Multiple agent types (Assistant, Chatbot)</li>
75
- <li>Configurable response formats</li>
76
- <li>Conversation context tracking</li>
77
- <li>Error handling and status reporting</li>
78
- </ul>
79
-
80
- <h4>Usage</h4>
81
- <ol>
82
- <li>Connect the node to a message source (e.g., HTTP input, inject node)</li>
83
- <li>Configure the agent type and response format</li>
84
- <li>Process the response in your flow</li>
85
- </ol>
86
-
87
- <h4>Output Formats</h4>
88
- <p><b>Text Only:</b> Simple string response</p>
89
- <p><b>Structured Object:</b> Detailed response including metadata and context</p>
90
-
91
- <h4>Examples</h4>
92
- <p><b>Input:</b> "Hello"</p>
93
- <p><b>Assistant Output:</b> "Hello! How can I assist you today?"</p>
94
- <p><b>Chatbot Output:</b> "Hi there! What would you like to chat about?"</p>
95
- </script>
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('ai-agent', {
3
+ category: 'AI Agent',
4
+ color: '#a6bbcf',
5
+ defaults: {
6
+ name: { value: '' },
7
+ systemPrompt: {
8
+ value: 'You are a helpful AI assistant.',
9
+ required: true
10
+ },
11
+ responseType: {
12
+ value: 'text',
13
+ required: true,
14
+ validate: function(val) {
15
+ return ['text', 'object'].includes(val);
16
+ }
17
+ }
18
+ },
19
+ inputs: 1,
20
+ outputs: 1,
21
+ icon: 'agent/ai-agent-icon.svg',
22
+ label: function() {
23
+ return this.name || 'AI Agent';
24
+ },
25
+ paletteLabel: 'AI Agent',
26
+ oneditprepare: function() {
27
+ // Always show OpenRouter help since we only support OpenRouter now
28
+ $('#openrouter-help').show();
29
+ }
30
+ });
31
+ </script>
32
+
33
+ <!-- START: Template -->
34
+ <script type="text/x-red" data-template-name="ai-agent">
35
+ <div class="form-row">
36
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
37
+ <input type="text" id="node-input-name" placeholder="AI Agent">
38
+ </div>
39
+
40
+ <div class="form-row">
41
+ <label for="node-input-systemPrompt"><i class="fa fa-comment"></i> System Prompt</label>
42
+ <textarea type="text" id="node-input-systemPrompt" placeholder="You are a helpful AI assistant." style="width: 100%; height: 80px; resize: vertical; font-family: monospace;"></textarea>
43
+ </div>
44
+
45
+ <div class="form-row">
46
+ <label><i class="fa fa-robot"></i> AI Agent</label>
47
+ <div class="form-tips" style="width: 70%;">
48
+ <p>This node uses OpenRouter for AI responses. Connect an <b>AI Model</b> node to configure the model and API key.</p>
49
+ </div>
50
+ </div>
51
+
52
+ <div class="form-row">
53
+ <label for="node-input-responseType"><i class="fa fa-reply"></i> Response Format</label>
54
+ <select id="node-input-responseType" style="width: 100%;">
55
+ <option value="text">Text Only</option>
56
+ <option value="object">Structured Object</option>
57
+ </select>
58
+ </div>
59
+
60
+ <div id="openrouter-help" class="form-tips" style="display: none; margin-top: 15px; padding: 10px; background: #f8f9fa; border-radius: 4px; border-left: 3px solid #3b78e7;">
61
+ <p><i class="fa fa-info-circle"></i> <strong>Note:</strong> When using OpenRouter, connect an AI Model node to provide the model and API key configuration.</p>
62
+ <p>The AI Model node will add an <code>aiagent</code> property to the message with the required configuration.</p>
63
+ </div>
64
+ </script>
65
+ <!-- END: Template -->
66
+
67
+ <!-- START: Help -->
68
+ <script type="text/x-red" data-help-name="ai-agent">
69
+ <h3>AI Agent Node</h3>
70
+ <p>An intelligent agent that processes and responds to messages with configurable behavior.</p>
71
+
72
+ <h4>Features</h4>
73
+ <ul>
74
+ <li>Multiple agent types (Assistant, Chatbot)</li>
75
+ <li>Configurable response formats</li>
76
+ <li>Conversation context tracking</li>
77
+ <li>Error handling and status reporting</li>
78
+ </ul>
79
+
80
+ <h4>Usage</h4>
81
+ <ol>
82
+ <li>Connect the node to a message source (e.g., HTTP input, inject node)</li>
83
+ <li>Configure the agent type and response format</li>
84
+ <li>Process the response in your flow</li>
85
+ </ol>
86
+
87
+ <h4>Output Formats</h4>
88
+ <p><b>Text Only:</b> Simple string response</p>
89
+ <p><b>Structured Object:</b> Detailed response including metadata and context</p>
90
+
91
+ <h4>Examples</h4>
92
+ <p><b>Input:</b> "Hello"</p>
93
+ <p><b>Assistant Output:</b> "Hello! How can I assist you today?"</p>
94
+ <p><b>Chatbot Output:</b> "Hi there! What would you like to chat about?"</p>
95
+ </script>
96
96
  <!-- END: Help -->