Skip to content

symfonic.capabilities.memory.conversation_history

conversation_history

Opt-in, request-bound conversation history for a native Agent.

An authenticated scope and a caller's session id are different claims. The authorizer binds them on every read and write; an Agent cached by scope never holds a mutable current conversation. Final publication is a separate kernel stage, after the response has been prepared, rather than a post-model write that would turn intermediate tool rounds into transcript entries.

ConversationAuthorizer

Bases: Protocol

authorize async

authorize(scope: MemoryScope, session_id: str) -> ConversationKey

Verify ownership and return an exact storage key, or refuse.

Source code in src/symfonic/capabilities/memory/conversation_history.py
async def authorize(
    self, scope: MemoryScope, session_id: str
) -> ConversationKey:
    """Verify ownership and return an exact storage key, or refuse."""

ConversationKey dataclass

ConversationKey(scope_path: str, session_id: str)

A conversation proved to belong to one exact authenticated scope.

ConversationLogPort

Bases: Protocol

recent async

recent(key: ConversationKey, limit: int) -> tuple[ConversationTurn, ...]

The last limit turns of key, oldest first.

Source code in src/symfonic/capabilities/memory/conversation_history.py
async def recent(
    self, key: ConversationKey, limit: int
) -> tuple[ConversationTurn, ...]:
    """The last ``limit`` turns of ``key``, oldest first."""

NativeConversationHistory dataclass

NativeConversationHistory(store: ConversationLogPort, authorizer: ConversationAuthorizer, scope: MemoryScope, generations: Any = None)

Bases: AuthorizedSessionConversationPort

Read the current conversation and publish completed exchanges once.

Pass this to memory_capabilities(..., conversation=history, recent_turns=N); the factory composes its final publication stage. N=0 skips window reads. Deployments using a tenant or principal scope must supply an authorizer that verifies session ownership; the built-in authorizer accepts only a trusted session-level scope.

SessionScopeAuthorizer dataclass

SessionScopeAuthorizer(session_kind: str | None = None)

Bind v0 sessions, or an explicitly named terminal v1 session kind.