Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Javascript and Python apps and demos showcasing how to use MongoDB in GenAI appl

| Application | Stack | Description | Directory |
|------------|-------|-------------|-----------|
| AgentsKit Atlas Memory | MongoDB Atlas, AgentsKit, TypeScript | Minimal vector-memory lifecycle with replaceable embedding and model providers | [![View Code](https://img.shields.io/badge/view-code-blue?logo=github)](agentskit-atlas-memory) |
| Ambient Inventory Agent | MongoDB Atlas, MongoDB Remote MCP, Python, FastAPI, LangGraph, Claude on Amazon Bedrock | Coffee roaster inventory assistant: a deterministic LangGraph monitor raises low-stock alerts, and a streaming LangGraph ReAct agent answers the owner's questions using MongoDB Remote MCP tools | [![View Code](https://img.shields.io/badge/view-code-blue?logo=github)](ambient-inventory-agent) |
| Graph RAG Demo | MongoDB Atlas, Python, Node.js, OpenAI | Graph-based RAG implementation demonstrating MongoDB's graph capabilities with hybrid Python/Node.js approach | [![View Code](https://img.shields.io/badge/view-code-blue?logo=github)](graph_rag_demo) |
| Local RAG PDF | MongoDB Atlas, Python | Local RAG implementation for PDF processing and querying | [![View Code](https://img.shields.io/badge/view-code-blue?logo=github)](local-rag-pdf) |
Expand Down
4 changes: 4 additions & 0 deletions apps/agentskit-atlas-memory/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MONGODB_URI=
MONGODB_DATABASE=agentskit_demo
MONGODB_COLLECTION=memory
MONGODB_VECTOR_INDEX=agentskit_vector_index
3 changes: 3 additions & 0 deletions apps/agentskit-atlas-memory/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.env
node_modules/
dist/
60 changes: 60 additions & 0 deletions apps/agentskit-atlas-memory/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# AgentsKit memory with MongoDB Atlas Vector Search

This minimal TypeScript example uses MongoDB Atlas as a replaceable vector-memory
backend for an agent. It exercises the complete memory lifecycle: store three
documents, retrieve the closest context, print the result, and remove the demo
documents.

The sample uses small deterministic vectors so the integration is easy to
inspect. In an application, replace them with vectors from any embedding
provider; the MongoDB collection and AgentsKit memory contract stay unchanged.

## Prerequisites

- Node.js 20 or newer
- A MongoDB Atlas cluster
- An Atlas Vector Search index named `agentskit_vector_index` on
`agentskit_demo.memory`

Use this index definition for the sample's three-dimensional vectors:

```json
{
"fields": [
{
"type": "vector",
"path": "embedding",
"numDimensions": 3,
"similarity": "cosine"
}
]
}
```

## Run the example

```bash
cp .env.example .env
npm install
node --env-file=.env --import tsx src/index.ts
```

Set `MONGODB_URI` in `.env` before running. The database, collection, and index
names can also be changed there.

Atlas Vector Search indexes new records asynchronously. The example retries the
search at one-second intervals for up to five attempts while the stored records
become queryable. It
deletes its sample records before and after the run, including when indexing
does not complete within that retry window, so repeated executions do not leave
demo data behind.

## Validate without credentials

```bash
npm run typecheck
npm test
```

The deterministic test exercises the collection boundary and verifies the
generated `$vectorSearch` pipeline without contacting Atlas.
Loading