Skip to content

feat(memory): add MySQL checkpoint backend #288

@luigisaetta

Description

@luigisaetta

Summary

Add a simple MySQL-backed checkpoint backend for Locus agent state persistence.

Locus currently supports several checkpoint backends, including in-memory, file, HTTP, Redis, PostgreSQL, OpenSearch, OCI Object Storage, and Oracle Database. MySQL does not appear to be supported yet.

This issue proposes adding a focused MySQL-only checkpoint backend.

Motivation

MySQL is easy to run in Docker Compose based deployments. For local, self-hosted, or small production setups, a Compose stack with an app service and a MySQL service is a common and simple operational model.

A MySQL checkpointer would let users persist Locus agent threads in that setup without adding Redis, PostgreSQL, Oracle Database, OCI Object Storage, or a separate checkpoint service.

Proposed Scope

Add a new MySQL storage backend following the existing storage-backend-plus-adapter pattern used by the current SQL-style backends.

The initial implementation should include:

  • MySQLBackend
  • MySQLConfig
  • mysql_checkpointer(...) convenience factory
  • Registry support for get_checkpointer("mysql")
  • Public exports from locus.memory.backends
  • Optional dependency extra, for example locus-sdk[mysql]
  • Unit tests
  • Basic integration test coverage gated behind a MySQL-specific marker
  • Documentation updates for the checkpoint backend list and usage example

This proposal is explicitly scoped to MySQL, not MariaDB.

Expected Behavior

The backend should support the basic checkpoint operations already expected by Locus:

  • save and load checkpoint state
  • delete checkpoints
  • check whether a thread exists
  • list stored threads
  • store and retrieve metadata
  • query by metadata
  • remove old checkpoints through vacuum-style cleanup

The first version does not need advanced features such as TTL support, full-text search, custom migrations, or broader MySQL-compatible database support.

Testing and Documentation

A future PR should include unit tests, gated integration tests, and documentation updates.

Before opening the PR, the usual project checks should pass:

hatch run test
hatch run lint
hatch run format-check

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions