Skip to content

// diagrams › aws

Neptune Graph Sessions as per-user agent memory

Amazon Neptune Graph Sessions give each agent, user or task its own small graph that stops after 15 idle minutes and starts again in under 20 seconds. What it is, how to design it as agent memory, and how to draw it.

Opens a copy in the editor, in a new tab, ready to change. No account needed.

Architecture diagram of per-user agent memory on AWS: a user's chat turn goes through API Gateway to an agent running in Lambda, which looks up the user's graph id in a DynamoDB directory, reads and writes that user's Neptune Graph Session with openCypher, wakes a stopped session with its first query in under 20 seconds, and prompts an Amazon Bedrock model with the recalled facts; a session manager Lambda creates graph sessions of 4 or 8 s-NCU and records their ids, seed data is batch loaded from S3, and CloudWatch receives metrics while a session runs.

What’s in this diagram

services and parts

  • User in a chat
  • API Gateway
  • Agent (Lambda)
  • Amazon Bedrock model
  • Graph directory (user to graph id)
  • Session manager (CreateGraph, delete)
  • User A graph (running)
  • User B graph (stopped)
  • Seed data in S3
  • CloudWatch (metrics while running)

groups

  • AWS Cloud
  • Region
  • One graph per user (Neptune Graph Sessions)

Key points

  • A graph session is a Neptune Analytics graph whose compute runs only while it is working. Data and vector indexes are kept while it is stopped.
  • You pick a starting size of 4 or 8 s-NCU. One s-NCU is 1 GiB of memory and 0.25 vCPU, and compute is billed per second while the session runs.
  • On a diagram, memory stops being one shared database. It becomes a set of small graphs, one per user or agent, plus something that knows which graph belongs to whom.
  • The first query after an idle spell waits for the session to start. Plan timeouts and retries for that wait.
  • Default quotas are 25 sessions and 10 running at once per Region, both adjustable. Check them against your user count.

The whole story, step by step: Neptune Graph Sessions: a graph per agent that scales to zero.

Your diagram is one sentence away.

Start drawing, free

No account needed to start.