Skip to content

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

agent_ref instance-attribute
agent_ref: Agent
asp_ref instance-attribute
insight_ref_pkids instance-attribute
insight_ref_pkids: List[str]
insight_txt instance-attribute
insight_txt: str
model_config class-attribute instance-attribute
model_config = ConfigDict(arbitrary_types_allowed=True)
session_ref instance-attribute
session_ref: ActivitySession

IntegrationService

IntegrationService(
    sa_session: SASession, neo4j_session: NJSession
)

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)
)
agent_dao instance-attribute
agent_dao = AgentDao(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_dao instance-attribute
memory_dao = MemoryDao(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:

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]],
]

Functions