Whats the best practice for inserting attachments of different types in an ai agent?

Describe the problem/error/question

What is the best way to include attachments varying from pdf,excel,jpg,png,word documents in an ai agent input? Is it better/cheaper to include it all inside a AI agent? or should I seperate it and make a workflow just for parsing documents over into text, and then merge it together to append in the AI agent for more context that came from the documents.

Please share your workflow

Or Seperate the task like so:

Information on your n8n setup

  • n8n version: 1.116.2
  • Database (default: SQLite): NO DATABASE
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):CLOUD
  • Operating system:

It depends on your use case. If you’re dealing with small, simple files (like short PDFs or clean Word docs), you can safely send them directly to the LLM. Modern multimodal models like GPT-4o or Claude can handle such inputs effectively for quick, single-shot reasoning.

However, as a rule of thumb, it’s always better to separate document parsing from the AI agent. Building a preprocessing layer lets you extract text from PDFs, Excel sheets, and images (using OCR), clean and chunk it, then feed only the relevant parts to the model. This makes your system faster, cheaper, and more scalable — especially when handling larger or mixed-format files.

For best practices, check out:

These cover modern document-ingestion workflows and why separating parsing logic is the smarter long-term choice.

3 Likes

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