n8n-nodes-agentsearch 0.7.0 → 0.7.2

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
@@ -3,8 +3,8 @@
3
3
  n8n community node for [AgentSearch](https://agentsearchhq.com/?utm_source=n8n-nodes-agentsearch&utm_medium=package): live web search for workflows and AI agents.
4
4
 
5
5
  - **Free Search**: up to 5 results per call, 25 searches per day per IP, **no credentials**.
6
- - **Extract Page** (new in 0.3.0): read a page as clean markdown or text. $0.004 per call (x402, USDC on Base).
7
- - **Render Page** (new in 0.3.0): load a JavaScript-heavy page in a headless browser, then read it (markdown, text, HTML, links, optional screenshot). $0.010 per call.
6
+ - **Extract Page** (new in 0.3.0): read a page as clean markdown or text. $0.002 per call (x402, USDC on Base).
7
+ - **Render Page** (new in 0.3.0): load a JavaScript-heavy page in a headless browser, then read it (markdown, text, HTML, links, optional screenshot). $0.005 per call.
8
8
  - `usableAsTool`: all three work as tools for the n8n AI Agent node (search, then read the best page).
9
9
  - No runtime dependencies.
10
10
 
@@ -30,13 +30,13 @@ Output (default):
30
30
 
31
31
  If the daily free limit is reached (HTTP 429) the node fails with an explanation; enable *Continue On Fail* to keep the workflow running.
32
32
 
33
- **Hit the 429?** Extract (full page text) and Render (JS pages) are in this node at $0.004 / $0.010 per call: see below.
33
+ **Hit the 429?** Extract (full page text) and Render (JS pages) are in this node at $0.002 / $0.005 per call: see below.
34
34
 
35
35
  ## Extract and Render (read full pages)
36
36
 
37
37
  Search results are snippets. To read the page itself, set **Operation** to **Extract Page** (static pages, faster) or **Render Page** (JavaScript apps, or when Extract returns thin content) and give it a **URL**, e.g. `{{ $json.url }}` from a search result. On an AI Agent, add the node twice as tools: one Free Search, one Extract Page.
38
38
 
39
- Extract and Render are paid per call over [x402](https://x402.org) in USDC on Base, straight to **AgentSearch's own x402 API** (`https://api.agentsearchhq.com`): **Extract $0.004, Render $0.010**, charged only when a usable answer comes back. No account or API key:
39
+ Extract and Render are paid per call over [x402](https://x402.org) in USDC on Base, straight to **AgentSearch's own x402 API** (`https://api.agentsearchhq.com`): **Extract $0.002, Render $0.005**, charged only when a usable answer comes back. No account or API key:
40
40
 
41
41
  1. Make a **new wallet used only for this** and send it a little USDC on Base (for example $1 = about 100-250 calls). No ETH needed; the facilitator pays gas.
42
42
  2. In n8n, add an **AgentSearch Wallet API** credential with that wallet's private key. **Max Spend per Run** (default $1.00) caps what one run of the node can sign; each direct call is hard-capped at $0.020 (Pocket route $0.005).
@@ -46,15 +46,15 @@ The node only signs a payment in USDC on Base to AgentSearch's payee `0xC49B1578
46
46
 
47
47
  **New in 0.7.0: News Search and Screenshot, plus search filters.**
48
48
 
49
- - **News Search** ($0.008 per call, not charged when there are no results): recent news articles with headline, URL, snippet, source and publish date, 1-10 per call.
50
- - **Screenshot** ($0.010 per call, failed captures not charged): capture a page in a real headless browser as PNG or JPEG. The image is written to a binary property (default `data`) so you can pass it to an AI vision node, Slack, email or storage; the JSON keeps the metadata (final URL, title, size) without the base64.
49
+ - **News Search** ($0.005 per call, not charged when there are no results): recent news articles with headline, URL, snippet, source and publish date, 1-10 per call.
50
+ - **Screenshot** ($0.004 per call, failed captures not charged): capture a page in a real headless browser as PNG or JPEG. The image is written to a binary property (default `data`) so you can pass it to an AI vision node, Slack, email or storage; the JSON keeps the metadata (final URL, title, size) without the base64.
51
51
  - **Filters** on News Search and Search and Read: Freshness (past day/week/month/year) or a Date From/To range, Country, Language, and Include/Exclude Domains (comma-separated, up to 5).
52
52
 
53
- All three are direct x402 only (AgentSearch's own API on Base; not on Pocket, not on the free relay). Prices are unchanged elsewhere: Extract $0.004, Render $0.010, Search and Read $0.009.
53
+ All three are direct x402 only (AgentSearch's own API on Base; not on Pocket, not on the free relay). Prices are unchanged elsewhere: Extract $0.002, Render $0.005, Search and Read $0.005.
54
54
 
55
- **New in 0.6.0: Search and Read** — one paid operation that searches the live web and returns the top pages' text for **$0.009** (charged only when at least one page returns text; default 3 results, max 5). That is less than a $0.008 search plus three $0.004 extracts ($0.020), and one payment instead of four. Direct x402 only (not on Pocket, not on the free relay). The direct per-call ceiling is now $0.020.
55
+ **New in 0.6.0: Search and Read** — one paid operation that searches the live web and returns the top pages' text for **$0.005** (charged only when at least one page returns text; default 3 results, max 5). That is less than a $0.003 search plus three $0.002 extracts ($0.009), and one payment instead of four. Direct x402 only (not on Pocket, not on the free relay). The direct per-call ceiling is now $0.020.
56
56
 
57
- **Changed in 0.5.0: direct is the default Payment Route.** Credentials that don't pick a route now pay the direct prices (a little more than Pocket's $0.005). **Pocket route (optional):** set **Payment Route** to **Pocket Portal** to pay $0.005 per call through the Pocket Network Agentic Portal instead (hard cap $0.005, portal payee only, full Render options).
57
+ **Changed in 0.5.0: direct is the default Payment Route.** Credentials that don't pick a route now pay the direct prices (search $0.003, render $0.005, extract $0.002, screenshot $0.004; extract is a little under Pocket's $0.005). **Pocket route (optional):** set **Payment Route** to **Pocket Portal** to pay $0.005 per call through the Pocket Network Agentic Portal instead (hard cap $0.005, portal payee only, full Render options).
58
58
 
59
59
  Without a credential, Extract and Render try the AgentSearch free relay; if it has no free allowance for you, the node stops with setup instructions and nothing is paid. Free Search never uses the credential.
60
60
 
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AgentSearchWalletApi = void 0;
4
4
  /**
5
- * Wallet used to pay per call for Extract ($0.004) and Render ($0.010) in USDC on Base over x402,
5
+ * Wallet used to pay per call for Extract ($0.002) and Render ($0.005) in USDC on Base over x402,
6
6
  * by default to AgentSearch's own x402 API (Pocket portal route optional). Free Search never uses it.
7
7
  */
8
8
  class AgentSearchWalletApi {
@@ -26,7 +26,7 @@ class AgentSearchWalletApi {
26
26
  name: 'paymentRoute',
27
27
  type: 'options',
28
28
  options: [
29
- { name: 'AgentSearch Direct x402 (Extract $0.004, Render $0.010)', value: 'direct', description: "Pay AgentSearch's own x402 API on Base (api.agentsearchhq.com) (default)" },
29
+ { name: 'AgentSearch Direct x402 (Extract $0.002, Render $0.005)', value: 'direct', description: "Pay AgentSearch's own x402 API on Base (api.agentsearchhq.com) (default)" },
30
30
  { name: 'Pocket Portal ($0.005 per Call)', value: 'pocket', description: 'Pay through the Pocket Network Agentic Portal instead' },
31
31
  ],
32
32
  default: 'direct',
@@ -38,7 +38,7 @@ class AgentSearchWalletApi {
38
38
  type: 'number',
39
39
  typeOptions: { minValue: 0.005, numberPrecision: 3 },
40
40
  default: 1,
41
- description: 'Stop signing payments in one run of the node (one batch of items or one AI tool call) once this much USDC has been signed (default $1.00). Each call is capped at $0.005 on the Pocket route and $0.010 on the direct route.',
41
+ description: 'Stop signing payments in one run of the node (one batch of items or one AI tool call) once this much USDC has been signed (default $1.00). Each call is capped at $0.005 on the Pocket route and $0.020 on the direct route.',
42
42
  },
43
43
  ];
44
44
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DIRECT_OPS = exports.AgentSearch = exports.WALLET_SETUP = exports.PORTAL_SERVICES = exports.LIMIT_MESSAGE = exports.CLIENT_TAG = exports.PORTAL_URL = exports.RELAY_BASE_URL = exports.FREE_RELAY_URL = void 0;
3
+ exports.DIRECT_OPS = exports.AgentSearch = exports.WALLET_SETUP = exports.PORTAL_SERVICES = exports.QUERY_TOO_SHORT_MESSAGE = exports.MIN_QUERY_CHARS = exports.LIMIT_MESSAGE = exports.CLIENT_TAG = exports.PORTAL_URL = exports.RELAY_BASE_URL = exports.FREE_RELAY_URL = void 0;
4
4
  exports.paidOnlyMessage = paidOnlyMessage;
5
5
  exports.trialLimitMessage = trialLimitMessage;
6
6
  exports.filtersBody = filtersBody;
@@ -12,18 +12,20 @@ exports.PORTAL_URL = 'https://agent.pocket.network';
12
12
  exports.CLIENT_TAG = 'n8n-nodes-agentsearch/0.7.0';
13
13
  const DOCS = 'https://agentsearchhq.com/?utm_source=n8n-nodes-agentsearch&utm_medium=package';
14
14
  const GUIDE = 'https://agentsearchhq.com/blog/n8n-ai-agent-read-web-pages?utm_source=n8n-nodes-agentsearch&utm_medium=package';
15
- exports.LIMIT_MESSAGE = `Free AgentSearch limit reached (25 searches per day per IP; resets daily). For unlimited search plus extract (static pages) and render (JavaScript-heavy pages, or when extract returns thin content), use the paid API (AgentSearch's own x402 API on Base: Extract $0.004, Render $0.010 per call in USDC; Pocket route $0.005 optional). Docs: ${DOCS}`;
15
+ exports.LIMIT_MESSAGE = `Free AgentSearch limit reached (25 searches per day per IP; resets daily). For unlimited search plus extract (static pages) and render (JavaScript-heavy pages, or when extract returns thin content), use the paid API (AgentSearch's own x402 API on Base: Extract $0.002, Render $0.005 per call in USDC; Pocket route $0.005 optional). Docs: ${DOCS}`;
16
+ exports.MIN_QUERY_CHARS = 2;
17
+ exports.QUERY_TOO_SHORT_MESSAGE = 'Query must be at least 2 characters. Nothing was sent or charged.';
16
18
  exports.PORTAL_SERVICES = {
17
19
  extract: { serviceId: 'agentsearch-web-extract-v1', path: '/v1/extract' },
18
20
  render: { serviceId: 'agentsearch-web-render-v1', path: '/v1/render' },
19
21
  };
20
- exports.WALLET_SETUP = 'Add an "AgentSearch Wallet API" credential to this node: the private key of a NEW wallet made only for this, funded with a little USDC on Base (for example $1 = about 100-250 calls; no ETH needed). Each call is paid over x402 to AgentSearch\'s own API on Base (Extract $0.004, Render $0.010; failed calls are not charged), or $0.005 through the Pocket Network Agentic Portal if you pick that Payment Route. Free Search stays free and needs no credential. Guide: ' +
22
+ exports.WALLET_SETUP = 'Add an "AgentSearch Wallet API" credential to this node: the private key of a NEW wallet made only for this, funded with a little USDC on Base (for example $1 = about 100-250 calls; no ETH needed). Each call is paid over x402 to AgentSearch\'s own API on Base (Extract $0.002, Render $0.005; failed calls are not charged), or $0.005 through the Pocket Network Agentic Portal if you pick that Payment Route. Free Search stays free and needs no credential. Guide: ' +
21
23
  GUIDE;
22
24
  function paidOnlyMessage(op) {
23
- return `${op === 'extract' ? 'Extract' : 'Render'} is a paid operation (${op === 'extract' ? '$0.004' : '$0.010'} per call in USDC on Base via x402) and no wallet credential is set, so nothing was paid. ${exports.WALLET_SETUP}`;
25
+ return `${op === 'extract' ? 'Extract' : 'Render'} is a paid operation (${op === 'extract' ? '$0.002' : '$0.005'} per call in USDC on Base via x402) and no wallet credential is set, so nothing was paid. ${exports.WALLET_SETUP}`;
24
26
  }
25
27
  function trialLimitMessage(op) {
26
- return `Free ${op} allowance for today is used up. Continue at ${op === 'extract' ? '$0.004' : '$0.010'} per call (x402, USDC on Base): ${exports.WALLET_SETUP}`;
28
+ return `Free ${op} allowance for today is used up. Continue at ${op === 'extract' ? '$0.002' : '$0.005'} per call (x402, USDC on Base): ${exports.WALLET_SETUP}`;
27
29
  }
28
30
  const headerOf = (headers, name) => {
29
31
  const h = (headers ?? {});
@@ -53,7 +55,7 @@ class AgentSearch {
53
55
  group: ['transform'],
54
56
  version: 1,
55
57
  subtitle: '={{$parameter["operation"]}}',
56
- description: 'Free live web search for AI agents, plus News Search ($0.008), page Extract ($0.004), JavaScript Render ($0.010), Screenshot ($0.010), and Search + Read ($0.009) per call via x402',
58
+ description: 'Free live web search for AI agents, plus News Search ($0.003), page Extract ($0.002), JavaScript Render ($0.005), Screenshot ($0.004), and Search + Read ($0.005) per call via x402',
57
59
  defaults: { name: 'AgentSearch' },
58
60
  inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
59
61
  outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
@@ -78,31 +80,31 @@ class AgentSearch {
78
80
  name: 'Extract Page',
79
81
  value: 'extract',
80
82
  action: 'Extract a page as markdown',
81
- description: 'Read a page as clean markdown or text ($0.004 per call, wallet credential)',
83
+ description: 'Read a page as clean markdown or text ($0.002 per call, wallet credential)',
82
84
  },
83
85
  {
84
86
  name: 'Render Page',
85
87
  value: 'render',
86
88
  action: 'Render a dynamic page',
87
- description: 'Load a JavaScript-heavy page in a headless browser and read it ($0.010 per call, wallet credential)',
89
+ description: 'Load a JavaScript-heavy page in a headless browser and read it ($0.005 per call, wallet credential)',
88
90
  },
89
91
  {
90
92
  name: 'News Search',
91
93
  value: 'news',
92
94
  action: 'Search recent news',
93
- description: 'Recent news articles with date, source and snippet ($0.008 per call, not charged when no results; wallet credential; direct x402 only)',
95
+ description: 'Recent news articles with date, source and snippet ($0.003 per call, not charged when no results; wallet credential; direct x402 only)',
94
96
  },
95
97
  {
96
98
  name: 'Screenshot',
97
99
  value: 'screenshot',
98
100
  action: 'Take a screenshot of a page',
99
- description: 'Capture a page in a real headless browser as a PNG or JPEG binary ($0.010 per call, failed captures not charged; wallet credential; direct x402 only)',
101
+ description: 'Capture a page in a real headless browser as a PNG or JPEG binary ($0.004 per call, failed captures not charged; wallet credential; direct x402 only)',
100
102
  },
101
103
  {
102
104
  name: 'Search and Read',
103
105
  value: 'searchAndRead',
104
106
  action: 'Search and read top pages',
105
- description: 'Search the live web and return the top pages\' text in one paid call ($0.009, charged only when at least one page returns text; wallet credential; direct x402 only)',
107
+ description: 'Search the live web and return the top pages\' text in one paid call ($0.005, charged only when at least one page returns text; wallet credential; direct x402 only)',
106
108
  },
107
109
  ],
108
110
  default: 'freeSearch',
@@ -209,7 +211,7 @@ class AgentSearch {
209
211
  name: 'renderFallback',
210
212
  type: 'boolean',
211
213
  default: false,
212
- description: 'Whether to render at most one thin page in the same $0.009 call if extract returns little text',
214
+ description: 'Whether to render at most one thin page in the same $0.005 call if extract returns little text',
213
215
  displayOptions: { show: { operation: ['searchAndRead'] } },
214
216
  },
215
217
  {
@@ -349,7 +351,7 @@ class AgentSearch {
349
351
  return { status: 'Error', message: 'Max Spend per Run must be a positive number of USD.' };
350
352
  return {
351
353
  status: 'OK',
352
- message: `Valid key for wallet ${address}. Fund it with USDC on Base (no ETH needed); each Extract ($0.004) or Render ($0.010) call pays AgentSearch's x402 API ($0.005 on the Pocket route).`,
354
+ message: `Valid key for wallet ${address}. Fund it with USDC on Base (no ETH needed); each Extract ($0.002) or Render ($0.005) call pays AgentSearch's x402 API ($0.005 on the Pocket route).`,
353
355
  };
354
356
  },
355
357
  },
@@ -377,6 +379,8 @@ class AgentSearch {
377
379
  const query = this.getNodeParameter('query', i).trim();
378
380
  if (!query)
379
381
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Query is empty', { itemIndex: i });
382
+ if (query.length < exports.MIN_QUERY_CHARS)
383
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), exports.QUERY_TOO_SHORT_MESSAGE, { itemIndex: i });
380
384
  const maxResults = this.getNodeParameter('maxResults', i, 5);
381
385
  const split = this.getNodeParameter('split', i, false);
382
386
  let res;
@@ -395,6 +399,10 @@ class AgentSearch {
395
399
  const status = err?.httpCode ?? err?.response?.status ?? err?.statusCode;
396
400
  if (String(status) === '429')
397
401
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), exports.LIMIT_MESSAGE, { itemIndex: i });
402
+ const code = Number(status);
403
+ if (code >= 400 && code < 500 && code !== 408) {
404
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `AgentSearch rejected the request (HTTP ${code}). Fix the input before retrying; retrying the same request will fail again.`, { itemIndex: i });
405
+ }
398
406
  throw new n8n_workflow_1.NodeApiError(this.getNode(), e, { itemIndex: i });
399
407
  }
400
408
  if (res && typeof res === 'object')
@@ -579,9 +587,9 @@ async function readPage(op, i, signedBefore) {
579
587
  return { json: { ...data, payment, portal: direct ? null : envelope.portal ?? null }, signedAtomic };
580
588
  }
581
589
  exports.DIRECT_OPS = {
582
- searchAndRead: { path: 'search_and_read', label: 'Search and Read', price: '$0.009', when: 'charged only when at least one page returns text' },
583
- news: { path: 'news', label: 'News Search', price: '$0.008', when: 'not charged when there are no results' },
584
- screenshot: { path: 'screenshot', label: 'Screenshot', price: '$0.010', when: 'failed captures are not charged' },
590
+ searchAndRead: { path: 'search_and_read', label: 'Search and Read', price: '$0.005', when: 'charged only when at least one page returns text' },
591
+ news: { path: 'news', label: 'News Search', price: '$0.003', when: 'not charged when there are no results' },
592
+ screenshot: { path: 'screenshot', label: 'Screenshot', price: '$0.004', when: 'failed captures are not charged' },
585
593
  };
586
594
  const domainList = (v) => String(v ?? '')
587
595
  .split(',')
@@ -622,6 +630,8 @@ async function directPaid(op, i, signedBefore) {
622
630
  const query = String(this.getNodeParameter('query', i) ?? '').trim();
623
631
  if (!query)
624
632
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Query is empty', { itemIndex: i });
633
+ if (query.length < exports.MIN_QUERY_CHARS)
634
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), exports.QUERY_TOO_SHORT_MESSAGE, { itemIndex: i });
625
635
  body = { query };
626
636
  if (op === 'news') {
627
637
  const n = this.getNodeParameter('newsMaxResults', i, 5);
@@ -261,7 +261,7 @@ exports.MAX_PER_CALL_ATOMIC = 5000n;
261
261
  /** AgentSearch's own x402 API on Base (opt-in "Payment Route: Direct"). */
262
262
  exports.DIRECT_URL = 'https://api.agentsearchhq.com';
263
263
  exports.DIRECT_PAYEE = '0xC49B157887e51c21CB655f39CF65D6a4c2a4C337';
264
- /** $0.020 hard ceiling per direct call (extract $0.004, render $0.010, search_and_read $0.009). */
264
+ /** $0.020 hard ceiling per direct call (extract $0.002, render $0.005, search_and_read $0.005). */
265
265
  exports.DIRECT_MAX_PER_CALL_ATOMIC = 20000n;
266
266
  const eqAddr = (a, b) => typeof a === 'string' && a.toLowerCase() === b.toLowerCase();
267
267
  function atomicToUsd(a) {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "n8n-nodes-agentsearch",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "author": {
5
5
  "name": "AgentSearch",
6
6
  "email": "AgentSearchhq@gmail.com",
7
7
  "url": "https://agentsearchhq.com"
8
8
  },
9
- "description": "n8n community node for AgentSearch: free live web search for AI agents (no credentials), plus News Search ($0.008), page Extract ($0.004), JavaScript Render ($0.010), Screenshot ($0.010) and Search and Read ($0.009) per call, paid in USDC on Base via x402 to AgentSearch's own API",
9
+ "description": "n8n community node for AgentSearch: free live web search for AI agents (no credentials), plus News Search ($0.003), page Extract ($0.002), JavaScript Render ($0.005), Screenshot ($0.004) and Search and Read ($0.005) per call, paid in USDC on Base via x402 to AgentSearch's own API",
10
10
  "keywords": [
11
11
  "n8n-community-node-package",
12
12
  "n8n",