Skip to content

Feature request: structured context overflow event payload contract #4378

@drukpa1455

Description

@drukpa1455

Summary

Expose a structured overflow/compaction event payload as a stable contract for app instrumentation and tests.

Motivation

Apps implementing long-running agents currently infer overflow behavior from exceptions or ad-hoc strings. A typed payload would make retries, audit, and tests deterministic.

Proposal (additive)

  • Add a small payload shape for overflow/compaction outcomes, e.g.:
    • reason (usage_limit_exceeded, context_limit_error, ...)
    • action (retry_compacted, retry_trim, fail)
    • trim_retries, max_trim_retries
    • optional error (truncated)
  • Keep this opt-in and backward compatible.
  • No provider-specific policy in V1.

Why separate from #4137

#4137 is the compaction abstraction. This issue is a narrower observability/testing contract that can be useful even with custom app-level compaction.

Offer

Happy to implement this behind a minimal additive API, pending maintainer scope approval.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions