跳转至

memory

feishu.agent.memory

MemoryIdentityConflict

Bases: ValueError

Trusted caller aliases refer to more than one established memory owner.

源代码位于: feishu/agent/memory.py
Python
class MemoryIdentityConflict(ValueError):
    """Trusted caller aliases refer to more than one established memory owner."""

MemoryRecord dataclass

A bounded durable fact owned by one user or shared within one project namespace.

源代码位于: feishu/agent/memory.py
Python
@dataclass(frozen=True)
class MemoryRecord:
    """A bounded durable fact owned by one user or shared within one project namespace."""

    memory_id: str
    namespace: str
    scope: MemoryScope
    owner_key: str | None
    content: str
    created_at: int
    updated_at: int
    expires_at: int = 0

MemoryStore

Bases: Protocol

源代码位于: feishu/agent/memory.py
Python
@runtime_checkable
class MemoryStore(Protocol):
    async def remember(
        self,
        *,
        namespace: str,
        scope: MemoryScope,
        owner_key: str | None,
        content: str,
        expires_at: int = 0,
    ) -> MemoryRecord: ...

    async def recall(self, *, namespace: str, owner_key: str | None, query: str, limit: int = 12) -> list[MemoryRecord]:
        """Return memories matching an explicit query within the caller's scope."""
        ...

recall async

Python
recall(*, namespace: str, owner_key: str | None, query: str, limit: int = 12) -> list[MemoryRecord]

Return memories matching an explicit query within the caller’s scope.

源代码位于: feishu/agent/memory.py
Python
async def recall(self, *, namespace: str, owner_key: str | None, query: str, limit: int = 12) -> list[MemoryRecord]:
    """Return memories matching an explicit query within the caller's scope."""
    ...

MemoryIdentityStore

Bases: MemoryStore, Protocol

Optional extension for durable links between trusted identifiers of the same user.

源代码位于: feishu/agent/memory.py
Python
@runtime_checkable
class MemoryIdentityStore(MemoryStore, Protocol):
    """Optional extension for durable links between trusted identifiers of the same user."""

    async def resolve_owner(self, *, namespace: str, owner_keys: tuple[str, ...]) -> str | None:
        """Link caller identifiers within one namespace, rejecting conflicting established owners."""
        ...

resolve_owner async

Python
resolve_owner(*, namespace: str, owner_keys: tuple[str, ...]) -> str | None

Link caller identifiers within one namespace, rejecting conflicting established owners.

源代码位于: feishu/agent/memory.py
Python
async def resolve_owner(self, *, namespace: str, owner_keys: tuple[str, ...]) -> str | None:
    """Link caller identifiers within one namespace, rejecting conflicting established owners."""
    ...