Acontext will start to process the messages once the buffer is full (i.e. unprocessed message turns >= PROJECT_SESSION_MESSAGE_BUFFER_MAX_TURNS)So if your PROJECT_SESSION_MESSAGE_BUFFER_MAX_TURNS is 3:
Copy
from acontext import AcontextClientclient = AcontextClient( api_key="sk-ac-your-root-api-bearer-token", base_url="http://localhost:8029/api/v1")# this storing won't be processed immediatelyclient.sessions.store_message( session_id="session-uuid", blob=message1, format="openai")# this storing won't be processed immediatelyclient.sessions.store_message( session_id="session-uuid", blob=message2, format="openai")# will trigger the processing immediatelyclient.sessions.store_message( session_id="session-uuid", blob=message3, format="openai")
Acontext will start to process the messages once the buffer is IDLE for a while (i.e. no new messages for PROJECT_SESSION_MESSAGE_BUFFER_TTL_SECONDS seconds)So if your PROJECT_SESSION_MESSAGE_BUFFER_TTL_SECONDS is 3:
Copy
from acontext import AcontextClientimport timeclient = AcontextClient( api_key="sk-ac-your-root-api-bearer-token", base_url="http://localhost:8029/api/v1")# this storing won't be processed immediatelyclient.sessions.store_message( session_id="session-uuid", blob=message1, format="openai")time.sleep(3)# Acontext will start to process the messages in background.
You can check the observing status of messages in your session to understand how many are observed, in process, or pending:
Copy
from acontext import AcontextClientclient = AcontextClient( api_key="sk-ac-your-root-api-bearer-token", base_url="http://localhost:8029/api/v1")# Get message observing status for a sessionstatus = client.sessions.messages_observing_status(session_id="session-uuid")print(f"Observed: {status.observed}")print(f"In Process: {status.in_process}")print(f"Pending: {status.pending}")print(f"Last Updated: {status.updated_at}")
Messages that have been fully processed and observed by the system. These messages are complete and available for analysis.
In Process
Messages currently being processed by the system. These are actively being analyzed or transformed.
Pending
Messages waiting in the buffer to be processed. These will be processed once the buffer conditions are met (full buffer or TTL expired).
Use messages_observing_status() to monitor buffer health and ensure messages are being processed as expected. A high number of pending messages may indicate you need to adjust buffer settings or call flush() manually.