Skip to content

Commit f7d86a6

Browse files
committed
Merge branch 'main' into feature/write-a-new
2 parents cfa94ac + 37d973d commit f7d86a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+13895
-8337
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Agent Memory Client CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags:
7+
- 'client/v*.*.*'
8+
pull_request:
9+
branches: [main]
10+
11+
jobs:
12+
test:
13+
name: Test (Python ${{ matrix.python-version }})
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ["3.10", "3.11", "3.12"]
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v3
29+
30+
- name: Install dependencies
31+
working-directory: agent-memory-client
32+
run: uv sync --extra dev
33+
34+
- name: Lint with Ruff
35+
working-directory: agent-memory-client
36+
run: uv run ruff check agent_memory_client
37+
38+
- name: Check formatting with Ruff formatter
39+
working-directory: agent-memory-client
40+
run: uv run ruff format --check agent_memory_client
41+
42+
- name: Type check with mypy
43+
working-directory: agent-memory-client
44+
run: uv run mypy agent_memory_client
45+
46+
- name: Run tests
47+
working-directory: agent-memory-client
48+
run: uv run pytest tests/ --cov=agent_memory_client --cov-report=xml
49+
50+
publish-testpypi:
51+
name: Publish to TestPyPI
52+
needs: test
53+
if: startsWith(github.ref, 'refs/tags/client/') && contains(github.ref, '-test')
54+
runs-on: ubuntu-latest
55+
environment: testpypi
56+
permissions:
57+
id-token: write
58+
contents: read
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- name: Set up Python
63+
uses: actions/setup-python@v4
64+
with:
65+
python-version: '3.12'
66+
67+
- name: Install build tools
68+
run: |
69+
python -m pip install --upgrade pip
70+
pip install build
71+
72+
- name: Build package
73+
working-directory: agent-memory-client
74+
run: python -m build
75+
76+
- name: Publish package to TestPyPI
77+
uses: pypa/gh-action-pypi-publish@release/v1
78+
with:
79+
repository-url: https://test.pypi.org/legacy/
80+
packages-dir: agent-memory-client/dist/
81+
82+
publish-pypi:
83+
name: Publish to PyPI
84+
needs: test
85+
if: startsWith(github.ref, 'refs/tags/client/') && !contains(github.ref, '-test')
86+
runs-on: ubuntu-latest
87+
environment: pypi
88+
permissions:
89+
id-token: write
90+
contents: read
91+
steps:
92+
- uses: actions/checkout@v4
93+
94+
- name: Set up Python
95+
uses: actions/setup-python@v4
96+
with:
97+
python-version: '3.12'
98+
99+
- name: Install build tools
100+
run: |
101+
python -m pip install --upgrade pip
102+
pip install build
103+
104+
- name: Build package
105+
working-directory: agent-memory-client
106+
run: python -m build
107+
108+
- name: Publish package to PyPI
109+
uses: pypa/gh-action-pypi-publish@release/v1
110+
with:
111+
packages-dir: agent-memory-client/dist/
112+
113+
# Tag Format Guide:
114+
# - For TestPyPI (testing): client/v1.0.0-test
115+
# - For PyPI (production): client/v1.0.0
116+
#
117+
# Use the script: python scripts/tag_and_push_client.py --test (for TestPyPI)
118+
# python scripts/tag_and_push_client.py (for PyPI)
119+
#
120+
# Alternative: This project uses trusted publishing, but you can use API Token
121+
# Authentication (if trusted publishing doesn't work).
122+
#
123+
# To do so, uncomment the sections below and add these secrets to your repository:
124+
# - TEST_PYPI_API_TOKEN (for TestPyPI)
125+
# - PYPI_API_TOKEN (for PyPI)
126+
#
127+
# For TestPyPI job, replace the publish step with:
128+
# - name: Publish package to TestPyPI
129+
# uses: pypa/gh-action-pypi-publish@release/v1
130+
# with:
131+
# repository-url: https://test.pypi.org/legacy/
132+
# packages-dir: agent-memory-client/dist/
133+
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
134+
#
135+
# For PyPI job, replace the publish step with:
136+
# - name: Publish package to PyPI
137+
# uses: pypa/gh-action-pypi-publish@release/v1
138+
# with:
139+
# packages-dir: agent-memory-client/dist/
140+
# password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/python-tests.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,50 @@ jobs:
6060
pip install uv
6161
uv sync --all-extras
6262
63+
- name: Install agent-memory-client
64+
run: |
65+
uv pip install -e ./agent-memory-client
66+
6367
- name: Run tests
6468
run: |
6569
uv run pytest --run-api-tests
6670
env:
6771
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
72+
73+
docker:
74+
needs: test
75+
runs-on: ubuntu-latest
76+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
77+
steps:
78+
- name: Checkout
79+
uses: actions/checkout@v4
80+
81+
- name: Set up Docker Buildx
82+
uses: docker/setup-buildx-action@v3
83+
84+
- name: Log in to GitHub Container Registry
85+
uses: docker/login-action@v3
86+
with:
87+
registry: ghcr.io
88+
username: ${{ github.actor }}
89+
password: ${{ secrets.GITHUB_TOKEN }}
90+
91+
- name: Extract version from __init__.py
92+
id: version
93+
run: |
94+
VERSION=$(grep '__version__ =' agent_memory_server/__init__.py | sed 's/__version__ = "\(.*\)"/\1/' || echo "latest")
95+
echo "version=$VERSION" >> $GITHUB_OUTPUT
96+
echo "Version: $VERSION"
97+
98+
- name: Build and push Docker image
99+
uses: docker/build-push-action@v5
100+
with:
101+
context: .
102+
file: ./Dockerfile
103+
platforms: linux/amd64,linux/arm64
104+
push: true
105+
tags: |
106+
ghcr.io/${{ github.repository }}:latest
107+
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
108+
cache-from: type=gha
109+
cache-to: type=gha,mode=max

CLAUDE.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ pip install uv
88

99
```bash
1010
# Development workflow
11-
uv install # Install dependencies
11+
uv venv # Create a virtualenv (once)
12+
source .venv/bin/activate # Activate the virtualenv (start of terminal session)
13+
uv install --all-extras # Install dependencies
14+
uv sync --all-extras # Sync latest dependencies
1215
uv run ruff check # Run linting
1316
uv run ruff format # Format code
14-
uv run pytest # Run tests
15-
uv run pytest tests/ # Run specific test directory
17+
uv run pytest --run-api-tests # Run all tests
18+
uv add <dependency> # Add a dependency to pyproject.toml and update lock file
19+
uv remove <dependency> # Remove a dependency from pyproject.toml and update lock file
1620

1721
# Server commands
1822
uv run agent-memory api # Start REST API server (default port 8000)
@@ -36,6 +40,7 @@ docker-compose down # Stop all services
3640
IMPORTANT: This project uses `pre-commit`. You should run `pre-commit`
3741
before committing:
3842
```bash
43+
uv run pre-commit install # Install the hooks first
3944
uv run pre-commit run --all-files
4045
```
4146

@@ -62,7 +67,7 @@ Working Memory (Session-scoped) → Long-term Memory (Persistent)
6267
```python
6368
# Correct - Use RedisVL queries
6469
from redisvl.query import VectorQuery, FilterQuery
65-
query = VectorQuery(vector=embedding, vector_field_name="embedding", return_fields=["text"])
70+
query = VectorQuery(vector=embedding, vector_field_name="vector", return_fields=["text"])
6671

6772
# Avoid - Direct redis client searches
6873
# redis.ft().search(...) # Don't do this

Dockerfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
22

3+
34
WORKDIR /app
45

56
ENV UV_COMPILE_BYTECODE=1
@@ -16,6 +17,7 @@ RUN apt-get update && apt-get install -y \
1617
RUN --mount=type=cache,target=/root/.cache/uv \
1718
--mount=type=bind,source=uv.lock,target=uv.lock \
1819
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
20+
--mount=type=bind,source=agent-memory-client,target=agent-memory-client \
1921
uv sync --frozen --no-install-project --no-dev
2022

2123
ADD . /app
@@ -26,6 +28,12 @@ ENV PATH="/app/.venv/bin:$PATH"
2628

2729
ENTRYPOINT []
2830

31+
EXPOSE 8000
32+
33+
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
34+
CMD curl -f http://localhost:8000/v1/health || exit 1
35+
36+
# Disable auth by default. Can be overridden with environment variable.
37+
ENV DISABLE_AUTH=true
2938

30-
# Run the API server
31-
CMD ["uv", "run", "agent-memory", "api"]
39+
CMD ["agent-memory", "api", "--host", "0.0.0.0", "--port", "8000"]

README.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,39 @@ A Redis-powered memory server built for AI agents and applications. It manages b
77
- **Working Memory**
88

99
- Session-scoped storage for messages, structured memories, context, and metadata
10-
- Automatically summarizes conversations when they exceed the window size
11-
- Client model-aware token limit management (adapts to the context window of the client's LLM)
10+
- Automatically summarizes conversations when they exceed a client-configured window size
1211
- Supports all major OpenAI and Anthropic models
13-
- Automatic promotion of structured memories to long-term storage
12+
- Automatic (background) promotion of structured memories to long-term storage
1413

1514
- **Long-Term Memory**
1615

1716
- Persistent storage for memories across sessions
17+
- **Pluggable Vector Store Backends** - Support for multiple vector databases through LangChain VectorStore interface:
18+
- **Redis** (default) - RedisStack with RediSearch
19+
- **Chroma** - Open-source vector database
20+
- **Pinecone** - Managed vector database service
21+
- **Weaviate** - Open-source vector search engine
22+
- **Qdrant** - Vector similarity search engine
23+
- **Milvus** - Cloud-native vector database
24+
- **PostgreSQL/PGVector** - PostgreSQL with vector extensions
25+
- **LanceDB** - Embedded vector database
26+
- **OpenSearch** - Open-source search and analytics suite
1827
- Semantic search to retrieve memories with advanced filtering system
19-
- Filter by session, namespace, topics, entities, timestamps, and more
28+
- Filter by session, user ID, namespace, topics, entities, timestamps, and more
2029
- Supports both exact match and semantic similarity search
2130
- Automatic topic modeling for stored memories with BERTopic or configured LLM
22-
- Automatic Entity Recognition using BERT
31+
- Automatic Entity Recognition using BERT or configured LLM
2332
- Memory deduplication and compaction
2433

34+
- **Production-Grade Memory Isolation**
35+
- OAuth2/JWT Bearer token authentication
36+
- Supports RBAC permissions
37+
- Top-level support for user ID and session ID isolation
38+
2539
- **Other Features**
26-
- Namespace support for session and working memory isolation
40+
- Dedicated SDK offering direct access to API calls _and_ memory operations as tools to pass to your LLM
2741
- Both a REST interface and MCP server
28-
- Background task processing for memory indexing and promotion
29-
- Unified search across working memory and long-term memory
42+
- Heavy operations run as background tasks
3043

3144
For detailed information about memory types, their differences, and when to use each, see the [Memory Types Guide](docs/memory-types.md).
3245

@@ -84,6 +97,12 @@ Configure servers and workers using environment variables. Includes background t
8497

8598
For complete configuration details, see [Configuration Guide](docs/configuration.md).
8699

100+
For vector store backend options and setup, see [Vector Store Backends](docs/vector-store-backends.md).
101+
102+
## License
103+
104+
Apache 2.0 License - see [LICENSE](LICENSE) file for details.
105+
87106
## Development
88107

89108
For development setup, testing, and contributing guidelines, see [Development Guide](docs/development.md).

0 commit comments

Comments
 (0)