Skip to content
How to ensure AI Ag...
 
Notifications
Clear all

How to ensure AI Agent gets correct info after a Merge Node?

5 Posts
3 Users
0 Reactions
4 Views
Anasp
(@anasp)
Posts: 2
New Member
Topic starter
 

Detailed background information & issue I am facing:

So I have a workflow which calls the AI Agent. Please note that this method is a batch processing workflow, meaning it scans my postgres database after the daily trigger and retrieves all (one or many) entries that have a specific value in a column.

After this, it generates some documents and performs AI processing based on the data from the postgres database. Everything up to the Merge node functions correctly.

The problem arises at the OutputAgent node, located at the top right.

Let me elaborate on the issue with an example:

Suppose I have 3 entries in my postgres database that require processing. The system will fetch these 3 entries. As you can observe in the current execution screenshot provided (scroll down to view), there are 3 executions across the three middle intermediary agents: the Business Extractor, ContactExtractor, and ProductExtractor. This is accurate; there should be 3 because 3 separate rows (in this example run) need to be processed according to my postgres database. The merge node now shows 9 items because I am using the APPEND mode. However, the issue seems to be that it's appending incorrectly. It appears to be concatenating all three results from the first agent, the Business Extractor, together, then the three results from the Contact Extractor together, and finally the three results from the last agent together. My desired structure is different; I need it to append the results of the three agents per ROW together, and then proceed to the next one.

In my OutputAgent, I need it to reference the information from the Business Extractor, ContactExtractor, and ProductExtractor for each individual row. Additionally, my final agent, OutputAgent, indicates it will execute 9 times. I only require it to execute 3 times, incorporating the information from the preceding 3 agents (Business Extractor, ContactExtractor, and ProductExtractor). I'm uncertain about the correct structure. Do I need an additional node after the merge that reorganizes the data before passing it to the final OutputAgent? Currently, I am unable to properly access the necessary information from the Merge node to pass to the OutputAgent. How can I ensure it correctly selects the right element without hardcoding values, as that would fail for batch sizes other than 3?

If anyone can assist me with this, I would greatly appreciate it. I am willing to compensate for your time, as I need prompt help with this.

There is no error message; I haven't been able to pinpoint the exact cause. I attempted some solutions, which resulted in an error message stating 'no path back to node.' This led me to believe a Merge node was necessary, but perhaps something is also needed after the merge node, before the OutputAgent?

Information on your callin.io setup

  • callin.io version: 1.89.2
  • Database (default: SQLite): Postgres, using AWS RDS
  • callin.io EXECUTIONS_PROCESS setting (default: own, main): I'm unsure about this setting, apologies. I am currently testing the workflow and plan to have it run daily or weekly via a trigger.
  • Running callin.io via (Docker, npm, callin.io cloud, desktop app): I am using the website and plan to deploy it on callin.io. I am not using Docker, npm, nor do I have a desktop application for it.
  • Operating system: Macbook M1 Pro, MacOs Sequoia 15.3.2

Please provide the rewritten markdown content; it should be in markdown format.

 
Posted : 18/05/2025 1:57 am
Anasp
(@anasp)
Posts: 2
New Member
Topic starter
 

Apologies for the lengthy post, but I've attempted to explain the situation as clearly as possible. Unfortunately, the system prevents me from sharing my actual workflow due to certain characters, including elements of my IDs, being blocked. However, I've included a screenshot of an execution that illustrates the issue, using a 3-row example:

The core issue is that the Merge append node is combining all three elements from the Business Extractor consecutively. It then does the same for the Contact Extractor, followed by the Product Extractor. This arrangement is problematic because I need to dynamically access variables within the OutputAgent, and it won't always be a batch process of 3 rows executing.

 
Posted : 18/05/2025 1:59 am
King_Samuel_David
(@king_samuel_david)
Posts: 55
Trusted Member
 

Try running the agent in the same row. You should be able to access them then. So, from Google Docs, connect all agents in a row into a final edit node or a code node, perhaps?

 
Posted : 18/05/2025 2:58 am
star_corp_30
(@star_corp_30)
Posts: 5
Active Member
 

I suspect the problem is with your Merge node setup.

To correctly combine the results from the three AI agents, you must have a shared key for matching, usually an ID field present in all three outputs.

Example:

Agent 1
ID: 123
user_name: username

Agent 2:
ID: 123
location: userlocation

Agent 3:
ID: 123
age: userAge

The Merge node needs to match based on the ID field across all inputs. After configuring this, try adjusting the Merge Mode. For your situation, choosing “Keep Matches” might provide the expected outcome.

 
Posted : 18/05/2025 10:35 am
star_corp_30
(@star_corp_30)
Posts: 5
Active Member
 

Please refer to this tutorial for additional information regarding the merge node: https://community.callin.io/t/advanced-course-1-8-working-with-complex-data-flows/48596

 
Posted : 18/05/2025 10:39 am
Share: