Runs post-invocation compaction based on a token threshold. If triggered, this compacts older raw events and keeps the last `event_retention_size` raw events un-compacted.
(
app: App, session: Session, session_service: BaseSessionService
)
| 418 | |
| 419 | |
| 420 | async def _run_compaction_for_token_threshold( |
| 421 | app: App, session: Session, session_service: BaseSessionService |
| 422 | ): |
| 423 | """Runs post-invocation compaction based on a token threshold. |
| 424 | |
| 425 | If triggered, this compacts older raw events and keeps the last |
| 426 | `event_retention_size` raw events un-compacted. |
| 427 | """ |
| 428 | if app.root_agent is None: |
| 429 | return None |
| 430 | return await _run_compaction_for_token_threshold_config( |
| 431 | config=app.events_compaction_config, |
| 432 | session=session, |
| 433 | session_service=session_service, |
| 434 | agent=app.root_agent, |
| 435 | agent_name='', |
| 436 | current_branch=None, |
| 437 | ) |
| 438 | |
| 439 | |
| 440 | async def _run_compaction_for_sliding_window( |
no test coverage detected