Skip to content
providerkit
GitHub

LifecycleEvent

type LifecycleEvent =
| {
type: "run_start";
}
| {
state: RunState;
type: "run_end";
}
| {
attemptId: string;
input: ModelInput;
operationId: string;
type: "model_start";
}
| {
attemptId: string;
operationId: string;
turn: Turn;
type: "model_end";
}
| {
attemptId: string;
operationId: string;
type: "model_error";
}
| {
request: ToolRequest;
type: "tool_start";
}
| {
request: ToolRequest;
result: ToolResult;
type: "tool_end";
}
| {
request: ToolRequest;
type: "tool_error";
};

Defined in: agents/src/types.ts:406

Privileged host inspection, NOT safe display output. End hooks see raw output before its guard. Hooks are ordered and awaited, but exceptions/return values never authorize or block. They may repeat after a crash. Use guards for policy and onEvent for checked progress.