# Central AI agent of an IT company with Gemini and OpenRouter: n8n workflow

> Started by someone opening a chat with it, and works across Google Drive, Pinecone and Postgres.

Source: https://millionrounds.com/workflow/central-ai-agent-of-an-it-company-with-gemini-and-openrouter (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Data collection](https://millionrounds.com/workflows?category=Data+collection#library)

# 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.

Large Calls a model: Gemini, OpenRouter Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcentral-ai-agent-of-an-it-company-with-gemini-and-openrouter)

**39 steps** Large: read it before trusting it with anything live

**3** Branches: places the flow splits

**0** Loops or waits

**3** Services it connects to

## The flow

Starts it 3 Model 15 Logic 12 Service 9

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

- 1 **Monitor Google Drive for New Files** Google Drive trigger *Starts it*
- 2 **Generate Document Embeddings (Google Gemini)** Embeddings Google Gemini *Model*
- 3 **Split Document Text into Chunks** Text Splitter Recursive Character Text Splitter *Model*
- 4 **Chat Message Trigger** Chat trigger *Starts it*
- 5 **Generate Query Embeddings (Google Gemini)** Embeddings Google Gemini *Model*
- 6 **OpenRouter Chat Model Interface** Lm Chat Open Router *Model*
- 7 **Window Buffer Memory** Memory Buffer Window *Model*
- 8 **Google Gemini Chat Model** Lm Chat Google Gemini *Model*
- 9 **scrape** Tool Http Request *Model*
- 10 **When clicking "Test workflow"** Manual trigger *Starts it*
- 11 **Window Buffer Memory1** Memory Buffer Window *Model*
- 12 **Google Gemini Chat Model1** Lm Chat Google Gemini *Model*
- 13 **Download File from Google Drive** Google Drive *Service*
- 14 **Insert Document into Pinecone Vector Store** Vector Store Pinecone *Model*
- 15 **Load Document Data for Processing** Document Default Data Loader *Model*
- 16 **Switch1** Switch *Logic*
- 17 **Retrieve Relevant Documents from Pinecone** Vector Store Pinecone *Model*
- 18 **AI Agent** Agent *Model*
- 19 **Web Scraping Agent** Agent *Model*
- 20 **Postgres1** Postgres *Service*
- 21 **AI Agent1** Agent *Model*
- 22 **Extract PDF Content** Extract From File *Service*
- 23 **Load the schema from the local file** Read Write File *Service*
- 24 **Generate Chat Prompt with Context** Code *Logic*
- 25 **Switch** Switch *Logic*
- 26 **Postgres** Postgres *Service*
- 27 **Extract SQL query** Set *Logic*
- 28 **Clean and Normalize PDF Text** Code *Logic*
- 29 **Extract data from file** Extract From File *Service*
- 30 **Add table name to output** Set *Logic*
- 31 **Check if query exists** If *Logic*
- 32 **Combine schema data and chat input** Set *Logic*
- 33 **Convert data to binary** Convert To File *Service*
- 34 **Combine query result and chat answer** Merge *Logic*
- 35 **Postgres2** Postgres *Service*
- 36 **No Operation, do nothing** No Op *Logic*
- 37 **Save file locally** Read Write File *Service*
- 38 **Prepare final output** Set *Logic*
- 39 **Format query results** Set *Logic*

## 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.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcentral-ai-agent-of-an-it-company-with-gemini-and-openrouter)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Google Drive](https://millionrounds.com/workflows?service=Google+Drive#library)[Pinecone](https://millionrounds.com/workflows?service=Pinecone#library)[Postgres](https://millionrounds.com/workflows?service=Postgres#library)

## Workflows like it

Also data collection, with the same services where possible, closest in size first.

- [**An email assistant to manage your Gmail inbox with Gemini** 37 steps · calls a model · Email, Gmail](https://millionrounds.com/workflow/an-email-assistant-to-manage-your-gmail-inbox-with-gemini)
- [**Filter URLs with Gemini and Groq** 37 steps · calls a model · Postgres](https://millionrounds.com/workflow/filter-urls-with-gemini-and-groq)
- [**From sitemap crawling to vector storage: Creating an efficient** 35 steps · calls a model · Postgres, Supabase](https://millionrounds.com/workflow/from-sitemap-crawling-to-vector-storage-creating-an-efficien)
- [**Interactive knowledge base chat with Supabase RAG** 43 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/interactive-knowledge-base-chat-with-supabase-rag)
- [**Find and score event and speaker opportunities with Gumloop** 35 steps · Gmail, Postgres](https://millionrounds.com/workflow/find-and-score-event-and-speaker-opportunities-with-gumloop)
- [**Build a Google Drive internal knowledge base with OpenAI** 34 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/build-a-google-drive-internal-knowledge-base-with-openai)
