> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maximem.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# conversation.context.get_compaction_status

> Check whether a conversation has compacted context, whether it's stale, and whether a compaction run is in progress.

```python theme={null}
await sdk.conversation.context.get_compaction_status(
    conversation_id: str,
) -> CompactionStatusResponse
```

Returns the current compaction state for a conversation. Use this after [`compact`](/sdk-reference/conversation-context/compact) to poll for completion before calling [`get_compacted`](/sdk-reference/conversation-context/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

<ParamField path="conversation_id" type="str" required={true}>
  The conversation to inspect. Must be a valid UUID [registered via `record_message`](/concepts/context-end-to-end#short-term-context).
</ParamField>

### Returns

A `CompactionStatusResponse` describing the current state.

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

### Example

```python theme={null}
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

* [conversation.context.compact](/sdk-reference/conversation-context/compact)
* [conversation.context.get\_compacted](/sdk-reference/conversation-context/get-compacted)
* [conversation.context.get\_context\_for\_prompt](/sdk-reference/conversation-context/get-context-for-prompt)
