Skip to content

feat: n8n community node for TinyFish Web Agent#4

Open
pranavjana wants to merge 1 commit intomainfrom
feat/integrate-tinyfish-n8n-node
Open

feat: n8n community node for TinyFish Web Agent#4
pranavjana wants to merge 1 commit intomainfrom
feat/integrate-tinyfish-n8n-node

Conversation

@pranavjana
Copy link

Summary

  • Adds n8n community node (n8n-nodes-tinyfish) for TinyFish Web Agent
  • 5 operations: Run SSE (streaming), Run Sync, Run Async, Get Run, List Runs
  • Credential with API key auth, auto-injection via IAuthenticateGeneric, and connection test
  • Options: browser profile (lite/stealth), geographic proxy, configurable timeout
  • usableAsTool support for n8n AI Agent workflows
  • Retry logic with exponential backoff on 429/5xx errors
  • Actionable error messages for common API error codes
  • README with setup guide, screenshots, and contributing instructions

- Node with 5 operations: Run SSE, Run Sync, Run Async, Get Run, List Runs
- Credential with API key auth and connection test
- Options: browser profile (lite/stealth), proxy, timeout
- usableAsTool support for n8n AI Agent
- README with configuration, usage, and contributing guide
@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2026

📝 Walkthrough

Walkthrough

This pull request introduces a complete n8n node package for TinyFish Web Agent integration. The addition includes a new credential type (TinyfishApi) for API authentication, a main node implementation (Tinyfish) supporting five operations (runSse, runSync, runAsync, getRun, listRuns), helper utilities for API requests and SSE stream consumption, UI field definitions, build configuration, and comprehensive documentation. The package is configured for TypeScript compilation and distribution, with npm publishing support.

Sequence Diagram(s)

sequenceDiagram
    participant n8n as n8n Executor
    participant Node as Tinyfish Node
    participant API as TinyFish API
    participant SSE as SSE Stream

    n8n->>Node: execute(operation: 'runSse', params)
    Node->>Node: buildAutomationPayload()
    Node->>API: tinyfishApiRequest(POST /v1/automation/run-sse)
    API-->>Node: { streamingUrl, runId }
    Node->>SSE: fetch(streamingUrl) with AbortController
    SSE->>Node: stream SSE events (progress, result)
    Node->>Node: parseJsonLines() on each event
    Node->>Node: track runId, progress
    SSE->>Node: COMPLETE event
    Node-->>n8n: return structured result

    n8n->>Node: execute(operation: 'runSync', params)
    Node->>Node: buildAutomationPayload()
    Node->>API: tinyfishApiRequest(POST /v1/automation/run)
    API-->>API: process synchronously
    API-->>Node: { runId, result, status }
    Node-->>n8n: return execution data

    n8n->>Node: execute(operation: 'listRuns')
    Node->>API: tinyfishApiRequest(GET /v1/runs, params)
    API-->>API: pagination loop
    API-->>Node: { runs, cursor }
    Node->>Node: accumulate results or apply limit
    Node-->>n8n: return runs array
Loading
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding an n8n community node for TinyFish Web Agent, which is the primary objective of the PR.
Description check ✅ Passed The description is directly related to the changeset, providing relevant details about the n8n node implementation, operations, authentication, and features.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/integrate-tinyfish-n8n-node

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
n8n/.gitignore (1)

1-4: Consider adding additional common ignore patterns.

The current .gitignore covers the essentials, but you may want to add entries for environment files and IDE configurations to prevent accidental commits.

💡 Suggested additions
 node_modules/
 dist/
 *.js.map
 .DS_Store
+.env
+.env.*
+*.log
+.idea/
+.vscode/
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@n8n/.gitignore` around lines 1 - 4, Update the repository .gitignore to
include common sensitive and IDE/runtime artifacts in addition to the current
entries; add patterns such as .env, .env.* (or .env.local), .envrc, .vscode/,
.idea/, .venv/, .pytest_cache/, .cache/, coverage/ and *.log to prevent
committing environment files, IDE settings, virtualenvs, test caches, coverage
and log files—ensure these new patterns are appended to the existing
node_modules/, dist/, *.js.map and .DS_Store entries so they are ignored going
forward.
n8n/nodes/Tinyfish/Tinyfish.node.ts (1)

107-139: Pagination cap may silently truncate results.

The MAX_PAGINATION_ITEMS limit (10,000) silently truncates results when returnAll is enabled. Consider logging a warning or including metadata when results are truncated so users are aware they didn't receive all data.

💡 Suggested improvement to inform users of truncation
 						if (allRuns.length >= MAX_PAGINATION_ITEMS) {
+							this.logger.warn(
+								`List Runs reached maximum pagination limit of ${MAX_PAGINATION_ITEMS} items. Results may be incomplete.`,
+							);
 							break;
 						}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@n8n/nodes/Tinyfish/Tinyfish.node.ts` around lines 107 - 139, The code
silently truncates results at MAX_PAGINATION_ITEMS when returnAll is true;
modify the loop to detect when you break due to the cap (e.g., set a boolean
truncated = true when allRuns.length >= MAX_PAGINATION_ITEMS) and after you push
the sliced runs into returnData include a clear indicator for users — either
emit a warning via the node context (e.g., this.warn or
this.helpers.displayWarning) naming MAX_PAGINATION_ITEMS and the affected
operation, and/or append a metadata item to returnData (e.g., push { json: {
truncated: true, limit: MAX_PAGINATION_ITEMS }, pairedItem: { item: i } }) so
callers can detect truncation; update symbols: returnAll, allRuns,
MAX_PAGINATION_ITEMS, tinyfishApiRequest, returnData, pagination.
n8n/nodes/Tinyfish/GenericFunctions.ts (1)

203-253: Consider including streamingUrl in failure results for debugging.

When a run fails, the streamingUrl is omitted from the result, but it could be useful for debugging purposes (e.g., to review the browser session recording if available).

💡 Suggested improvement
 					} else {
 						finalResult = {
 							status: status || 'FAILED',
 							runId,
+							streamingUrl,
 							lastProgress,
 							error: eventData.error || 'Unknown error',
 						};
 					}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@n8n/nodes/Tinyfish/GenericFunctions.ts` around lines 203 - 253, The failure
branch inside the streaming loop (in GenericFunctions.ts where eventType is
handled and finalResult is assigned) omits streamingUrl; update the else branch
that sets finalResult for non-"COMPLETED" statuses to include streamingUrl
(alongside runId, lastProgress, and error) so failed results also carry the
streamingUrl for debugging; locate the block that checks eventType ===
'COMPLETE' and modify the finalResult assignment in the non-COMPLETED branch to
include the streamingUrl variable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@n8n/.gitignore`:
- Around line 1-4: Update the repository .gitignore to include common sensitive
and IDE/runtime artifacts in addition to the current entries; add patterns such
as .env, .env.* (or .env.local), .envrc, .vscode/, .idea/, .venv/,
.pytest_cache/, .cache/, coverage/ and *.log to prevent committing environment
files, IDE settings, virtualenvs, test caches, coverage and log files—ensure
these new patterns are appended to the existing node_modules/, dist/, *.js.map
and .DS_Store entries so they are ignored going forward.

In `@n8n/nodes/Tinyfish/GenericFunctions.ts`:
- Around line 203-253: The failure branch inside the streaming loop (in
GenericFunctions.ts where eventType is handled and finalResult is assigned)
omits streamingUrl; update the else branch that sets finalResult for
non-"COMPLETED" statuses to include streamingUrl (alongside runId, lastProgress,
and error) so failed results also carry the streamingUrl for debugging; locate
the block that checks eventType === 'COMPLETE' and modify the finalResult
assignment in the non-COMPLETED branch to include the streamingUrl variable.

In `@n8n/nodes/Tinyfish/Tinyfish.node.ts`:
- Around line 107-139: The code silently truncates results at
MAX_PAGINATION_ITEMS when returnAll is true; modify the loop to detect when you
break due to the cap (e.g., set a boolean truncated = true when allRuns.length
>= MAX_PAGINATION_ITEMS) and after you push the sliced runs into returnData
include a clear indicator for users — either emit a warning via the node context
(e.g., this.warn or this.helpers.displayWarning) naming MAX_PAGINATION_ITEMS and
the affected operation, and/or append a metadata item to returnData (e.g., push
{ json: { truncated: true, limit: MAX_PAGINATION_ITEMS }, pairedItem: { item: i
} }) so callers can detect truncation; update symbols: returnAll, allRuns,
MAX_PAGINATION_ITEMS, tinyfishApiRequest, returnData, pagination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments