Conversation
Contributor
SummaryThe following content is AI-generated and provides a summary of the pull request: feat: Initial n8n Integration Experiment 🔗This PR introduces an experimental, first-class CAP integration with n8n, replacing the typical n8n server process entirely with a native CAP-hosted implementation. CAP serves the n8n editor UI, owns all workflow execution, and leverages existing CAP capabilities (data, actions, agents, LLM, auth) directly. 🗂️ What's ChangedNew: CAP-native n8n Engine
New: Node Executors (
|
| Category | Nodes |
|---|---|
| Flow control | ManualTrigger, If, Switch, Filter, SplitInBatches/Loop, Wait, StopAndError, NoOp |
| Data | Set, Code, Merge, SplitOut, Sort, Summarize, Limit, RemoveDuplicates, CompareDatasets, DateTime |
| Format | Markdown, Html, Xml |
| Connectivity | HttpRequest, RespondToWebhook, ExecuteWorkflow, ExecuteWorkflowTrigger, ErrorTrigger, StickyNote, ChatTrigger, Chat |
| CAP custom | capEntity (CRUD), capAction, capCql, capLlmProvider, capAgent (A2A) |
| LangChain AI | chainLlm, textClassifier, chainSummarization, sentimentAnalysis, informationExtractor, guardrails, agent |
Shared utilities: resolve.js (n8n expression resolver with fast-paths), conditions.js (full filter/condition evaluator), llm.js (shared LLM caller via cds.requires.llm).
Modified
cds-plugin.js— Registers then8nprotocol adapter and mounts static files after serving.package.json— Addsn8nas an optional peer dependency, registers then8nCDS kind, includesdb/in published files, and adds optional dependencies (cheerio,showdown,xml2js,node-html-markdown).tests/bookshop/— Minor updates: repository URL fix, adds@cap-js/agents, bumps@sap/cds-common-content, addscds watchscript, and wiresn8n/llmin CDS requires.
Have you...
- Added relevant entry to the change log?
- 🔄 Regenerate and Update Summary
- ✏️ Insert as PR Description (deletes this comment)
- 🗑️ Delete comment
PR Bot Information
Version: 1.29.18
- LLM:
anthropic--claude-4.6-sonnet - Correlation ID:
a11fb5e0-943a-11f1-9622-6451c71a8a30 - Summary Prompt: Default Prompt
- File Content Strategy: Full file content
- Output Template: Repository PR Template
- Event Trigger:
pull_request.opened
- CQL query token fusion: capEntity(list/get) and capCql nodes emit a _cql_query token instead of executing immediately. Downstream foldable nodes (Filter→WHERE, Sort→ORDER BY, Limit→LIMIT, If→two-branch WHERE) fold into the token and pass it on with no data flowing. The first non-foldable consumer executes the accumulated query. Recorded outputs for token nodes are stripped so the UI shows no items and no arrows on fused chains. - Preview mode (UI "run current/previous node"): token nodes execute directly at the target node only, capped to 1 row, so the editor can show type information without fetching full result sets. - Privileged execution: capEntity create/update/delete and capAction run under cds.User.Privileged so @requires annotations don't block workflow-driven calls. - $node[...].json expression support: makeAccessor gains a .json getter so $node["NodeName"].json.field resolves correctly. - Seed workflows: wf-book-catalog, wf-book-detail, wf-book-lifecycle, wf-place-order, wf-stock-report, wf-author-bibliography, wf-key-variants, wf-catalog-enriched, wf-chapter-browser, wf-fusion-demo and sub-workflows. - Test suite: 24 tests across cap-entity and cap-action covering all seed workflows end-to-end through the HTTP layer.
| // Persist all port arrays so the UI can show each port's items per run. | ||
| await this._recordStep(executionId, nodeId, 'success', recordedOutputs, null) | ||
| // runIndex was just incremented by _recordStep; the current run is at index - 1 | ||
| const nodeRunIndex = (_nodeRunIndex[executionId]?.[nodeId] ?? 1) - 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
overview
Experimental workflow integration leveraging the out-of-the-box benefits from CAP best practices.
With the recent partnership between
SAPandn8nit seemed fitting to experiment with a first class citizen experience betweenn8nandCAP.Choice Paralysis
With the heavy focus of
n8non promoting their>2000integration nodes it results in a counter productive user experience. Therefor this CAP integration is heavily focused on leveraging the existing CAP capabilities to provide the actually useful nodes.Agent integration
With the
@agentannotation it becomes possible to develop custom agents with easy leveraging the CAP capabilities. This comes with perfect integration withn8nas it removes the large amount ofLLMprovider nodes that actualn8nusers have to dig through to get theirLLMpowered nodes to function. With the capllmservice being defined it is not even required to select a model in your workflow to make theLLMpowered nodes work. There still is a specializedCAP LLMnode that allows you to pick which CAP service should be exactly used to provide theLLMconnection. This gives the flexibility to switch betweenbigandsmallmodels to your specific tasks requirements.Data integration
As CAP is very powerful in its ability to model and query data there is no need to use the
n8nspecific data storage approaches. Which also comes with massive anti patterns (e.g. excel sheets, csv files, application layer processing). It is as simple as picking your preferred level of complexity by either taking theCAP Entitynode or theCAP CQL Querynode. But do not worry even if you do not know much about CAP you will still be powered by all the best practices.The default
Data transformationnodes ofn8nare actually being collapsed intoCQLbehind the scenes. Which means you get all the exact samen8nuser experience. With the exact same CAP powered database push down. Which can greatly reduce the amount of data movement and processing as the database query execution optimizer will have a wholistic view of your data manipulation intends. It also comes with the big benefit that pretty much all then8nnodes are expected to be run against a singleitemat a time. Which means that of course internally the result of the accumulatedCQLquery are streamed row by row from the database ensuring that even large datasets will flow through your workflow without any limitations.Action integration
You might be scared that some of the feature that you need are not being exposed by
n8nor are missing from the CAP integration. It can be complicated to define your own customn8nnodes, but this is not a concern for CAP applications. As it is as simple as defining your ownactionin the CAP application and using the "CAP action" node to bridge any gaps you could possibly encounter.Event driven
One of the biggest complexities of running large workflows or task chains. Is to ensure your system does not get overloaded as all time based workflows are triggered at
0 0 * * */ 12 am midnight. Therefor the workflows steps are flowing through the CAP queue. Allowing the CAP instances to share the load throughout the system and ensures that if an instance encounters problems that the workflow will perform reliably. Retrying in between nodes having easy to recover and continue the workflow without having to ever restart the whole workflow. This ability to retain the intermediate state is especially important if very expensiveLLMbased nodes have successfully produced their results. It would double or triple theLLMcosts if these nodes would have to run every try.Authentication
A large benefit of having the system be merged directly into CAP is that it leverage the exact same authentication and authorization principles. Removing the need to register separate credentials or crossing between systems with the potential that users might get elevated privileges once the workflow starts processing their requests.
Local development
One of the biggest powers of CAP as a framework is its ability to run locally offline with mocks and with very fast development cycles. This integration gains the exact same benefits simply use
cds wand any changes you make to your model will be directly reflected in your CAP nodes. Allowing for an agile development cycle as most CAP users are already gotten used to. If you use the defaultSQLitein memory database you might have to recreate your workflow a few times.