Skip to content

Add a CLI #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 9, 2025
Merged

Add a CLI #5

merged 6 commits into from
May 9, 2025

Conversation

abrookins
Copy link
Contributor

Now you can run a background task from the CLI, allowing an external scheduler to kick off periodic memory compaction (and more).

@Copilot Copilot AI review requested due to automatic review settings May 8, 2025 17:00
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a CLI interface for agent-memory-server enabling background task management and API serving via command-line commands, while deprecating the legacy Python worker approach. Key changes include:

  • Adding new CLI commands (version, api, mcp, schedule_task, task_worker) using Click.
  • Introducing tests for CLI commands in test_cli.py.
  • Removing the legacy worker module and updating dependency configurations and key utility functions.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test_cli.py Adds tests to verify the registration and execution of new CLI commands.
pyproject.toml Adds the Click dependency and defines the script entry point for the CLI.
agent_memory_server/worker.py Removes the legacy in-process Docket worker implementation.
agent_memory_server/utils/keys.py Updates the search index retrieval to use the value from settings.
agent_memory_server/long_term_memory.py Modifies asynchronous handling for fetching the search index and cleans up TODO comments.
agent_memory_server/docket_tasks.py Registers the newly added compact_long_term_memories task with the docket task list.
agent_memory_server/cli.py Implements all new CLI commands for server operations and task scheduling.
README.md Updates the “Contributing” section formatting.
Comments suppressed due to low confidence (1)

agent_memory_server/utils/keys.py:61

  • [nitpick] The setting name 'redisvl_index_name' appears ambiguous; please verify if it is intentional or a typo for 'redis_index_name'.
return settings.redisvl_index_name

Copy link
Contributor

@chrisguidry chrisguidry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super cool!

multiple=True,
help="Arguments to pass to the task in the format key=value",
)
def schedule_task(task_path: str, args: list[str]):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooo I may very well steal this for Docket :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah! Nice! This was my MVP for scheduling recurring tasks. Cron, here we come!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! Check out Perpetual, it's not documented that awesomely, but I think it's what you're looking for: https://github.com/chrisguidry/docket/blob/main/tests/test_fundamentals.py#L973-L997

Docket doesn't have cron syntax, but it can reschedule tasks on intervals forever

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, I'll check that out!

@abrookins abrookins merged commit f0104db into main May 9, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants