Add actor-bound memory tools for Python - #8
Conversation
Add framework-neutral `memory_tools` and `async_memory_tools` factories for `memory_ingest` and `memory_search`. The application binds the user while model arguments exclude scope, credentials and endpoint settings. Search results are bounded and retain score, version and retrieval evidence. Errors are safe, and writes are never automatically retried. Make HTTP 202 ingest explicit through `PendingIngestError`, validate backend ID arrays, add a separate-process save/recall/correction example and prepare package version 1.1.4. The new version is not published yet. Validation: CI passes on Python 3.10, 3.11, 3.12 and 3.13. Local verification passes 622 tests and 76 tools/example tests from an installed wheel, plus Ruff, strict mypy and Vulture. Four live tests are gated; three sync/async parameter combinations are inapplicable. Local fixture correction does not prove actual engine or hosted correction behavior. Hosted persistence remains unverified.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48ce639378
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| bound_user = _user_scope(user) | ||
|
|
||
| def ingest(parsed: IngestArguments) -> IngestResult: | ||
| return client.ingest(TextIngest(content=parsed.content, scope=Scope(user=bound_user))) |
There was a problem hiding this comment.
Require a content class for tool ingests
Against an AtomicMemory core using the documented default RAW_CONTENT_POLICY=reject, both factories construct TextIngest without content_class, so _build_ingest_body omits the classification and every memory_ingest call is rejected. Because the tool arguments deliberately provide no classification field, applications cannot make this new ingest tool work with the default backend; require an application-owned content_class when creating the tools and pass it through rather than silently defaulting one.
AGENTS.md reference: AGENTS.md:L40-L40
Useful? React with 👍 / 👎.
| *, | ||
| method: str = "GET", | ||
| json: Any | None = None, | ||
| require_completed: bool = False, |
There was a problem hiding this comment.
Apply pending detection to handle ingests
When Core returns HTTP 202 through the public AtomicMemoryHandle.ingest_full or ingest_quick APIs, this opt-in defaults to false because both AtomicMemoryHandle._post_ingest and AsyncAtomicMemoryHandle._post_ingest still call fetch_json/afetch_json without require_completed=True. Those ingest paths therefore parse the pending body as a terminal result (or leak a Pydantic error) instead of raising the newly documented PendingIngestError, which can cause callers to treat a pending write as failed or completed and retry it; enable this check in both handle implementations as well.
Useful? React with 👍 / 👎.
Add framework-neutral
memory_toolsandasync_memory_toolsfactories formemory_ingestandmemory_search. The application binds the user while model arguments exclude scope, credentials and endpoint settings. Search results are bounded and retain score, version and retrieval evidence. Errors are safe, and writes are never automatically retried.Make HTTP 202 ingest explicit through
PendingIngestError, validate backend ID arrays, add a separate-process save/recall/correction example and prepare package version 1.1.4. The new version is not published yet.Validation: CI passes on Python 3.10, 3.11, 3.12 and 3.13. Local verification passes 622 tests and 76 tools/example tests from an installed wheel, plus Ruff, strict mypy and Vulture. Four live tests are gated; three sync/async parameter combinations are inapplicable. Local fixture correction does not prove actual engine or hosted correction behavior. Hosted persistence remains unverified.