Hi everyone,
I’m working on an HR assistant workflow that uses an AI Agent to select the 3 most relevant CVs from a Pinecone Vector Store, generate a tailored interview for each one, and send an individual email per candidate with their CV and interview content.
I’ve got most of the flow working, but I have two specific issues I’d like help with:
Issue 1: Only One Email Is Sent
Even though the AI Agent returns 3 CV file names, only one email is being sent. I resolved this by properly using the SplitInBatches
node:
Loop
output goes into the rest of the flow (Google Drive → AI Agent → Gmail).Next batch
is connected back into theSplitInBatches
node itself to loop over the next CV.
Now, 3 emails are sent — that part is solved.
Issue 2: Pinecone File Name Mapping (Main Problem)
The metadata.fileName
returned from Pinecone looks like this:
json
"metadata": {
"fileName": "sergio_benitez_ruiz_desarrollador_full_stack_senior.pdf",
...
}
However, the AI Agent originally returned file names like "archivo1.pdf"
which didn’t match my actual Google Drive files. I want to ensure the Agent uses only the real file names stored in Pinecone under metadata.fileName
.
Here’s the updated systemMessage
I used for the Agent to get the correct file names:
typescript
You are a recruitment assistant. Given a job description provided by the user, search the "Seleccion de CVs" tool and return the 3 most relevant results.
Return ONLY the file names from Pinecone’s metadata.fileName field in the following JSON format:
[
{ "nombre_archivo": "sergio_benitez_ruiz_desarrollador_full_stack_senior.pdf" },
{ "nombre_archivo": "juan_perez_react_dev.pdf" },
{ "nombre_archivo": "ana_garcia_uiux_specialist.pdf" }
]
⚠️ Do not include any text outside of the JSON.
What I need help with:
Does this prompt look good to ensure proper access to
metadata.fileName
?Is there a better way to ensure Google Drive uses this file name to find and download the exact match?
Any best practices for validating if a file was not found, to avoid broken emails?
Thanks in advance!
Describe the problem/error/question
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system: