Hi there,
I’m wondering if it’s possible to pass a chat attachment to an agent tool (such as Gmail or Google Drive). I’ve managed to get this working using Node, but I haven’t been able to make it work with an agent tool.
A possible scenario would be sending an image as an attached file to an AI agent and asking it to generate an email with the image included as an email attachment.
Hybrid Solution with Agents
An alternative approach;
Capture the attachment with a chat node or form
Temporarily save the file (using the Write Binary File node)
Pass the file path to the agent as text
Configure the agent to read the file from the path and process it
Create a Function node that converts the attachment to base64
Pass the base64 string as a parameter to the agent
Inside the agent, use custom code to convert back to binary
// No Function Node antes do agente
const base64Data = Buffer.from($binary.data.data).toString('base64');
return {
json: {
fileData: base64Data,
fileName: $binary.data.fileName,
mimeType: $binary.data.mimeType
}
}
If this suggestion solved your problem, please mark my post as the solution (blue box with check mark) so that this ongoing discussion does not distract others who want to find the answer to the original question and click the heart. Thanks