Skip to content

Conversation

@schrothbn
Copy link
Contributor

@schrothbn schrothbn commented Nov 24, 2025

Summary

Unifies memory management between streaming and non-streaming modes in the AI Agent node. Previously, memory was saved in multiple places, leading to and inconsistent behavior. This PR consolidates memory saving to a single location in runAgent.ts after agent completion.

  • Removed memory saving logic from processEventStream.ts (was being called during on_tool_end events AND at stream completion)
  • Added buildToolContext() helper function for consistent tool call formatting across both modes
  • Extended saveToMemory() to accept optional steps parameter for including tool context
  • Removed redundant saveToolResultsToMemory() function

Related Linear tickets, Github issues, and Community forum posts

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)

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...nts/Agent/agents/ToolsAgent/V3/helpers/runAgent.ts 16.66% 5 Missing ⚠️
...angchain/utils/agent-execution/memoryManagement.ts 66.66% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@n8n-assistant n8n-assistant bot added the n8n team Authored by the n8n team label Nov 24, 2025
@currents-bot
Copy link

currents-bot bot commented Nov 24, 2025

E2E Tests: n8n tests passed after 8m 36.4s

🟢 588 · 🔴 0 · ⚪️ 12 · 🟣 2

View Run Details

Run Details

  • Project: n8n

  • Groups: 2

  • Framework: Playwright

  • Run Status: Passed

  • Commit: 0d1c3a8

  • Spec files: 96

  • Overall tests: 600

  • Duration: 8m 36.4s

  • Parallelization: 9

Groups

GroupId Results Spec Files Progress
ui 🟢 539 · 🔴 0 · ⚪️ 12 · 🟣 2 90 / 90
ui:isolated 🟢 49 · 🔴 0 · ⚪️ 0 6 / 6


This message was posted automatically by currents.dev | Integration Settings

@schrothbn schrothbn marked this pull request as ready for review November 24, 2025 16:28
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

@schrothbn schrothbn requested review from a team and OlegIvaniv and removed request for a team November 24, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

n8n team Authored by the n8n team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants