Skip to main content
await sdk.conversation.context.get_compaction_status(
    conversation_id: str,
) -> CompactionStatusResponse
Returns the current compaction state for a conversation. Use this after compact to poll for completion before calling get_compacted. The SDK checks its in-process anticipation cache first — if a compaction_update bundle has been pushed for this conversation, the call returns status="completed" immediately without a network round-trip.

Parameters

conversation_id
str
required
The conversation to inspect. Must be a valid UUID registered via record_message.

Returns

A CompactionStatusResponse describing the current state.
conversation_id
str
Echo of the supplied conversation id.
status
str
One of "none", "in_progress", "completed", or "failed".
compaction_id
str | None
Identifier of the latest compaction run, when one exists.
completed_at
datetime | None
When the latest compaction completed.
compression_ratio
float | None
Ratio of compacted-to-raw token count for the latest run. Lower values indicate more aggressive compression.
validation_score
float | None
Quality score for the latest compaction (0.0–1.0). Reflects how well the compacted summary preserves the original conversation’s information.
estimated_completion_seconds
int | None
For status="in_progress", an estimated number of seconds until completion.
error_message
str | None
Failure reason when status="failed".
latest_version
int | None
Version number of the latest compaction. Increments each time a new run completes.
latest_created_at
datetime | None
When the latest compaction run was started.

Example

import asyncio
import uuid
from maximem_synap import MaximemSynapSDK

sdk = MaximemSynapSDK(api_key="synap_your_key_here")
await sdk.initialize()

# conversation_id must be a valid UUID; reuse the conversation's id
conversation_id = str(uuid.uuid4())

job = await sdk.conversation.context.compact(
    conversation_id=conversation_id,
)

# Poll until the run completes
while True:
    status = await sdk.conversation.context.get_compaction_status(
        conversation_id=conversation_id,
    )
    if status.status in ("completed", "failed"):
        break
    await asyncio.sleep(2)

print(f"Final status: {status.status}")

Raises

  • AuthenticationError — when the API key is missing or invalid.
  • NetworkError — when the SDK cannot reach Synap.

See also