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
69 changes: 69 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
.PHONY: help setup sync lint format test test-api pre-commit clean server mcp worker

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}'

# Setup and dependencies
setup: ## Initial setup: create virtualenv and install dependencies
pip install uv
uv venv
uv sync --all-extras
uv run pre-commit install

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

# Code quality
lint: ## Run linting checks (ruff)
uv run ruff check .

format: ## Format code (ruff)
uv run ruff format .
uv run ruff check --fix .

pre-commit: ## Run all pre-commit hooks
uv run pre-commit run --all-files

# Testing
test: ## Run tests (excludes API tests requiring keys)
uv run pytest

test-api: ## Run all tests including API tests (requires OPENAI_API_KEY)
uv run pytest --run-api-tests

test-unit: ## Run only unit tests
uv run pytest tests/unit/

test-integration: ## Run only integration tests
uv run pytest tests/integration/

test-cov: ## Run tests with coverage report
uv run pytest --cov

# Running services
server: ## Start the REST API server
uv run agent-memory api

mcp: ## Start the MCP server (stdio mode)
uv run agent-memory mcp

mcp-sse: ## Start the MCP server (SSE mode on port 9000)
uv run agent-memory mcp --mode sse --port 9000

worker: ## Start the background task worker
uv run agent-memory task-worker

# Database operations
rebuild-index: ## Rebuild Redis search index
uv run agent-memory rebuild-index

migrate: ## Run memory migrations
uv run agent-memory migrate-memories

# Cleanup
clean: ## Clean up generated files and caches
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .ruff_cache -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
rm -rf .coverage htmlcov/ 2>/dev/null || true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A memory layer for AI agents.
**[Documentation](https://redis.github.io/agent-memory-server/)** • **[GitHub](https://github.com/redis/agent-memory-server)** • **[Docker](https://hub.docker.com/r/redislabs/agent-memory-server)**

</div>

## Features
- **Dual Interface**: REST API and Model Context Protocol (MCP) server
- **Two-Tier Memory**: Working memory (session-scoped) and long-term memory (persistent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,4 @@ publishing {
url = uri(layout.buildDirectory.dir("staging-deploy"))
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
version=0.1.0

Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = "agent-memory-client-java"
rootProject.name = "agent-memory-client-java"
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void close() {
httpClient.dispatcher().executorService().shutdown();
httpClient.connectionPool().evictAll();
}

/**
* Creates a new builder for MemoryAPIClient.
* @param baseUrl the base URL of the memory server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
* Base exception for all memory client errors.
*/
public class MemoryClientException extends Exception {

public MemoryClientException(String message) {
super(message);
}

public MemoryClientException(String message, Throwable cause) {
super(message, cause);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
* Raised when a requested memory or session is not found.
*/
public class MemoryNotFoundException extends MemoryClientException {

public MemoryNotFoundException(String message) {
super(message);
}

public MemoryNotFoundException(String message, Throwable cause) {
super(message, cause);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,26 @@
* Raised when the memory server returns an error.
*/
public class MemoryServerException extends MemoryClientException {

@Nullable
private final Integer statusCode;

public MemoryServerException(String message) {
this(message, null);
}

public MemoryServerException(String message, @Nullable Integer statusCode) {
super(message);
this.statusCode = statusCode;
}

public MemoryServerException(String message, @Nullable Integer statusCode, Throwable cause) {
super(message, cause);
this.statusCode = statusCode;
}

@Nullable
public Integer getStatusCode() {
return statusCode;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
* requests to the server, allowing for early error detection.
*/
public class MemoryValidationException extends MemoryClientException {

public MemoryValidationException(String message) {
super(message);
}

public MemoryValidationException(String message, Throwable cause) {
super(message, cause);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
* Generic acknowledgement response.
*/
public class AckResponse {

@NotNull
private String status;

public AckResponse() {
}

public AckResponse(@NotNull String status) {
this.status = status;
}

@NotNull
public String getStatus() {
return status;
}

public void setStatus(@NotNull String status) {
this.status = status;
}
Expand All @@ -33,4 +33,3 @@ public String toString() {
'}';
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
* Health check response from the server.
*/
public class HealthCheckResponse {

private double now;

public HealthCheckResponse() {
}

public HealthCheckResponse(double now) {
this.now = now;
}

public double getNow() {
return now;
}

public void setNow(double now) {
this.now = now;
}
Expand All @@ -29,4 +29,3 @@ public String toString() {
'}';
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,61 @@
* Response from the "forget" endpoint.
*/
public class ForgetResponse {

private int scanned;

private int deleted;

@NotNull
@JsonProperty("deleted_ids")
private List<String> deletedIds;

@JsonProperty("dry_run")
private boolean dryRun;

public ForgetResponse() {
}

public ForgetResponse(int scanned, int deleted, @NotNull List<String> deletedIds, boolean dryRun) {
this.scanned = scanned;
this.deleted = deleted;
this.deletedIds = deletedIds;
this.dryRun = dryRun;
}

public int getScanned() {
return scanned;
}

public void setScanned(int scanned) {
this.scanned = scanned;
}

public int getDeleted() {
return deleted;
}

public void setDeleted(int deleted) {
this.deleted = deleted;
}

@NotNull
public List<String> getDeletedIds() {
return deletedIds;
}

public void setDeletedIds(@NotNull List<String> deletedIds) {
this.deletedIds = deletedIds;
}

public boolean isDryRun() {
return dryRun;
}

public void setDryRun(boolean dryRun) {
this.dryRun = dryRun;
}

@Override
public String toString() {
return "ForgetResponse{" +
Expand All @@ -74,4 +74,3 @@ public String toString() {
'}';
}
}

Loading