Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from .base import EventMetricDataSource
class SessionLifecycleDataSource(EventMetricDataSource):
"""
Emit session lifecycle events consumed by `SessionCollector`.
The datasource keeps session instrumentation at the business boundary by expressing lifecycle
changes as normalized event payloads instead of direct registry writes.
"""
@staticmethod
def record_lifecycle(*, action: str, status: str) -> None:
"""
Emit the outcome of a session lifecycle action such as create, get, delete, or commit.
The payload is expected to describe the final outcome of the action rather than
intermediate progress within the session workflow.
"""
EventMetricDataSource._emit(
"session.lifecycle",
{"action": str(action), "status": str(status)},
)
@staticmethod
def record_archive(*, status: str) -> None:
"""Emit the normalized outcome of one session archive attempt."""
EventMetricDataSource._emit(
"session.archive",
{"status": str(status)},
)