How to attach a file to AI agent?

Hi, I’m using AI Agent linked with CLAUDE.
Is there a possibility to add 1+ attachments to the AI call ?

Information on your n8n setup

  • n8n version:. latest
  • Database (default: SQLite):. default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npx
  • Operating system:. Debian 12

Hey @Michel_Morelli - Can you please specify what kind of attachment? If you specifically want the AI Agent, you can pass through images as binary data

If you want to extract audio, PDF etc there is more specialized nodes for that.
Audio for example: OpenAI Audio operations | n8n Docs

I made some examples with Gemini for PDF and images in here also:

Please provide some more details on what you want to achieve, and I can provide further feedback.

Hi, I intend PDF or TXT o Image too. But in primis PDF and TXT.

Can I use “binary image” field ?

Thanks.

Can do if you first transform into an image. To my knowledge, that’s the only option if you want to use the agent node.

I would go like this:

  1. If layout is not super important and there’s no graphics in the PDF → just read in the PDF - same for text, and you don’t need an attachment
  2. If you need to extract certain data from the PDF, you could use something like Stirling PDF - PDF to Image
  3. Once you have an image, you can pass it through the agent as an attachment with “Automatically Pass through Binary Images”
1 Like

Hi @jksr, I have the same question: how to attach a 2 pages ‘knowledge’ to an OAI or Ai Agent node.
If I understood you week, the simpler flow is

Trigger > pdf reader (standard document) > OAI node (with triggers variable value and pdf reader standard doc).

  • Am I understanding correctly?
  • If it is an ôter type of do (ex. Text…), use te ‘binary’, right?

Thanks

I think you would always upload a binary. As long as it’s simple text you can simply read it in, if It’s something more complicated you could have an LLM preprocess it (describe stuff like images tables etc.), extract structured data, parse it to markdown - whatever helps for your agent use case.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.