Back to blog
Graph Database on Object Storage: How Agent Memory Scales

This blog is written by AI for SEO

Graph Database on Object Storage: How Agent Memory Scales

HelixDB8 min read

Every AI engineer shipping production agents eventually hits the same memory wall. Your agent starts with an embedded SQLite file or a modest in-memory graph. It tracks conversational turns, tool outputs, and document references. Retrieval is fast, latency is negligible, and local development feels great.

Then production traffic picks up. An agent that tracks long-running user sessions, entity relationships, and 1536-dimensional vector embeddings for hundreds of thousands of interactions stops fitting in the RAM of an ordinary cloud instance. Suddenly you are looking at enterprise instance types with hundreds of gigabytes of memory just to keep your retrieval index online.

The traditional database answer is vertical scaling or complex sharding across distributed memory clusters. The modern infrastructure answer is moving durable state to S3-compatible buckets. Running a graph database on object storage changes how we think about agent memory: you give up raw in-memory pinning and get elastic disk and cloud storage tiers in return.

When agent memory outgrows one machine's RAM

A naive agent memory implementation stores embeddings and entities in volatile RAM. That works until entity counts cross into the millions. A single 1536-dimensional float32 embedding takes roughly 6 kilobytes of uncompressed memory. Add graph node metadata, relationship pointers, incoming and outgoing edge lists, and BM25 index postings, and every stored thought or episodic memory easily takes 10 to 12 kilobytes.

At scale, you need substantial amounts of RAM just to keep the active working set resident. If your database requires all vector indexes and graph edges to sit in memory, your infrastructure bill jumps. You end up provisioning memory-optimized instances on AWS or GCP, paying thousands of dollars every month for RAM that sits idle between infrequent agent traversals. Teams running Neo4j vector index memory frequently hit this ceiling because the storage model was built for memory-heavy transactional graphs, not elastic vector workloads.

Vertical scaling also creates a single point of failure. When that massive in-memory node restarts, re-indexing and memory warming can freeze your agent pipeline for hours. The working set has to be freed from the limits of one machine.

Why a graph and its vector index fit object storage differently than a key-value cache

Object storage systems like AWS S3 or Cloudflare R2 are built for high-throughput sequential block reads and writes, not small random 4-byte mutations. A simple key-value store pushes small updates to distinct keys, which creates high write amplification if forced directly into object storage. A knowledge graph tied to vector indices behaves differently.

In a graph database, queries traverse connected structures. An agent exploring an entity rarely looks at a completely random node. It walks neighbor lists, reads connected edge properties, and evaluates vector similarities across a scoped neighborhood. So the data has high spatial and relational locality. You can organize graph segments and vector partitions into immutable, compacted files. Instead of rewriting an object for every edge inserted, an LSM-tree (Log-Structured Merge-tree) engine buffers mutations in memory, flushes them as sequential blocks, and merges them in the background.

Vector indexes fit this model when they can be pre-filtered by graph topology. In pure vector databases, search scans a massive monolithic HNSW graph that resists simple partitioning. When vectors are properties on nodes and edges inside a unified engine, the database scopes similarity searches to specific subgraphs. Only the candidate segments need to be pulled from storage. That is why a combined graph-vector database works far better with tiered object storage than two separate, disconnected systems.

What object storage changes about cost and durability

The main reason to put a graph database on object storage is the shift in storage economics and durability. Memory costs roughly $5 to $8 per gigabyte per month on typical cloud providers. Provisioned NVMe block storage costs around $0.08 to $0.12 per gigabyte per month. Standard S3 object storage costs around $0.02 to $0.025 per gigabyte per month, with zero compute charges when idle.

For an agent memory footprint holding millions of interaction trails, historical document chunks, and relational graphs, keeping historical context in object storage cuts baseline infrastructure costs by an order of magnitude. Cold memories that an agent references once a month cost pennies to keep.

Durability also decouples from the life of your compute nodes. Amazon S3, for example, is designed for 99.999999999% (11 nines) durability. Traditional disk or memory architectures make you manage multi-node replication sets, write-ahead log shipping, and manual volume snapshots. If a compute instance running your agent memory crashes, you spin up a replacement node anywhere. The new instance mounts the object bucket, reads the root manifest, and is operational right away. Nobody restores petabytes of disk backups.

The trade-offs: first-read latency and why a cache tier matters

Object storage has a real cost, and it's read latency. Accessing local RAM takes around 100 nanoseconds. Reading from a local NVMe SSD is noticeably slower. Fetching an uncached block over HTTP from S3 adds substantial latency. If an agent is waiting on a multi-hop graph traversal to answer an interactive user prompt, a 50-millisecond penalty per hop will break your latency budget.

That's why a cache tier is mandatory when running a graph database on object storage. A production-ready engine can't treat S3 as a simple block device. It needs a multi-tier hierarchy: volatile RAM for hot active working sets, local NVMe or SSD for secondary block caching, and object storage as the persistent, authoritative source of truth.

When your agent queries memory, the engine hits the local page cache first. If an entity or vector index segment is active, traversal finishes in sub-millisecond time. Only when the agent recalls distant episodic memory or traverses an unvisited path does the engine fetch an immutable block from S3. Once fetched, the block stays in local SSD cache for subsequent hops. First-read latency exists, but good caching makes it the exception instead of the baseline.

Why a single writer with read replicas is the common shape

Distributed multi-master databases that support concurrent transactional writes across many nodes are brittle and expensive to run. On top of object storage, the industry has settled on a much cleaner architecture: one primary writer paired with horizontally autoscaling read replicas.

Object stores are strongly consistent for sequential object updates, but they don't provide distributed cross-object locking primitives. Coordinating multiple write processes against the same bucket requires distributed consensus algorithms like Raft or Paxos, which brings the operational headaches right back. With a single writer instance, all mutations are serialized into ordered logs with full transactional guarantees.

Read replicas pull updates directly from the shared object store without touching the writer node. When the writer flushes an LSM-tree memtable to an immutable block in the bucket and updates the database manifest, read replicas poll for new manifest versions. They invalidate changed cache pages and start serving reads from the new storage state. You can scale agent query concurrency from ten requests a second to ten thousand by adding lightweight stateless reader instances behind a load balancer. The write pipeline never changes.

How HelixDB runs it: SlateDB, one engine from embedded to Cloud

HelixDB is built for this exact problem. Storage isn't an afterthought. HelixDB's vector implementation runs across memory, disk, and object storage instead of staying pinned in RAM.

Under the hood, HelixDB uses SlateDB as its object-storage abstraction. SlateDB lets the database write directly to S3-compatible object storage. Graph topology, node attributes, edge vectors, and full-text indexes all share this one storage abstraction.

For AI developers, the payoff is deployment flexibility. HelixDB uses the same storage engine and native SDKs across three environments:

  1. Embedded in-memory or on-disk directly inside your application process using the native TypeScript, Python, Go, or Rust SDKs.

  2. Self-hosted in Docker, pointing either to local disk or to S3-compatible object storage.

  3. HelixDB Cloud, where an intelligent gateway routes queries, a single writer guarantees serializable snapshot-isolation ACID transactions, and reader nodes autoscale horizontally backed by tiered caching.

You don't rewrite your schema, learn a different query syntax, or rebuild vector indexes when you move from a local prototype to an enterprise cluster. Graph traversal and vector pre-filtering run over the same JSON query interface.

Choosing where your memory should live

Deciding how to store agent memory comes down to three variables: write frequency, retrieval latency limits, and dataset size. No single configuration fits every phase of development.

If you are building an agent with fewer than 100,000 entities that runs as a single-tenant assistant, keep it embedded. An embedded engine running locally or on ephemeral disk gives you sub-millisecond retrieval without network overhead. The whole working set fits in local application memory, and you skip the operational complexity of remote storage.

If your agent processes high-volume enterprise data across multiple agents, spans millions of relational nodes, or needs persistent history that survives container restarts, switch to object storage. Run a self-hosted vector database with graph queries pointing to an S3 bucket, or adopt a managed object-backed service. You trade tens of milliseconds on cold-start queries for virtually unlimited storage, durable backups, and much lower infrastructure costs.

Stop provisioning 512GB RAM instances to host embeddings your agent reads once a week. Separate compute from storage, let object storage handle durability, and let your cache tier handle real-time retrieval.

Conclusion

Agent memory can't stay trapped in expensive memory instances while datasets explode in scale. A graph database on object storage gives autonomous multi-agent systems the durability, elastic scaling, and cost efficiency they need, and you keep graph traversal and vector search.

HelixDB gives you this unified memory stack out of the box. You get native graph traversal, vector pre-filtering, and BM25 full-text search in a single Rust engine that runs everywhere from an embedded local process to auto-scaling cloud clusters backed by S3. Check out the open-source repo on GitHub, join our Discord community, and start scaling your agent memory with HelixDB today.

Build with HelixDB

Give your coding agent the setup prompt, or sign up and deploy a database.

Sign up