Skip to content

Commit 909f0a8

Browse files
committed
Add CLI examples to README
1 parent c6e863c commit 909f0a8

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,91 @@ Agent Memory Server offers an MCP (Model Context Protocol) server interface powe
120120
- **search_memory**: Perform semantic search across long-term memories.
121121
- **memory_prompt**: Generate prompts enriched with session context and long-term memories.
122122

123+
## Command Line Interface
124+
125+
The `agent-memory-server` provides a command-line interface (CLI) for managing the server and related tasks. You can access the CLI using the `agent-memory` command (assuming the package is installed in a way that makes the script available in your PATH, e.g., via `pip install ...`).
126+
127+
### Available Commands
128+
129+
Here's a list of available commands and their functions:
130+
131+
#### `version`
132+
Displays the current version of `agent-memory-server`.
133+
```bash
134+
agent-memory version
135+
```
136+
137+
#### `api`
138+
Starts the REST API server.
139+
```bash
140+
agent-memory api [OPTIONS]
141+
```
142+
**Options:**
143+
* `--port INTEGER`: Port to run the server on. (Default: value from `settings.port`, usually 8000)
144+
* `--host TEXT`: Host to run the server on. (Default: "0.0.0.0")
145+
* `--reload`: Enable auto-reload for development.
146+
147+
Example:
148+
```bash
149+
agent-memory api --port 8080 --reload
150+
```
151+
152+
#### `mcp`
153+
Starts the Model Context Protocol (MCP) server.
154+
```bash
155+
agent-memory mcp [OPTIONS]
156+
```
157+
**Options:**
158+
* `--port INTEGER`: Port to run the MCP server on. (Default: value from `settings.mcp_port`, usually 9000)
159+
* `--sse`: Run the MCP server in Server-Sent Events (SSE) mode. If not provided, it runs in stdio mode.
160+
161+
Example (SSE mode):
162+
```bash
163+
agent-memory mcp --port 9001 --sse
164+
```
165+
Example (stdio mode):
166+
```bash
167+
agent-memory mcp --port 9001
168+
```
169+
170+
#### `schedule-task`
171+
Schedules a background task to be processed by a Docket worker.
172+
```bash
173+
agent-memory schedule-task <TASK_PATH> [OPTIONS]
174+
```
175+
**Arguments:**
176+
* `TASK_PATH`: The Python import path to the task function. For example: `"agent_memory_server.long_term_memory.compact_long_term_memories"`
177+
178+
**Options:**
179+
* `--args TEXT` / `-a TEXT`: Arguments to pass to the task in `key=value` format. Can be specified multiple times. Values are automatically converted to boolean, integer, or float if possible, otherwise they remain strings.
180+
181+
Example:
182+
```bash
183+
agent-memory schedule-task "agent_memory_server.long_term_memory.compact_long_term_memories" -a limit=500 -a namespace=my_namespace -a compact_semantic_duplicates=false
184+
```
185+
186+
#### `task-worker`
187+
Starts a Docket worker to process background tasks from the queue. This worker uses the Docket name configured in settings.
188+
```bash
189+
agent-memory task-worker [OPTIONS]
190+
```
191+
**Options:**
192+
* `--concurrency INTEGER`: Number of tasks to process concurrently. (Default: 10)
193+
* `--redelivery-timeout INTEGER`: Seconds to wait before a task is redelivered to another worker if the current worker fails or times out. (Default: 30)
194+
195+
Example:
196+
```bash
197+
agent-memory task-worker --concurrency 5 --redelivery-timeout 60
198+
```
199+
200+
To see help for any command, you can use `--help`:
201+
```bash
202+
agent-memory --help
203+
agent-memory api --help
204+
agent-memory mcp --help
205+
# etc.
206+
```
207+
123208
## Getting Started
124209

125210
### Local Install

0 commit comments

Comments
 (0)