How to scaffold bb_jido modules with Igniter

Copy Markdown View Source

bb_jido ships four Igniter tasks for the boilerplate parts of wiring agents up: declaring a Jido instance, adding it to the supervision tree, creating an agent, and creating individual actions.

One-shot install

mix igniter.install bb_jido runs bb_jido.install, which always declares a Jido instance and (when --robot is given) scaffolds an agent for it:

mix igniter.install bb_jido --robot MyApp.Robot

After that:

lib/my_app/jido.ex           use Jido, otp_app: :my_app
lib/my_app/robot/agent.ex    use Jido.Agent with BB.Jido.Plugin.Robot
lib/my_app/application.ex    children list gains {Jido, [name: MyApp.Jido]}

You're now one Jido.start_agent/3 call away from a running agent.

Individual tasks

mix bb_jido.add_jido_instance

Creates the Jido instance module and adds {Jido, name: <module>} to the application's supervision tree.

mix bb_jido.add_jido_instance
mix bb_jido.add_jido_instance --jido-instance MyApp.AgentRuntime

Idempotent — running it again is a no-op.

mix bb_jido.add_agent

Creates an agent module that attaches BB.Jido.Plugin.Robot for the given robot.

mix bb_jido.add_agent --robot MyApp.Robot
mix bb_jido.add_agent --robot MyApp.Robot --agent MyApp.MainAgent --name main_robot
FlagDefaultNotes
--robot{AppPrefix}.RobotRobot module the agent drives
--agent{robot}.AgentModule name for the agent
--namesnake_cased last segmentJido name: string

The task does not start the agent — that's a runtime call:

Jido.start_agent(MyApp.Jido, MyApp.Robot.Agent, id: "main")

mix bb_jido.add_action

Scaffolds a Jido action with a run/2 stub returning {:ok, %{}}.

mix bb_jido.add_action MyApp.Actions.Pick
mix bb_jido.add_action MyApp.Actions.MovePose --safety-aware
mix bb_jido.add_action MyApp.Actions.Teleop --name teleop_step \\
  --description "Drive the robot from a teleop joystick"

--safety-aware mixes in BB.Jido.Action.SafetyAware and seeds the schema with a :robot field, so the action refuses to run unless BB.Safety.state(robot) == :armed.

FlagDefaultNotes
--namesnake_cased last segmentJido name: string
--description(none)Jido description: string
--safety-awarefalseAdd the safety guard mixin

What the tasks don't do

  • They don't add bb_reactor as a dependency — bb_jido doesn't depend on it, and not every agent needs workflows.
  • They don't patch existing plugins: lists or signal_routes: maps — once an agent exists, hand-editing is straightforward and avoids the fragility of source patching.
  • They don't generate example apps or a runnable simulation — the inline tutorials cover that path.