Agent Lifecycle Signals
The @ngaf/langgraph library exposes per-agent lifecycle signals on every LangGraphAgent returned by agent(). These are timestamps and classifications derived from the existing stream — useful for debugging, custom dashboards, or telemetry integrations.
#Interface
#Derivation
Five of the eight signals derive directly from existing stream subjects on the agent (values$, messages$, error$, interrupt$, toolCalls$, history$):
| Signal | Source |
|---|---|
streamStartedAt | first non-empty values$ or messages$ emission |
streamErrorAt | error$ emission, classified |
interruptReceivedAt | first non-null interrupt$ value |
toolCallStartedAt | first tool-call append in toolCalls$ |
toolCallCompletedAt | first tool-call result transition in toolCalls$ |
Three signals require explicit hook points that the agent already invokes:
| Signal | Hook |
|---|---|
interruptResolvedAt | submit({ resume }) |
threadCreatedAt | the agent's "create new thread" branch |
threadPersistedAt | restore-from-server path |
#Subscribing
For app-wide instrumentation, provide AgentLifecycleRegistry and read the lifecycles registered by agents created in that injection context:
The exported AGENT_LIFECYCLE token is a low-level token for custom integrations. agent() does not automatically provide a different token instance for each agent.
#Reset semantics
All eight signals reset on switchThread(). This keeps lifecycle observations scoped to the current thread.
#Privacy
These signals contain no message content, no model output, no PII. They are timestamps, counts, and short classification strings only. The trust contract at libs/telemetry/README.md applies: no app telemetry by default. Reading lifecycle signals or providing AgentLifecycleRegistry does not fire any telemetry; what you do with the signal values is your choice.