Skip to content

markxnelson/agent-memory-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oracle-memory-agent

This is a small Java 25 CLI demo for durable AI agent memory with LangChain4j, OpenAI, and Oracle AI Vector Search.

The app stores seed memories as embeddings in Oracle, retrieves the most relevant memories for a question, and sends the retrieved memory context to a chat model. Retrieved memories are treated as context, not instructions.

Prerequisites

  • Java 25
  • Maven 3.9+
  • Docker, or an existing Oracle AI Database / Oracle Database with vector support
  • OPENAI_API_KEY

Start Oracle locally

Log in to Oracle Container Registry first if your Docker client has not accepted the image terms.

docker compose up -d

Wait until the database is ready, then create the tutorial user:

docker exec -i oracle-memory-db bash -lc 'sqlplus -s sys/Oracle_4U_demo@localhost:1521/FREEPDB1 as sysdba' < sql/setup_user.sql

Configure the app

source .env.example

Replace OPENAI_API_KEY with a real key. If you are using another database, update ORACLE_JDBC_URL, ORACLE_USER, and ORACLE_PASSWORD.

Run it

mvn -q compile exec:java

Expected shape of the output:

Question:
What should I do on my first weekend in Paris?

Retrieved memories:
1. score=...
   The traveler is visiting Paris for the first time and wants a relaxed weekend plan.
...

Answer:
Start with one major museum, one classic viewpoint, and time to wander...

Run the four-memory follow-up demo

The follow-up article uses a second entry point that keeps the original semantic memory demo intact and adds working, episodic, procedural, and relationship tables.

export MEMORY_SESSION_ID="paris-weekend"
export MEMORY_QUESTION="What should I do on my first weekend in Paris?"
mvn -q compile exec:java -Dexec.mainClass=dev.redstack.demo.memory.MultiMemoryAgentApp

This run writes:

  • Working memory to AGENT_WORKING_MEMORY as JSON
  • Semantic memory to AGENT_MEMORY_STORE through OracleEmbeddingStore
  • Episodic memory to AGENT_EPISODES
  • Procedural memory to AGENT_PROCEDURES
  • Memory relationships to AGENT_MEMORY_EDGES

It also prints a memory plan before the answer so you can see which memory types were selected for the question and which ones were skipped.

Clean up

To remove only the demo user and its objects:

docker exec -i oracle-memory-db bash -lc 'sqlplus -s sys/Oracle_4U_demo@localhost:1521/FREEPDB1 as sysdba' < sql/drop_user.sql

To stop the database container:

docker compose down

Add -v only when you also want to remove the local database volume.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages