agent-memory-sdk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agent_memory_sdk-0.1.0/.github/workflows/ci.yml +151 -0
- agent_memory_sdk-0.1.0/.gitignore +24 -0
- agent_memory_sdk-0.1.0/.pre-commit-config.yaml +48 -0
- agent_memory_sdk-0.1.0/CHANGELOG.md +71 -0
- agent_memory_sdk-0.1.0/Dockerfile +77 -0
- agent_memory_sdk-0.1.0/LICENSE +21 -0
- agent_memory_sdk-0.1.0/Makefile +132 -0
- agent_memory_sdk-0.1.0/PKG-INFO +551 -0
- agent_memory_sdk-0.1.0/README.md +532 -0
- agent_memory_sdk-0.1.0/RUNNING_LOCALLY.md +430 -0
- agent_memory_sdk-0.1.0/agent_memory/__init__.py +46 -0
- agent_memory_sdk-0.1.0/agent_memory/_version.py +24 -0
- agent_memory_sdk-0.1.0/agent_memory/benchmark.py +140 -0
- agent_memory_sdk-0.1.0/agent_memory/cli.py +168 -0
- agent_memory_sdk-0.1.0/agent_memory/decision.py +161 -0
- agent_memory_sdk-0.1.0/agent_memory/eval.py +132 -0
- agent_memory_sdk-0.1.0/agent_memory/explain.py +116 -0
- agent_memory_sdk-0.1.0/agent_memory/manager.py +348 -0
- agent_memory_sdk-0.1.0/agent_memory/models.py +172 -0
- agent_memory_sdk-0.1.0/agent_memory/policy.py +131 -0
- agent_memory_sdk-0.1.0/agent_memory/retriever.py +91 -0
- agent_memory_sdk-0.1.0/agent_memory/sqlite_store.py +307 -0
- agent_memory_sdk-0.1.0/agent_memory/store.py +366 -0
- agent_memory_sdk-0.1.0/agent_memory/ttl.py +48 -0
- agent_memory_sdk-0.1.0/benchmarks/README.md +13 -0
- agent_memory_sdk-0.1.0/benchmarks/datasets/coding_agent.json +38 -0
- agent_memory_sdk-0.1.0/benchmarks/datasets/customer_support.json +42 -0
- agent_memory_sdk-0.1.0/benchmarks/datasets/research_agent.json +38 -0
- agent_memory_sdk-0.1.0/docker-compose.yml +37 -0
- agent_memory_sdk-0.1.0/docs/README.md +9 -0
- agent_memory_sdk-0.1.0/docs/architecture.md +15 -0
- agent_memory_sdk-0.1.0/docs/benchmarks.md +10 -0
- agent_memory_sdk-0.1.0/docs/examples.md +3 -0
- agent_memory_sdk-0.1.0/docs/faq.md +7 -0
- agent_memory_sdk-0.1.0/docs/getting-started.md +27 -0
- agent_memory_sdk-0.1.0/docs/memory-model.md +17 -0
- agent_memory_sdk-0.1.0/docs/policies.md +16 -0
- agent_memory_sdk-0.1.0/examples/basic_usage.py +49 -0
- agent_memory_sdk-0.1.0/mcp_server/__init__.py +0 -0
- agent_memory_sdk-0.1.0/mcp_server/server.py +184 -0
- agent_memory_sdk-0.1.0/pyproject.toml +57 -0
- agent_memory_sdk-0.1.0/tests/__init__.py +1 -0
- agent_memory_sdk-0.1.0/tests/test_backends.py +588 -0
- agent_memory_sdk-0.1.0/tests/test_memory.py +109 -0
- agent_memory_sdk-0.1.0/tests/test_v03.py +83 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, develop]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4.2.2
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5.5.0
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
cache: "pip"
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install -e ".[dev]"
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: |
|
|
32
|
+
python -m pytest tests/ -v --tb=short
|
|
33
|
+
|
|
34
|
+
- name: Run type checking
|
|
35
|
+
run: |
|
|
36
|
+
pip install mypy
|
|
37
|
+
mypy agent_memory/ --ignore-missing-imports || true
|
|
38
|
+
|
|
39
|
+
- name: Run linting
|
|
40
|
+
run: |
|
|
41
|
+
pip install ruff
|
|
42
|
+
ruff check agent_memory/ tests/
|
|
43
|
+
|
|
44
|
+
benchmark:
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
needs: test
|
|
47
|
+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
|
|
48
|
+
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v4.2.2
|
|
51
|
+
|
|
52
|
+
- name: Set up Python
|
|
53
|
+
uses: actions/setup-python@v5.5.0
|
|
54
|
+
with:
|
|
55
|
+
python-version: "3.11"
|
|
56
|
+
cache: "pip"
|
|
57
|
+
|
|
58
|
+
- name: Install dependencies
|
|
59
|
+
run: |
|
|
60
|
+
python -m pip install --upgrade pip
|
|
61
|
+
pip install -e ".[dev]"
|
|
62
|
+
|
|
63
|
+
- name: Run benchmark
|
|
64
|
+
run: |
|
|
65
|
+
agent-memory benchmark --seed --repeat 3
|
|
66
|
+
|
|
67
|
+
- name: Run evaluation
|
|
68
|
+
run: |
|
|
69
|
+
agent-memory eval
|
|
70
|
+
|
|
71
|
+
docker:
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
needs: test
|
|
74
|
+
|
|
75
|
+
steps:
|
|
76
|
+
- uses: actions/checkout@v4.2.2
|
|
77
|
+
with:
|
|
78
|
+
fetch-depth: 0 # Need full history for version detection
|
|
79
|
+
|
|
80
|
+
- name: Build Docker image
|
|
81
|
+
run: |
|
|
82
|
+
echo "GITHUB_REF_NAME=${GITHUB_REF_NAME}"
|
|
83
|
+
echo "GITHUB_REF=${GITHUB_REF}"
|
|
84
|
+
|
|
85
|
+
# Generate a valid PEP 440 version
|
|
86
|
+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
|
|
87
|
+
# For tags, use the tag name (strip 'v' prefix if present) - clean version for PyPI
|
|
88
|
+
VERSION=${GITHUB_REF_NAME#v}
|
|
89
|
+
elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then
|
|
90
|
+
# For main branch, use a dev version with commit SHA (PEP 440 compliant)
|
|
91
|
+
VERSION="0.0.0.dev0+$(git rev-parse --short HEAD)"
|
|
92
|
+
else
|
|
93
|
+
# For other branches, use branch name sanitized + commit SHA (PEP 440 compliant)
|
|
94
|
+
BRANCH=$(echo "${GITHUB_REF_NAME}" | sed 's/[^a-zA-Z0-9]/-/g')
|
|
95
|
+
VERSION="0.0.0.dev0+${BRANCH}.$(git rev-parse --short HEAD)"
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
echo "VERSION=${VERSION}"
|
|
99
|
+
docker build --build-arg VERSION="${VERSION}" -t agent-memory:latest .
|
|
100
|
+
|
|
101
|
+
- name: Test Docker image with SQLite backend
|
|
102
|
+
run: |
|
|
103
|
+
docker run --rm agent-memory:latest --help
|
|
104
|
+
docker run --rm -v agent_memory_data:/home/appuser/.agent_memory agent-memory:latest remember "test" "test response"
|
|
105
|
+
docker run --rm -v agent_memory_data:/home/appuser/.agent_memory agent-memory:latest resolve "test"
|
|
106
|
+
|
|
107
|
+
- name: Test Docker image with ChromaDB backend
|
|
108
|
+
run: |
|
|
109
|
+
docker run --rm -v agent_memory_chromadb:/home/appuser/.agent_memory agent-memory:latest remember "test" "test response" --backend chromadb
|
|
110
|
+
docker run --rm -v agent_memory_chromadb:/home/appuser/.agent_memory agent-memory:latest resolve "test" --backend chromadb
|
|
111
|
+
|
|
112
|
+
publish:
|
|
113
|
+
runs-on: ubuntu-latest
|
|
114
|
+
needs: [test, benchmark]
|
|
115
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
116
|
+
permissions:
|
|
117
|
+
contents: read
|
|
118
|
+
packages: write
|
|
119
|
+
id-token: write
|
|
120
|
+
|
|
121
|
+
steps:
|
|
122
|
+
- uses: actions/checkout@v4.2.2
|
|
123
|
+
|
|
124
|
+
- name: Set up Python
|
|
125
|
+
uses: actions/setup-python@v5.5.0
|
|
126
|
+
with:
|
|
127
|
+
python-version: "3.11"
|
|
128
|
+
|
|
129
|
+
- name: Install build dependencies
|
|
130
|
+
run: |
|
|
131
|
+
python -m pip install --upgrade pip build twine
|
|
132
|
+
|
|
133
|
+
- name: Build package
|
|
134
|
+
run: |
|
|
135
|
+
# For tag releases, use clean version without local identifier
|
|
136
|
+
VERSION=${GITHUB_REF_NAME#v}
|
|
137
|
+
SETUPTOOLS_SCM_PRETEND_VERSION=${VERSION} python -m build
|
|
138
|
+
|
|
139
|
+
- name: Publish to PyPI
|
|
140
|
+
env:
|
|
141
|
+
TWINE_USERNAME: __token__
|
|
142
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
143
|
+
run: |
|
|
144
|
+
twine upload dist/*
|
|
145
|
+
|
|
146
|
+
- name: Create GitHub Release
|
|
147
|
+
uses: softprops/action-gh-release@v2
|
|
148
|
+
with:
|
|
149
|
+
generate_release_notes: true
|
|
150
|
+
env:
|
|
151
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.venv/
|
|
6
|
+
venv/
|
|
7
|
+
.env
|
|
8
|
+
|
|
9
|
+
# Chroma / memory data
|
|
10
|
+
.agent_memory/
|
|
11
|
+
.agent_memory_demo/
|
|
12
|
+
|
|
13
|
+
# IDE
|
|
14
|
+
.idea/
|
|
15
|
+
.vscode/
|
|
16
|
+
|
|
17
|
+
# Test / build
|
|
18
|
+
.pytest_cache/
|
|
19
|
+
dist/
|
|
20
|
+
build/
|
|
21
|
+
|
|
22
|
+
.agent_memory/
|
|
23
|
+
.agent_memory_demo/
|
|
24
|
+
.pytest_cache/
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Pre-commit hooks for Agent Memory
|
|
2
|
+
# Install: pip install pre-commit && pre-commit install
|
|
3
|
+
|
|
4
|
+
repos:
|
|
5
|
+
# Ruff - Fast Python linter and formatter
|
|
6
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
7
|
+
rev: v0.5.0
|
|
8
|
+
hooks:
|
|
9
|
+
- id: ruff
|
|
10
|
+
args: [--fix, --exit-non-zero-on-fix]
|
|
11
|
+
- id: ruff-format
|
|
12
|
+
|
|
13
|
+
# MyPy - Static type checking
|
|
14
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
15
|
+
rev: v1.10.0
|
|
16
|
+
hooks:
|
|
17
|
+
- id: mypy
|
|
18
|
+
additional_dependencies: [types-requests, pydantic, chromadb]
|
|
19
|
+
args: [--ignore-missing-imports, agent_memory/]
|
|
20
|
+
|
|
21
|
+
# Check for common issues
|
|
22
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
23
|
+
rev: v4.6.0
|
|
24
|
+
hooks:
|
|
25
|
+
- id: trailing-whitespace
|
|
26
|
+
- id: end-of-file-fixer
|
|
27
|
+
- id: check-yaml
|
|
28
|
+
- id: check-toml
|
|
29
|
+
- id: check-json
|
|
30
|
+
- id: check-merge-conflict
|
|
31
|
+
- id: debug-logger
|
|
32
|
+
- id: detect-private-key
|
|
33
|
+
|
|
34
|
+
# Bandit - Security linting
|
|
35
|
+
- repo: https://github.com/PyCQA/bandit
|
|
36
|
+
rev: 1.7.8
|
|
37
|
+
hooks:
|
|
38
|
+
- id: bandit
|
|
39
|
+
args: [-r, agent_memory/, -ll]
|
|
40
|
+
exclude: tests/
|
|
41
|
+
|
|
42
|
+
# Check for TODO/FIXME comments
|
|
43
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
44
|
+
rev: v4.6.0
|
|
45
|
+
hooks:
|
|
46
|
+
- id: check-case-conflict
|
|
47
|
+
- id: mixed-line-ending
|
|
48
|
+
args: [--fix=lf]
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- SQLite backend (`SqliteMemoryStore`) as default lightweight storage
|
|
12
|
+
- Async API support (`aremember`, `aresolve`, `alist`, `aget`, `aforget`, `aarchive`, `acleanup`, `astats`, `aconsolidate`)
|
|
13
|
+
- Backend selection via `backend` parameter in `Memory` constructor (`"chromadb"` or `"sqlite"`)
|
|
14
|
+
- Comprehensive test coverage for both ChromaDB and SQLite backends
|
|
15
|
+
- Package distribution configuration (wheel, sdist)
|
|
16
|
+
- Docker support with both backends
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- **Default backend changed from ChromaDB to SQLite** for lightweight deployments
|
|
20
|
+
- Version bumped to `0.1.0-alpha` (was incorrectly `0.3.0` in code/docs)
|
|
21
|
+
- Updated roadmap to reflect completed features
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- Version inconsistency across `pyproject.toml`, `agent_memory/__init__.py`, and `README.md`
|
|
25
|
+
- Clean code principles and SOLID OOP compliance across all modules
|
|
26
|
+
|
|
27
|
+
## [0.1.0-alpha] - 2026-06-28
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- Initial release of Agent Memory
|
|
31
|
+
- Decision-based memory layer (Replay / Restore / Verify / None)
|
|
32
|
+
- Hybrid retrieval: BM25 keyword search + Vector semantic search with RRF fusion
|
|
33
|
+
- Multi-factor scoring policy (semantic 70%, recency 15%, confidence 20%, frequency 10%)
|
|
34
|
+
- Structured memory with types (conversation, fact, workflow, document, tool_output, code, summary, preference)
|
|
35
|
+
- Scoped memory (session, user, project, workspace, team, global)
|
|
36
|
+
- TTL support with flexible duration strings (e.g., "30d", "2h")
|
|
37
|
+
- Full observability via `decision.explain()`
|
|
38
|
+
- CLI with remember, resolve, stats, benchmark, eval, cleanup commands
|
|
39
|
+
- MCP server integration for Cursor, VS Code, and other MCP clients
|
|
40
|
+
- Docker support with multi-stage build
|
|
41
|
+
- Comprehensive documentation (architecture, benchmarks, examples, FAQ, getting started, memory model, policies)
|
|
42
|
+
- Benchmark and evaluation datasets (coding_agent, customer_support, research_agent)
|
|
43
|
+
- CI/CD pipeline with GitHub Actions
|
|
44
|
+
- Pre-commit hooks (ruff, mypy, black)
|
|
45
|
+
|
|
46
|
+
### Security
|
|
47
|
+
- No known vulnerabilities
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Release Notes Template
|
|
52
|
+
|
|
53
|
+
### [X.Y.Z] - YYYY-MM-DD
|
|
54
|
+
|
|
55
|
+
#### Added
|
|
56
|
+
- New features
|
|
57
|
+
|
|
58
|
+
#### Changed
|
|
59
|
+
- Changes in existing functionality
|
|
60
|
+
|
|
61
|
+
#### Deprecated
|
|
62
|
+
- Soon-to-be removed features
|
|
63
|
+
|
|
64
|
+
#### Removed
|
|
65
|
+
- Removed features
|
|
66
|
+
|
|
67
|
+
#### Fixed
|
|
68
|
+
- Bug fixes
|
|
69
|
+
|
|
70
|
+
#### Security
|
|
71
|
+
- Security fixes
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Multi-stage Docker build for agent-memory
|
|
2
|
+
FROM python:3.11-slim AS builder
|
|
3
|
+
|
|
4
|
+
# Build argument for version (passed from CI)
|
|
5
|
+
ARG VERSION=0.0.0
|
|
6
|
+
|
|
7
|
+
# Install build dependencies
|
|
8
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
9
|
+
gcc \
|
|
10
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
11
|
+
|
|
12
|
+
# Install build backend dependencies (required for --no-build-isolation)
|
|
13
|
+
RUN pip install --no-cache-dir hatchling hatch-vcs
|
|
14
|
+
|
|
15
|
+
# Set working directory
|
|
16
|
+
WORKDIR /app
|
|
17
|
+
|
|
18
|
+
# Copy project files
|
|
19
|
+
COPY pyproject.toml README.md ./
|
|
20
|
+
COPY agent_memory/ ./agent_memory/
|
|
21
|
+
COPY mcp_server/ ./mcp_server/
|
|
22
|
+
|
|
23
|
+
# Set version for hatch-vcs (since .git is not available in build context)
|
|
24
|
+
ENV SETUPTOOLS_SCM_PRETEND_VERSION=${VERSION}
|
|
25
|
+
|
|
26
|
+
# Debug: print version
|
|
27
|
+
RUN echo "Building version: ${VERSION}" && echo "SETUPTOOLS_SCM_PRETEND_VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION}"
|
|
28
|
+
|
|
29
|
+
# Install runtime dependencies including chromadb (without editable to avoid VCS version detection)
|
|
30
|
+
RUN SETUPTOOLS_SCM_PRETEND_VERSION=${VERSION} pip install --no-cache-dir --no-build-isolation ".[chromadb]"
|
|
31
|
+
|
|
32
|
+
# Runtime stage - use slim for pip availability, but keep it minimal
|
|
33
|
+
FROM python:3.11-slim AS runtime
|
|
34
|
+
|
|
35
|
+
# Build argument for version (passed from CI)
|
|
36
|
+
ARG VERSION=0.0.0
|
|
37
|
+
|
|
38
|
+
# Set version for hatch-vcs in runtime stage too
|
|
39
|
+
ENV SETUPTOOLS_SCM_PRETEND_VERSION=${VERSION}
|
|
40
|
+
|
|
41
|
+
# Install runtime dependencies only
|
|
42
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
43
|
+
libstdc++6 \
|
|
44
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
45
|
+
|
|
46
|
+
# Create non-root user
|
|
47
|
+
RUN useradd --create-home --shell /bin/bash appuser
|
|
48
|
+
|
|
49
|
+
# Set working directory to user's home directory
|
|
50
|
+
WORKDIR /home/appuser
|
|
51
|
+
|
|
52
|
+
# Copy installed packages from builder (only runtime deps)
|
|
53
|
+
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
|
|
54
|
+
COPY --from=builder /usr/local/bin /usr/local/bin
|
|
55
|
+
|
|
56
|
+
# Copy source code and install in runtime (without dev dependencies)
|
|
57
|
+
COPY --from=builder /app/agent_memory ./agent_memory
|
|
58
|
+
COPY --from=builder /app/mcp_server ./mcp_server
|
|
59
|
+
COPY --from=builder /app/pyproject.toml ./pyproject.toml
|
|
60
|
+
COPY --from=builder /app/README.md ./README.md
|
|
61
|
+
|
|
62
|
+
# Install package in runtime (without dev dependencies, with build isolation for build backend)
|
|
63
|
+
RUN SETUPTOOLS_SCM_PRETEND_VERSION=${VERSION} pip install --no-cache-dir --no-deps .
|
|
64
|
+
|
|
65
|
+
# Create data directory for persistence
|
|
66
|
+
RUN mkdir -p /home/appuser/.agent_memory && chown -R appuser:appuser /home/appuser
|
|
67
|
+
|
|
68
|
+
# Switch to non-root user
|
|
69
|
+
USER appuser
|
|
70
|
+
ENV HOME=/home/appuser
|
|
71
|
+
ENV AGENT_MEMORY_DIR=/home/appuser/.agent_memory
|
|
72
|
+
|
|
73
|
+
# Expose MCP server port (if needed)
|
|
74
|
+
EXPOSE 8000
|
|
75
|
+
|
|
76
|
+
# Set entrypoint
|
|
77
|
+
ENTRYPOINT ["agent-memory"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TheProdSDE
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Makefile for Agent Memory Development
|
|
2
|
+
|
|
3
|
+
.PHONY: help install test lint typecheck format benchmark eval clean docker-build docker-run docker-mcp
|
|
4
|
+
|
|
5
|
+
# Default target
|
|
6
|
+
help:
|
|
7
|
+
@echo "Agent Memory - Development Commands"
|
|
8
|
+
@echo ""
|
|
9
|
+
@echo "Setup:"
|
|
10
|
+
@echo " install Install package in development mode with dev dependencies"
|
|
11
|
+
@echo " install-ci Install for CI (no dev dependencies)"
|
|
12
|
+
@echo ""
|
|
13
|
+
@echo "Testing:"
|
|
14
|
+
@echo " test Run all tests"
|
|
15
|
+
@echo " test-v Run tests with verbose output"
|
|
16
|
+
@echo " test-cov Run tests with coverage report"
|
|
17
|
+
@echo ""
|
|
18
|
+
@echo "Code Quality:"
|
|
19
|
+
@echo " lint Run ruff linter"
|
|
20
|
+
@echo " typecheck Run mypy type checker"
|
|
21
|
+
@echo " format Format code with ruff"
|
|
22
|
+
@echo " check Run lint + typecheck"
|
|
23
|
+
@echo ""
|
|
24
|
+
@echo "Benchmarks & Evaluation:"
|
|
25
|
+
@echo " benchmark Run quick benchmark"
|
|
26
|
+
@echo " benchmark-full Run full benchmark with seeded data"
|
|
27
|
+
@echo " eval Run evaluation datasets"
|
|
28
|
+
@echo ""
|
|
29
|
+
@echo "Docker:"
|
|
30
|
+
@echo " docker-build Build Docker image"
|
|
31
|
+
@echo " docker-run Run CLI in Docker"
|
|
32
|
+
@echo " docker-mcp Run MCP server in Docker"
|
|
33
|
+
@echo " docker-compose-up Start services with docker-compose"
|
|
34
|
+
@echo " docker-compose-down Stop services"
|
|
35
|
+
@echo ""
|
|
36
|
+
@echo "Maintenance:"
|
|
37
|
+
@echo " clean Remove build artifacts and cache"
|
|
38
|
+
@echo " reset-db Reset ChromaDB database"
|
|
39
|
+
|
|
40
|
+
# Installation
|
|
41
|
+
install:
|
|
42
|
+
pip install -e ".[dev]"
|
|
43
|
+
|
|
44
|
+
install-ci:
|
|
45
|
+
pip install -e .
|
|
46
|
+
|
|
47
|
+
# Testing
|
|
48
|
+
test:
|
|
49
|
+
python -m pytest tests/ -v
|
|
50
|
+
|
|
51
|
+
test-v:
|
|
52
|
+
python -m pytest tests/ -vv --tb=long
|
|
53
|
+
|
|
54
|
+
test-cov:
|
|
55
|
+
python -m pytest tests/ --cov=agent_memory --cov-report=term-missing --cov-report=html
|
|
56
|
+
|
|
57
|
+
# Code Quality
|
|
58
|
+
lint:
|
|
59
|
+
ruff check agent_memory/ tests/
|
|
60
|
+
|
|
61
|
+
typecheck:
|
|
62
|
+
mypy agent_memory/ --ignore-missing-imports
|
|
63
|
+
|
|
64
|
+
format:
|
|
65
|
+
ruff format agent_memory/ tests/
|
|
66
|
+
|
|
67
|
+
check: lint typecheck
|
|
68
|
+
|
|
69
|
+
# Benchmarks & Evaluation
|
|
70
|
+
benchmark:
|
|
71
|
+
agent-memory benchmark
|
|
72
|
+
|
|
73
|
+
benchmark-full:
|
|
74
|
+
agent-memory benchmark --seed --repeat 3
|
|
75
|
+
|
|
76
|
+
eval:
|
|
77
|
+
agent-memory eval
|
|
78
|
+
|
|
79
|
+
# Docker
|
|
80
|
+
docker-build:
|
|
81
|
+
docker build -t agent-memory:latest .
|
|
82
|
+
|
|
83
|
+
docker-run:
|
|
84
|
+
docker run --rm -v agent_memory_data:/home/appuser/.agent_memory agent-memory:latest agent-memory $(ARGS)
|
|
85
|
+
|
|
86
|
+
docker-mcp:
|
|
87
|
+
docker run -d --name agent-memory-mcp \
|
|
88
|
+
-v agent_memory_data:/home/appuser/.agent_memory \
|
|
89
|
+
-p 8000:8000 \
|
|
90
|
+
agent-memory:latest agent-memory-mcp
|
|
91
|
+
|
|
92
|
+
docker-compose-up:
|
|
93
|
+
docker-compose up -d
|
|
94
|
+
|
|
95
|
+
docker-compose-down:
|
|
96
|
+
docker-compose down
|
|
97
|
+
|
|
98
|
+
docker-compose-logs:
|
|
99
|
+
docker-compose logs -f
|
|
100
|
+
|
|
101
|
+
# Maintenance
|
|
102
|
+
clean:
|
|
103
|
+
rm -rf build/ dist/ *.egg-info/ .pytest_cache/ .mypy_cache/ .ruff_cache/ htmlcov/
|
|
104
|
+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
105
|
+
find . -type f -name "*.pyc" -delete
|
|
106
|
+
|
|
107
|
+
reset-db:
|
|
108
|
+
rm -rf .agent_memory .agent_memory_demo
|
|
109
|
+
docker volume rm agent_memory_data 2>/dev/null || true
|
|
110
|
+
|
|
111
|
+
# Development shortcuts
|
|
112
|
+
dev: install
|
|
113
|
+
@echo "Development environment ready!"
|
|
114
|
+
@echo "Run 'make test' to run tests"
|
|
115
|
+
@echo "Run 'make benchmark' to run benchmarks"
|
|
116
|
+
|
|
117
|
+
# Run example
|
|
118
|
+
example:
|
|
119
|
+
python examples/basic_usage.py
|
|
120
|
+
|
|
121
|
+
# Run CLI help
|
|
122
|
+
cli-help:
|
|
123
|
+
agent-memory --help
|
|
124
|
+
|
|
125
|
+
# Install pre-commit hooks
|
|
126
|
+
pre-commit-install:
|
|
127
|
+
pip install pre-commit
|
|
128
|
+
pre-commit install
|
|
129
|
+
|
|
130
|
+
# Run pre-commit on all files
|
|
131
|
+
pre-commit-run:
|
|
132
|
+
pre-commit run --all-files
|