Automation library · Data collection

Central AI agent of an IT company with Gemini and OpenRouter

Started by someone opening a chat with it, and works across Google Drive, Pinecone and Postgres. It puts Gemini and OpenRouter behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 39 steps, 3 branches: large, and worth reading before you trust it with anything live.

LargeCalls a model: Gemini, OpenRouterRetrieval

39 stepsLarge: read it before trusting it with anything live
3Branches: places the flow splits
0Loops or waits
3Services it connects to

The flow

Starts it 3Model 15Logic 12Service 9

The steps in the order they run, from what starts it.

  1. 1Monitor Google Drive for New FilesGoogle Drive triggerStarts it
  2. 2Generate Document Embeddings (Google Gemini)Embeddings Google GeminiModel
  3. 3Split Document Text into ChunksText Splitter Recursive Character Text SplitterModel
  4. 4Chat Message TriggerChat triggerStarts it
  5. 5Generate Query Embeddings (Google Gemini)Embeddings Google GeminiModel
  6. 6OpenRouter Chat Model InterfaceLm Chat Open RouterModel
  7. 7Window Buffer MemoryMemory Buffer WindowModel
  8. 8Google Gemini Chat ModelLm Chat Google GeminiModel
  9. 9scrapeTool Http RequestModel
  10. 10When clicking "Test workflow"Manual triggerStarts it
  11. 11Window Buffer Memory1Memory Buffer WindowModel
  12. 12Google Gemini Chat Model1Lm Chat Google GeminiModel
  13. 13Download File from Google DriveGoogle DriveService
  14. 14Insert Document into Pinecone Vector StoreVector Store PineconeModel
  15. 15Load Document Data for ProcessingDocument Default Data LoaderModel
  16. 16Switch1SwitchLogic
  17. 17Retrieve Relevant Documents from PineconeVector Store PineconeModel
  18. 18AI AgentAgentModel
  19. 19Web Scraping AgentAgentModel
  20. 20Postgres1PostgresService
  21. 21AI Agent1AgentModel
  22. 22Extract PDF ContentExtract From FileService
  23. 23Load the schema from the local fileRead Write FileService
  24. 24Generate Chat Prompt with ContextCodeLogic
  25. 25SwitchSwitchLogic
  26. 26PostgresPostgresService
  27. 27Extract SQL querySetLogic
  28. 28Clean and Normalize PDF TextCodeLogic
  29. 29Extract data from fileExtract From FileService
  30. 30Add table name to outputSetLogic
  31. 31Check if query existsIfLogic
  32. 32Combine schema data and chat inputSetLogic
  33. 33Convert data to binaryConvert To FileService
  34. 34Combine query result and chat answerMergeLogic
  35. 35Postgres2PostgresService
  36. 36No Operation, do nothingNo OpLogic
  37. 37Save file locallyRead Write FileService
  38. 38Prepare final outputSetLogic
  39. 39Format query resultsSetLogic

How it's built

Starts on
Someone opening a chat with it
Steps
39, with 3 branches
Size
Large: read it before trusting it with anything live
Connects to
Google Drive, Pinecone, Postgres
Model
Gemini, OpenRouter
Retrieval
Answers are drawn from documents you supply, not from the model alone

Questions

What does it need to run?

An n8n account, plus your own Google Drive, Pinecone and Postgres accounts, and a key for Gemini and OpenRouter. You connect your own accounts after importing it; none are included.

What starts it?

It starts on someone opening a chat with it.

Does it use AI?

Yes. It calls Gemini and OpenRouter. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 39 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 39 steps before you point it at anything that matters.