osyra_ome.adapters.autogen.memory
Private pre-release / network boundary: The currently usable customer surface is offline verification of an existing signed artifact against an out-of-band trust anchor. Memory/network RPC APIs and host snippets on this page describe protocol and interface shape; the public Edge bridge, package publication, and release acceptance remain pending. Do not treat
api.osyra.ai:443examples as a released customer route.
AutoGen :class:`autogen_core.memory.Memory` backed by OME claims.
AutoGen 0.4+ defines an async :class:`autogen_core.memory.Memory` protocol that ``ConversableAgent`` / ``AssistantAgent`` consult on each turn to enrich the model context. :class:`OmeConversableAgentMemory` implements that protocol with OME claims as the underlying store.
Per-agent namespacing
Multi-agent AutoGen scenes have several agents whose memories are independent. The adapter accepts an ``agent_id`` at construction and encodes it into the OME ``subject_id`` (``did:web:agent.osyra.ai/<agent_id>``). To share memory across a group of agents, pass the same ``agent_id`` to each adapter instance or use a higher-level ``namespace`` ("group:X" / "shared:Y") at construction.
Cross-agent bridge claims
When agent A's output becomes input to agent B's memory, the ``add_bridge`` convenience method writes a Claim with both subject_ids in the metadata so the audit trail captures the cross-agent flow.
Because AutoGen Memory is async-only, this adapter is async-only. Wrap :class:`osyra_ome.OmeAsyncClient`.
.. warning:: **EXPERIMENTAL / PREVIEW in v0.1 — write works, recall does not.** The v0.1 read wire (``ListClaims`` projection) does NOT transport claim bodies, so ``query`` / ``update_context`` cannot reconstruct a stored memory. Rather than silently return an empty recall (which would drop the agent's memory — ADAPT2-1 / ENG-2225), recall FAILS CLOSED with :class:`~osyra_ome.errors.OmeBodyUnavailableError` when a known claim resolves with an empty body. Body-bearing recall is deferred to v0.2 via a dedicated ``GetClaimBody`` gRPC RPC. Until then, treat this memory as write-only attestation; do not depend on recall.
.. note:: **ENG-2413 verify-on-read body binding is PENDING for this adapter.** The body read in ``_load_all`` calls ``get_claim_body(..., verify_on_read= False)`` — it does NOT yet bind the returned body to a claim signature. The OLD ``SHA-256(body) == response.content_hash`` check was REMOVED because that ``content_hash`` is UNSIGNED/server-provided (forgeable). The ``verify_on_read=False`` opt-out is HONEST: the forgeable field is no longer consulted. Full signature-bound verify-on-read (cache the :class:`~osyra_ome.types.SignedClaim` from ``write_claim_signed`` and bind each read to its attested ``ch``, the langchain adapter pattern) is an ENG-2413 follow-up for this adapter.
Classes
class OmeConversableAgentMemory
Bases: Memory
OME-backed async Memory for AutoGen agents.
Args:
client: OmeAsyncClient bound to the destination workspace.
agent_id: identifier for the owning agent; encoded into
the OME subject_id.
workspace_id: OME workspace UUID-like id; if omitted,
defers to the workspace_id bound on the wrapped client.
top_k: max number of relevant memories to surface from
:meth:update_context. Defaults to 5.
Memory protocol methods covered: add, query, update_context, clear, close plus the OME-specific helper add_bridge.
Methods
__init__
def __init__(self, *, client: OmeAsyncClient, agent_id: str, workspace_id: str | None = None, top_k: int = 5) -> Noneadd (async)
async def add(self, content: MemoryContent, cancellation_token: CancellationToken | None = None) -> NonePersist a single MemoryContent as an OME Claim.
add_bridge (async)
async def add_bridge(self, content: MemoryContent, *, source_agent_id: str, cancellation_token: CancellationToken | None = None) -> NonePersist a cross-agent bridge claim.
Use when one agent's output becomes another agent's input. ``source_agent_id`` is recorded in the Claim body AND on the audit event for reconstruction of the cross-agent flow.
agent_id @property
def agent_id(self) -> strclear (async)
async def clear(self) -> NoneForget the in-process buffer of written claim ids.
Does NOT tombstone the underlying claims (v0.2 surface).
close (async)
async def close(self) -> NoneNo-op — the underlying OmeAsyncClient is owned by the caller.
Per AutoGen Memory protocol, ``close()`` releases any resources the memory holds. The wrapped OmeAsyncClient is an external resource the caller is responsible for closing (so it can be shared across multiple memory instances).
query (async)
async def query(self, query: str | MemoryContent, cancellation_token: CancellationToken | None = None, **kwargs: Any) -> MemoryQueryResultReturn all memory entries for this agent.
v0.1 surface: returns every memory entry (oldest first). AutoGen's protocol allows the implementation to do similarity-search-style filtering; v0.2 will plug into the OME ``proof`` / ``witness`` namespaces for cryptographically verifiable retrieval. For now the query value is ignored.
update_context (async)
async def update_context(self, model_context: ChatCompletionContext) -> UpdateContextResultEnrich the model context with the most-recent memories.
v0.1 behaviour: surface the last ``top_k`` memory entries verbatim. AutoGen 0.4 adds these to the model_context as ``SystemMessage`` content prefixed with "Relevant memory:".
workspace_id @property
def workspace_id(self) -> strwritten_claim_ids @property
def written_claim_ids(self) -> tuple[str, ...]