AgentLifecycleRegistry

Application-wide registry of every live agent's AgentLifecycle.

It is provided in the root injector, so an agent created in a route or component injector is still visible from the root. Instrumentation reads lifecycles() to observe every agent without owning the provider graph.

An agent registers when it is created and unregisters when the injector that created it is destroyed. Its lifecycle object stays the same across thread switches.

import { AgentLifecycleRegistry } from '@threadplane/angular';

Declaration

export declare class AgentLifecycleRegistry  {
  readonly lifecycles: Signal<readonly AgentLifecycle[]>;
  register(lifecycle: AgentLifecycle): void;
  unregister(lifecycle: AgentLifecycle): void;
}

Members

lifecycles

The lifecycles of every currently live agent.

readonly lifecycles: Signal<readonly AgentLifecycle[]>;

register · overload 1

register(lifecycle: AgentLifecycle): void;

Parameters

lifecycle · required
AgentLifecycle

Returns

void

unregister · overload 1

Drops a lifecycle when its agent's injector is destroyed.

unregister(lifecycle: AgentLifecycle): void;

Parameters

lifecycle · required
AgentLifecycle

Returns

void