Building autonomous agent systems requires giving your agents long-term memory. When using the Gemini API for agent loops, storing knowledge contexts, past chat history, and document index nodes in a dedicated vector database is essential for fast semantic lookup.
In this guide, we compare the top three vector storage solutions—Pinecone, Supabase (pgvector), and Qdrant—to determine which database is the best fit for your agentic applications.
Technical Feature Matrix
Here is how the leading vector datastores compare on index types, querying latency, and pricing models:
| Feature | Pinecone | Supabase (pgvector) | Qdrant | | :--- | :--- | :--- | :--- | | Primary Indexing | HNSW / Flat | HNSW / IVFFlat | HNSW | | Fully Serverless | Yes | Yes (Postgres backend) | Yes | | Free Tier | Yes (1 project, 100k vectors) | Yes ($0/month project limits) | Yes (1GB free storage) | | Best For | Massive production scaling | Relational app databases | Complex filters / Rust speed | | Hosting Model | Cloud only | Cloud or Self-hosted | Cloud or Self-hosted |
Generating Embeddings with Gemini and Storing in Pinecone
To populate a vector database, you first convert your text corpus into multi-dimensional float vectors using the Gemini API.
Here is the complete Python workflow to generate embeddings with Gemini and index them in a serverless database:

Prompt example
Gemini 3.1 Pro / Vector DB
Diagram of a high-tech multi-dimensional vector space model. X, Y, Z axes mapping glowing data clusters, nested server index layouts, holographic tech aesthetic.
Aspect
16:9
Stylize
Holographic
Seed
991827364
# Generating embeddings with Gemini API and indexing in vector database
import google.generativeai as genai
from pinecone import Pinecone, ServerlessSpec
# Configure Gemini
genai.configure(api_key="GEMINI_API_KEY")
# 1. Generate embeddings using Gemini model text-embedding-004
text_to_embed = "Agent systems require persistent memory nodes to track tool execution states."
embedding_response = genai.embed_content(
model="models/text-embedding-004",
content=text_to_embed
)
vector = embedding_response['embedding']
# 2. Configure and connect to Pinecone
pc = Pinecone(api_key="PINECONE_API_KEY")
# Create a serverless index if it doesn't exist
index_name = "gemini-agent-memory"
if index_name not in pc.list_indexes().names():
pc.create_index(
name=index_name,
dimension=768, # Gemini text-embedding-004 output dimension
metric="cosine",
spec=ServerlessSpec(cloud="aws", region="us-east-1")
)
# Connect to the index and insert vector
index = pc.Index(index_name)
index.upsert(
vectors=[
{
"id": "doc_01",
"values": vector,
"metadata": {"text": text_to_embed, "source": "agent_logs"}
}
]
)
print("Vector successfully indexed in Pinecone serverless.")Deciding Which Vector Database to Use
- Choose Supabase (pgvector) if: You already use Postgres for your application database. Adding pgvector lets you perform vector searches right alongside your standard relational
JOINqueries without maintaining two separate database connections. - Choose Pinecone if: You are deploying a large-scale, high-concurrency production agent that needs instant serverless scaling with zero database management overhead.
- Choose Qdrant if: You require advanced payloads filtering (like complex geolocations, timestamps, or metadata ranges) within your vector queries and prefer a high-performance Rust engine.
Partner & Affiliate Disclosures
Ready to deploy your agent's memory? Support our site by signing up using our developer partner links:
- Pinecone: Create a Pinecone Serverless Account to start indexing up to 100k vectors for free.
- Supabase: Launch a Supabase Postgres Instance with built-in pgvector support.
- Qdrant: Spin up a Qdrant Cloud Cluster with 1GB of free storage.
Written by
Pete Overdrive
Workflow editor
Writes practical guides on model APIs, retrieval systems, structured output, and agent workflows.
Contact editor
