Jido.Agent.Directive.StartSensor (Jido v2.3.0)

Copy Markdown View Source

Start or replace a tagged sensor runtime owned by the current agent runtime.

Sensors are tracked separately from child agents under {:sensor, tag} and do not participate in child-agent hierarchy signals.

By default sensors are unlinked but owner-monitored: a sensor crash emits jido.agent.sensor.exit to the owning agent, and the sensor stops itself if the owner exits. Use link?: true only for fail-fast input paths where a sensor crash should also crash the owning agent runtime.

Fields

  • tag - Agent-local tag for the sensor runtime
  • sensor - Sensor module to run under Jido.Sensor.Runtime
  • config - Sensor configuration map (default: %{})
  • meta - Metadata stored on the tracked sensor child info (default: %{})
  • replace? - Stop and replace an existing sensor with this tag (default: true)
  • link? - Link the sensor to the owning AgentServer so abnormal sensor exits can take the owner down (default: false)

Examples

%StartSensor{tag: :market_data, sensor: MyApp.MarketDataSensor}
%StartSensor{
  tag: {:poller, "AAPL"},
  sensor: MyApp.MarketDataSensor,
  config: %{symbol: "AAPL", interval: 1000}
}

Summary

Functions

Returns the Zoi schema for StartSensor.

Types

t()

@type t() :: %Jido.Agent.Directive.StartSensor{
  config: map(),
  link?: boolean(),
  meta: map(),
  replace?: boolean(),
  sensor: atom(),
  tag: any()
}

Functions

schema()

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

Returns the Zoi schema for StartSensor.