ant_ai.a2a.compression
find_compression_checkpoint
find_compression_checkpoint(
related_tasks: list[Task],
) -> tuple[list[AnyMessage] | None, int]
Return (baseline_messages, task_index) for the most-recent compression checkpoint.
Scans all tasks in chronological order, keeping the last checkpoint found. Returns (None, 0) when no checkpoint exists in the chain.
Source code in src/ant_ai/a2a/compression.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
is_checkpoint_message
is_checkpoint_message(msg: Any) -> bool
Return True if an A2A message is a synthetic compression checkpoint.
Source code in src/ant_ai/a2a/compression.py
45 46 47 | |
persist_compression_checkpoint
async
persist_compression_checkpoint(
state: State, updater: TaskUpdater
) -> None
Persist the compression baseline into the current A2A task history.
Called just before the task is finalised. Writes a synthetic agent message with empty text and checkpoint metadata so future turns can restore the compressed baseline without replaying the full BFS history. Does nothing when compression did not fire this turn.
Source code in src/ant_ai/a2a/compression.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |