-
Notifications
You must be signed in to change notification settings - Fork 50.4k
feat: Stream AI agent tool calls and node execution via SSE #20499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
packages/@n8n/nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V2/execute.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 5 files
|
Hey @sarahsimionescu, Thank you for your contribution. We appreciate the time and effort you’ve taken to submit this pull request. Before we can proceed, please ensure the following: Regarding new nodes: If your node integrates with an AI service that you own or represent, please email [email protected] and we will be happy to discuss the best approach. About review timelines: Thank you again for contributing to n8n. |
|
+1 |
1 similar comment
|
+1 |
26cf10a to
ff561d1
Compare
Summary
This PR adds real-time streaming of execution progress information via Server-Sent Events (SSE), with a focus on AI agent transparency and tool call visibility.
Key Changes:
tool-call-startandtool-call-endchunks when invoking tools, providing real-time visibility into agent actionsnode-execute-beforeandnode-execute-afterchunks, enabling detailed workflow execution trackingbeginandendchunks to clearly mark execution boundariesnodeTypein addition tonodeIdandnodeNamefor better contextWhat This Enables:
Related Linear tickets, Github issues, and Community forum posts
Not sure if there are issues made yet for this, but I did find these discussions:
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported)Note
Introduce structured SSE streaming (begin/end, node-execute-before/after, error, item, webhook-response, tool-call-start/end) across Agents, core engine, and RespondToWebhook with updated sendChunk API and types.
begin/end,node-execute-before/node-execute-after, anderrorchunks inpackages/core/src/execution-engine/workflow-execute.ts(including on cancel) withnodeTypein metadata.sendChunkusage to new structured format.sendChunk(type, itemIndex, content)withsendChunk(details:SendChunkInput) inpackages/core/src/execution-engine/node-execution-context/execute-context.ts`.SendStructuredChunkforitem,webhook-response,tool-call-*,begin/endwith enriched metadata.itemchunks and emittool-call-start/tool-call-endwith tool metadata in.../ToolsAgent/V2/execute.tswhile collecting intermediate steps.begin→webhook-response(JSON/JWT/text/items) →endinRespondToWebhook.node.ts.SendChunkInputand structured chunk types (BeginChunk,EndChunk,NodeExecute*,ErrorChunk,ItemChunk,ToolCall*) and updateIExecuteFunctions.sendChunksignature inpackages/workflow/src/interfaces.ts.Written by Cursor Bugbot for commit ff561d1. This will update automatically on new commits. Configure here.