Observability Hooks • AI Agent SDK
ObservabilityHooks: Observability hooks for escalation pipeline.
ObservabilityHooks
Defined in the observability module.
AI Agent
Observability hooks for escalation pipeline.
Provides:
- Event emission
- Metrics collection
- Custom handler registration
- Tracing support
Constructor
ParamField
boolNo description available.
Methods
on()
Register an event handler.
off()Unregister an event handler.
emit()Emit an event.
set_session()Set current session ID.
set_stage()Set current stage.
increment_step()Increment step counter.
add_tokens()Add to token count.
get_events()Get all recorded events.
get_metrics()Get collected metrics.
reset()Reset all state.
start_execution()Mark execution start.
end_execution()Mark execution end.
get_summary()Get execution summary.
Usage
hooks = ObservabilityHooks()
# Register handler
hooks.on(EventType.STAGE_ESCALATE, lambda e: print(f"Escalated to {e.stage}"))
# Use with pipeline
pipeline = EscalationPipeline(observability=hooks)Source
View on GitHubpraisonaiagents/escalation/observability.py at line 116