integration_service
Agent memory integration service module
Integration, a.k.a. reflection is the process where an agent’s memories are consolidated into newer, higher-level insights.
Attributes
IntegrationInsightWorkQueueType
module-attribute
IntegrationInsightWorkQueueType = List[
Tuple[
ActivitySession,
Agent,
ActivitySessionParticipant,
List[str],
]
]
IntegrationInsightsResponseLookupType
module-attribute
IntegrationInsightsResponseLookupType = List[
Tuple[
ActivitySession,
Agent,
ActivitySessionParticipant,
Dict[int, RetrievedMemory],
]
]
IntegrationInsightsType
module-attribute
IntegrationInsightsType = Tuple[
IntegrationInsightsResponseLookupType,
InvokeServiceResponse,
]
QuestionsWorkQueueType
module-attribute
QuestionsWorkQueueType = List[
Tuple[
ActivitySession, Agent, ActivitySessionParticipant
]
]
Classes
IntegrationMemoryWorkQueueRecord
Bases: BaseModel
Attributes
model_config
class-attribute
instance-attribute
IntegrationService
Bases: BaseService
Cognitive integration operation handler
Attributes
activity_session_dao
instance-attribute
activity_session_dao = ActivitySessionDao(
session=sa_session
)
activity_session_participant_dao
instance-attribute
activity_session_participant_dao = (
ActivitySessionParticipantDao(session=sa_session)
)
chain_service
instance-attribute
chain_service = ChainService(
sa_session=sa_session, neo4j_session=neo4j_session
)
collection_service
instance-attribute
collection_service = MemoryCollectionService(
sa_session=sa_session, neo4j_session=neo4j_session
)
memory_collection_dao
instance-attribute
memory_collection_dao = MemoryCollectionDao(
session=sa_session
)
memory_service
instance-attribute
memory_service = MemoryService(
sa_session=sa_session, neo4j_session=neo4j_session
)
Functions
get_memories_by_session
get_memories_by_session(
agent_pkid: str,
context: str,
session_pkid: str,
update_access: bool = True,
) -> GetMemoriesResponse
Retrieves agent memories, derive retrieval settings from session
Parameters:
-
agent_pkid
(str
) –The primary key of the agent.
-
context
(str
) –The context of the memories.
-
session_pkid
(str
) –The primary key of the session.
-
update_access
(bool
, default:True
) –Whether to update the access timestamp of the memories. Defaults to True.
Returns:
-
GetMemoriesResponse
–List[RetrievedMemory]: A list of retrieved memories.
Raises:
-
ServiceError
–If the session is not found, soft-deleted, disabled, or does not belong to the agent.
run_integration_operation
run_integration_operation(
session_pkids: List[str],
memo: Optional[str] = None,
trace_session_id: Optional[str] = None,
) -> Tuple[
List[Tuple[int, Memory]],
List[Tuple[int, AddMemoryRequest]],
]