Skip to content

Conversation

@sarahsimionescu
Copy link

@sarahsimionescu sarahsimionescu commented Oct 7, 2025

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 Streaming: AI agents now emit tool-call-start and tool-call-end chunks when invoking tools, providing real-time visibility into agent actions
  • Node Execution Streaming: All nodes emit node-execute-before and node-execute-after chunks, enabling detailed workflow execution tracking
  • Workflow Lifecycle Chunks: Workflow execution now emits begin and end chunks to clearly mark execution boundaries
  • Enhanced Metadata: Chunks now include nodeType in addition to nodeId and nodeName for better context
  • Flexible Metadata Structure: Metadata fields are now optional where appropriate, allowing different chunk types to include relevant information

What This Enables:

  • Users can see which tools AI agents are calling in real-time without opening the n8n UI
  • Custom UIs can display live agent reasoning and tool usage
  • Better debugging of agentic workflows through transparency
  • Improved UX for customer-facing AI applications built with n8n

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

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with 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.

  • Core / Engine:
    • Emit begin/end, node-execute-before/node-execute-after, and error chunks in packages/core/src/execution-engine/workflow-execute.ts (including on cancel) with nodeType in metadata.
    • Refactor sendChunk usage to new structured format.
  • Execution Context:
    • Replace sendChunk(type, itemIndex, content) with sendChunk(details: SendChunkInput) in packages/core/src/execution-engine/node-execution-context/execute-context.ts`.
    • Build and forward SendStructuredChunk for item, webhook-response, tool-call-*, begin/end with enriched metadata.
  • AI Agent (ToolsAgent V2):
    • Stream token item chunks and emit tool-call-start/tool-call-end with tool metadata in .../ToolsAgent/V2/execute.ts while collecting intermediate steps.
  • RespondToWebhook Node:
    • Migrate to structured streaming: send beginwebhook-response (JSON/JWT/text/items) → end in RespondToWebhook.node.ts.
  • Types:
    • Add SendChunkInput and structured chunk types (BeginChunk, EndChunk, NodeExecute*, ErrorChunk, ItemChunk, ToolCall*) and update IExecuteFunctions.sendChunk signature in packages/workflow/src/interfaces.ts.

Written by Cursor Bugbot for commit ff561d1. This will update automatically on new commits. Configure here.

@CLAassistant
Copy link

CLAassistant commented Oct 7, 2025

CLA assistant check
All committers have signed the CLA.

cursor[bot]

This comment was marked as outdated.

@sarahsimionescu sarahsimionescu changed the title release: Stream AI agent tool calls and node execution via SSE feat: Stream AI agent tool calls and node execution via SSE Oct 7, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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

@n8n-assistant n8n-assistant bot added community Authored by a community member core Enhancement outside /nodes-base and /editor-ui node/improvement New feature or request in linear Issue or PR has been created in Linear for internal review labels Oct 7, 2025
@Joffcom
Copy link
Member

Joffcom commented Oct 7, 2025

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:
• Tests are included for any new functionality, logic changes or bug fixes.
• The PR aligns with our contribution guidelines.

Regarding new nodes:
We no longer accept new nodes directly into the core codebase. Instead, we encourage contributors to follow our Community Node Submission Guide to publish nodes independently.

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:
This PR has been added to our internal tracker as "GHC-4891". While we plan to review it, we are currently unable to provide an exact timeframe. Our goal is to begin reviews within a month, but this may change depending on team priorities. We will reach out when the review begins.

Thank you again for contributing to n8n.

@mmiklaszewski
Copy link

+1

1 similar comment
@sektro801
Copy link

+1

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

Labels

community Authored by a community member core Enhancement outside /nodes-base and /editor-ui in linear Issue or PR has been created in Linear for internal review node/improvement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants