Concepts

Callback Handler

Pluggable observability hooks (on_step_start, on_step_end, on_error, etc.) — swap in custom logging, timing, or monitoring logic without touching core chain code.

Why it exists

Debugging and monitoring shouldn't require modifying chain logic itself — callbacks let you observe what's happening from the outside.

View source on GitHub
educhain.py
from educhain.core.callbacks import CallbackHandler, PrintCallbackHandler

model = ChatModel(callbacks=[PrintCallbackHandler()])

Related