Jido.Agent.Directive.StopChild (Jido v2.0.0-rc.0)

View Source

Request that a tracked child agent stop gracefully.

This directive provides symmetric lifecycle control for child agents spawned via SpawnAgent. It sends a shutdown signal to the child, allowing it to terminate cleanly.

The child is identified by its tag (the key used in SpawnAgent). If the child is not found, the directive is a no-op.

Fields

  • tag - Tag of the child to stop (must match a key in the children map)
  • reason - Reason for stopping (default: :normal)

Examples

# Stop a worker by tag
%StopChild{tag: :worker_1}

# Stop with a specific reason
%StopChild{tag: :processor, reason: :shutdown}

Behavior

The runtime sends a jido.agent.stop signal to the child process, which triggers a graceful shutdown. The child's exit will be delivered back to the parent as a jido.agent.child.exit signal.

Summary

Functions

Returns the Zoi schema for StopChild.

Types

t()

@type t() :: %Jido.Agent.Directive.StopChild{reason: any(), tag: any()}

Functions

schema()

@spec schema() :: Zoi.schema()

Returns the Zoi schema for StopChild.