Skip to main content

OnSpawnHook

Type Alias OnSpawnHook 

Source
pub type OnSpawnHook = Arc<dyn Fn(u32) + Send + Sync>;
Expand description

Callback invoked once with the OS pid of the spawned agent subprocess.

Set via Agent::set_on_spawn_hook (or crate::builder::AgentBuilder::on_spawn) so callers that need to act on the running child โ€” for example, updating a process registry so zag ps kill self can SIGTERM the agent child instead of the parent zag process โ€” can capture the pid right after spawn and before the terminal wait.

The callback fires once per spawn, with the pid of the direct provider subprocess. On retries or resumes the callback fires again for the new child. pid is not guaranteed to still be alive by the time the callback runs; use the OS to confirm before signaling.

Aliased Typeยง

pub struct OnSpawnHook { /* private fields */ }