refreshOnRunEnd

Call fn whenever the agent's status transitions out of 'running' (i.e. when a run completes — success, error, or interrupt). Useful for refreshing thread lists, telemetry, or any other state that lags the agent.

Must be called within an injection context (constructor or runInInjectionContext) — uses Angular's effect under the hood.

import { refreshOnRunEnd } from '@threadplane/langgraph';

Declaration · overload 1

export declare function refreshOnRunEnd(agent: LangGraphAgent, fn: () => void | Promise<void>): void;

Parameters

agent · required
LangGraphAgent
fn · required
() => void | Promise<void>

Returns

void

Examples

constructor() {
  refreshOnRunEnd(this.agent, () => this.threads.refresh());
}