Skip to content
Merged
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
12 changes: 6 additions & 6 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install uv
uv sync --only-dev
make sync-dev

- name: Run pre-commit
run: |
uv run pre-commit run --all-files
make pre-commit

service-tests:
name: Service Tests
Expand All @@ -53,15 +53,15 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install uv
uv sync --all-extras
make sync

- name: Install agent-memory-client
run: |
uv pip install -e ./agent-memory-client

- name: Run service tests
run: |
uv run pytest --run-api-tests
make test-api
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

Expand Down Expand Up @@ -91,12 +91,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install uv
uv sync --all-extras
make sync

- name: Install agent-memory-client
run: |
uv pip install -e ./agent-memory-client

- name: Run tests
run: |
uv run pytest
make test
4 changes: 2 additions & 2 deletions .github/workflows/test-fork-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install uv
uv sync --all-extras
make sync

- name: Install agent-memory-client
run: |
uv pip install -e ./agent-memory-client

- name: Run service tests
run: |
uv run pytest --run-api-tests
make test-api
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.2 # Use the latest version
rev: v0.14.8
hooks:
# Run the linter
- id: ruff
Expand Down
31 changes: 15 additions & 16 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ Do not use Redis Stack or other earlier versions of Redis.
Get started in a new environment by installing `uv`:
```bash
pip install uv # Install uv (once)
uv venv # Create a virtualenv (once)
uv install --all-extras # Install dependencies
uv sync --all-extras # Sync latest dependencies
make setup # Create .venv, sync deps, install pre-commit hooks
make sync # Sync latest dependencies
```

### Activate the virtual environment
Expand All @@ -29,14 +28,15 @@ code basepassing to commit.
Run all tests like this, including tests that require API keys in the
environment:
```bash
uv run pytest --run-api-tests
make test-api
```

### Linting

```bash
uv run ruff check # Run linting
uv run ruff format # Format code
make pre-commit # Run the exact formatting/lint hooks used in CI
make verify # Run full local verification (pre-commit + API tests)
```

### Managing Dependencies
uv add <dependency> # Add a dependency to pyproject.toml and update lock file
Expand Down Expand Up @@ -70,8 +70,7 @@ docker-compose down # Stop all services
IMPORTANT: This project uses `pre-commit`. You should run `pre-commit`
before committing:
```bash
uv run pre-commit install # Install the hooks first
uv run pre-commit run --all-files
make pre-commit
```

## Important Architectural Patterns
Expand Down Expand Up @@ -130,11 +129,11 @@ Always use RedisVL query types for any search operations. This is a project requ

The project uses `pytest` with `testcontainers` for Redis integration testing:

- `uv run pytest` - Run all tests
- `uv run pytest tests/unit/` - Unit tests only
- `uv run pytest tests/integration/` - Integration tests (require Redis)
- `uv run pytest -v` - Verbose output
- `uv run pytest --cov` - With coverage
- `make test` - Run the standard test suite
- `make test-api` - Run all tests including API-key-dependent tests
- `make test-unit` - Unit tests only
- `make test-integration` - Integration tests (require Redis)
- `make test-cov` - Run tests with coverage

## Project Structure

Expand Down Expand Up @@ -246,11 +245,11 @@ ENABLE_NER=true
## Development Workflow

0. **Install uv**: `pip install uv` to get started with uv
1. **Setup**: `uv install` to install dependencies
1. **Setup**: `make setup`
2. **Redis**: Start Redis Stack via `docker-compose up redis`
3. **Development**: Use `DISABLE_AUTH=true` for local testing
4. **Testing**: Run `uv run pytest` before committing
5. **Linting**: Pre-commit hooks handle code formatting
4. **Testing**: Run `make verify` before committing
5. **Linting**: `make pre-commit` matches the CI lint gate exactly
6. **Background Tasks**: Start worker with `uv run agent-memory task-worker`

## Documentation
Expand Down
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help setup sync lint format test test-api pre-commit clean server mcp worker
.PHONY: help setup sync sync-dev lint format test test-api test-unit test-integration test-cov pre-commit verify clean server mcp mcp-sse worker rebuild-index migrate

help: ## Show this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
Expand All @@ -7,12 +7,15 @@ help: ## Show this help message
setup: ## Initial setup: create virtualenv and install dependencies
pip install uv
uv venv
uv sync --all-extras
$(MAKE) sync
uv run pre-commit install

sync: ## Sync dependencies from lock file
uv sync --all-extras

sync-dev: ## Sync development dependencies only
uv sync --only-dev

# Code quality
lint: ## Run linting checks (ruff)
uv run ruff check .
Expand All @@ -24,11 +27,15 @@ format: ## Format code (ruff)
pre-commit: ## Run all pre-commit hooks
uv run pre-commit run --all-files

verify: ## Run the full local verification flow used by CI (requires OPENAI_API_KEY for API tests)
$(MAKE) pre-commit
$(MAKE) test-api

# Testing
test: ## Run tests (excludes API tests requiring keys)
test: ## Run tests (matches the general CI test job; excludes API-key-dependent tests)
uv run pytest

test-api: ## Run all tests including API tests (requires OPENAI_API_KEY)
test-api: ## Run all tests including API tests (matches the CI service-tests job; requires OPENAI_API_KEY)
uv run pytest --run-api-tests

test-unit: ## Run only unit tests
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,20 +285,23 @@ Working Memory (Session-scoped) → Long-term Memory (Persistent)
## Development

```bash
# Install dependencies
uv sync --all-extras
# Initial setup
make setup

# Run tests
uv run pytest
# Full local verification (matches CI lint + service tests)
make verify

# Format code
uv run ruff format
uv run ruff check
# Or run individual layers
make pre-commit
make test
make test-api

# Start development stack (choose one based on your needs)
docker compose up api redis # Development mode
docker compose up api task-worker redis mcp # Production-like mode
```

`make verify` requires `OPENAI_API_KEY` because it runs `make test-api`.
## License

Apache License 2.0 - see [LICENSE](LICENSE) file for details.
Expand Down
24 changes: 12 additions & 12 deletions agent-memory-client/tests/test_tool_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ def test_creation_and_editing_tools_exclude_message_type(self):
memory_type_prop = params["properties"]["memory_type"]
if "enum" in memory_type_prop:
if function_name in restricted_tools:
assert (
"message" not in memory_type_prop["enum"]
), f"Creation/editing tool '{function_name}' should not expose 'message' memory type"
assert "message" not in memory_type_prop["enum"], (
f"Creation/editing tool '{function_name}' should not expose 'message' memory type"
)
elif function_name in allowed_tools:
# These tools are allowed to have message in enum for filtering
pass
Expand All @@ -215,9 +215,9 @@ def test_creation_and_editing_tools_exclude_message_type(self):
and function_name in restricted_tools
):
memory_type_prop = items["properties"]["memory_type"]
assert (
"message" not in memory_type_prop["enum"]
), f"Creation/editing tool '{function_name}' should not expose 'message' memory type in nested properties"
assert "message" not in memory_type_prop["enum"], (
f"Creation/editing tool '{function_name}' should not expose 'message' memory type in nested properties"
)


class TestAnthropicSchemas:
Expand Down Expand Up @@ -292,9 +292,9 @@ def test_anthropic_schemas_exclude_message_type_for_creation(self):
memory_type_prop = params["properties"]["memory_type"]
if "enum" in memory_type_prop:
if function_name in restricted_tools:
assert (
"message" not in memory_type_prop["enum"]
), f"Anthropic creation/editing tool '{function_name}' should not expose 'message' memory type"
assert "message" not in memory_type_prop["enum"], (
f"Anthropic creation/editing tool '{function_name}' should not expose 'message' memory type"
)
elif function_name in allowed_tools:
# These tools are allowed to have message in enum for filtering
pass
Expand All @@ -309,9 +309,9 @@ def test_anthropic_schemas_exclude_message_type_for_creation(self):
and function_name in restricted_tools
):
memory_type_prop = items["properties"]["memory_type"]
assert (
"message" not in memory_type_prop["enum"]
), f"Anthropic creation/editing tool '{function_name}' should not expose 'message' memory type in nested properties"
assert "message" not in memory_type_prop["enum"], (
f"Anthropic creation/editing tool '{function_name}' should not expose 'message' memory type in nested properties"
)


class TestToolSchemaCustomization:
Expand Down
21 changes: 12 additions & 9 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@

Start by creating a virtual environment and installing dependencies with uv:
```bash
# Create and activate a virtual environment
uv venv
make setup
source .venv/bin/activate

# Install dependencies (including optional groups used in development)
uv sync --all-extras
```

Use Docker Compose from the repository root:
Expand All @@ -25,22 +21,29 @@ docker compose up api task-worker redis mcp
## Running Tests

```bash
uv run pytest
make test
```

Run API-key-dependent tests as well:

```bash
uv run pytest --run-api-tests
make test-api
```

## Linting and formatting

```bash
uv run ruff check
uv run ruff format
make pre-commit
```

For the full local check used in CI, run:

```bash
make verify
```

`make verify` requires `OPENAI_API_KEY` because it runs the API-key-dependent test suite.

## Contributing

1. Fork the repository
Expand Down
Loading
Loading