docs(telemetry): clarify reserved subagent-lineage hooks

The subagent_start/stop hooks are registered but no-op. The prior comment implied
subagents need no handling because they inherit via contextvars — misleading, since
a delegated child runs on a separate thread with its own session id and trace.

Clarify the real situation: a subagent's model/tool calls are already captured as
their own tel_runs row via the child's run_conversation, so nothing is lost. These
hooks are reserved for recording parent->child lineage (needs a tel_runs.parent_run_id
column), deferred until a consumer needs the delegation tree. Comment-only.
This commit is contained in:
emozilla 2026-06-26 23:28:50 -04:00 committed by Victor Kyriazakos
parent 24c86e160b
commit 81a34156a5

View file

@ -296,9 +296,15 @@ def _as_float(v: Any) -> Optional[float]:
# ── subagent lineage (reserved) ─────────────────────────────────────────────
# A delegated subagent runs its own ``run_conversation`` with its own session id, so
# its model/tool calls are already captured as a separate tel_runs row via the normal
# hooks — no subagent activity is lost. These hooks fire with the parent<->child bridge
# (parent_session_id, child_session_id, child_role, child_goal); they are reserved for
# recording parent->child *lineage* (linking a child run back to its parent), which
# needs a tel_runs.parent_run_id column. Deferred until a consumer needs the delegation
# tree; left registered as the attachment point.
@_safe
def _on_subagent_start(**kw: Any) -> None:
# Subagents inherit the run context via contextvars; no explicit handling needed.
return None