You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Files in the LangGraph store (skills, memories, any text blob) are managed through a dedicated set of use cases, a domain port, and an infrastructure adapter, following the same hexagonal pattern as the rest of the codebase.
Response DTOs: `StoreFileResponse`(`path`, `content`) and `StoreFilePutRequest` (`content`). The `{path:path}` converter allows slashes in the path segment. A missing file on `GET` raises `StoreFileNotFoundError` (`src/domain/errors/store_file.py`), resulting in a `404`.
165
+
166
+
### Use Cases (`src/application/use_cases/manage_store_file.py`)
167
+
168
+
Each use case is a thin pass-through to the repository (SRP — one class per action):
169
+
170
+
| Use Case | Method | Description |
171
+
|---|---|---|
172
+
| `ListStoreFilesUseCase` | `execute(prefix="/") -> list[str]` | List file paths matching the prefix. |
173
+
| `GetStoreFileUseCase` | `execute(path) -> str \| None` | Retrieve a single file's content; `None` if not found. |
174
+
| `PutStoreFileUseCase` | `execute(path, content) -> str` | Create or replace a file; returns the stored content. |
Implements `StoreFileRepository` on top of a LangGraph `BaseStore` (`InMemoryStore` or `AsyncPostgresStore`):
195
+
196
+
- Files are stored as `{"content": str, "encoding": "utf-8"}` values keyed by path under the `("filesystem",)` namespace by default (configurable via the `namespace` constructor arg).
197
+
- `list_files`uses `asearch(namespace, limit=100)` and filters client-side by `str.startswith(prefix)`.
198
+
- `get_file`returns `item.value.get("content")` (or `None` if the item is missing or malformed).
199
+
- `put_file`uses `aput` with the content dict.
200
+
- `delete_file`uses `adelete` (idempotent).
201
+
202
+
### Dependency injection
203
+
204
+
The four use cases are wired in `src/dependencies.py` via `get_list_store_files_use_case`, `get_get_store_file_use_case`, `get_put_store_file_use_case`, and `get_delete_store_file_use_case`. They share a single `LangGraphStoreFileRepository` instance built from the same store used by agent backends.
205
+
206
+
---
207
+
195
208
## Running Tests
196
209
197
210
The project uses **pytest** with **pytest-asyncio** for async test support. All tests are pure unit tests with no external dependencies (LLM calls are fully faked).
0 commit comments