From f3e779ba4ae5d169ca9d18e01cb13f0df67945ad Mon Sep 17 00:00:00 2001 From: Dakera Ops Date: Sat, 25 Jul 2026 02:50:33 +0000 Subject: [PATCH] feat(client): add valid_from param to store_memory (DAK-7424) Server v0.11.98 (DAK-7424) began persisting the bi-temporal valid_from field that was previously parsed but silently discarded. Adds valid_from as an optional int (Unix seconds) to both DakeraClient.store_memory and AsyncDakeraClient.store_memory so callers can specify when a memory becomes temporally valid, independent of ingest time. Omitting the field retains current behaviour (ingest time = valid_from). Parity PRs: dakera-js #209, dakera-go #145. Co-Authored-By: Paperclip --- src/dakera/async_client.py | 7 +++++++ src/dakera/client.py | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/dakera/async_client.py b/src/dakera/async_client.py index aaa7afd..dd7e30b 100644 --- a/src/dakera/async_client.py +++ b/src/dakera/async_client.py @@ -735,6 +735,7 @@ async def store_memory( tags: list[str] | None = None, ttl_seconds: int | None = None, expires_at: int | None = None, + valid_from: int | None = None, ) -> dict[str, Any]: """Store a memory for an agent. @@ -751,6 +752,10 @@ async def store_memory( after this many seconds from creation. expires_at: Optional explicit expiry as a Unix timestamp (seconds). Takes precedence over ``ttl_seconds`` when both are provided. + valid_from: Optional bi-temporal validity start as a Unix timestamp + (seconds). Indicates when this memory becomes temporally valid, + independent of ingest time. Defaults to ingest time when omitted. + Requires server v0.11.98+ (DAK-7424). """ data: dict[str, Any] = {"content": content, "memory_type": memory_type} if importance is not None: @@ -765,6 +770,8 @@ async def store_memory( data["ttl_seconds"] = ttl_seconds if expires_at is not None: data["expires_at"] = expires_at + if valid_from is not None: + data["valid_from"] = valid_from data["agent_id"] = agent_id response = await self._request("POST", "/v1/memory/store", data=data) # Server wraps the memory in {"memory": {...}, "embedding_time_ms": ...} diff --git a/src/dakera/client.py b/src/dakera/client.py index 5ee3df6..08318d6 100644 --- a/src/dakera/client.py +++ b/src/dakera/client.py @@ -1057,6 +1057,7 @@ def store_memory( tags: list[str] | None = None, ttl_seconds: int | None = None, expires_at: int | None = None, + valid_from: int | None = None, ) -> dict[str, Any]: """Store a memory for an agent. @@ -1073,6 +1074,10 @@ def store_memory( this many seconds from creation. expires_at: Optional explicit expiry as a Unix timestamp (seconds). Takes precedence over ``ttl_seconds`` when both are provided. + valid_from: Optional bi-temporal validity start as a Unix timestamp + (seconds). Indicates when this memory becomes temporally valid, + independent of ingest time. Defaults to ingest time when omitted. + Requires server v0.11.98+ (DAK-7424). """ data: dict[str, Any] = {"content": content, "memory_type": memory_type} if importance is not None: @@ -1087,6 +1092,8 @@ def store_memory( data["ttl_seconds"] = ttl_seconds if expires_at is not None: data["expires_at"] = expires_at + if valid_from is not None: + data["valid_from"] = valid_from data["agent_id"] = agent_id response = self._request("POST", "/v1/memory/store", data=data) # Server wraps the memory in {"memory": {...}, "embedding_time_ms": ...}