AgentEvents¶

class AgentEvents[source]¶

Bases: ABC

Abstract base class for AgentApp run events.

Methods

emit(event)

Emit one structured run event.

get_compacted_contexts(*[, limit, ...])

Return the newest summaries.

get_trace(*[, event_types, after_event_id, ...])

Get matching events from all runs in the current run series.

put_compacted_context(*, through_event_id, text)

Store a summary.

abstract emit(event: JSONObject) → None[source]¶

Emit one structured run event.

abstract get_compacted_contexts(*, limit: int = 1, before_context_id: int | None = None) → list[JSONObject][source]¶

Return the newest summaries.

abstract get_trace(*, event_types: Sequence[str] | None = None, after_event_id: int | None = None, before_event_id: int | None = None, last_n: int | None = None) → list[JSONObject][source]¶

Get matching events from all runs in the current run series.

Parameters:
  • event_types (Optional[Sequence[str]] (default: None)) – Filter by the given event types. If unset, include all event types. Use RUN_SUMMARY_EVENT_TYPES for common summary inputs.

  • after_event_id (Optional[int] (default: None)) – Return events with IDs greater than this value.

  • before_event_id (Optional[int] (default: None)) – Return events with IDs less than this value.

  • last_n (Optional[int] (default: None)) – Return the newest N matching events in ID order. If unset or zero, return all matching events.

Returns:

Matching event envelopes.

Return type:

list[JSONObject]

abstract put_compacted_context(*, through_event_id: int, text: str) → None[source]¶

Store a summary.