core beginner

Signal Routing Agent

Interactive Jido example showing how signal type routing maps into actions and executes through AgentServer.call/2 and AgentServer.cast/2.

signals routing agent-server core-mechanics l1

Related guides and notebooks

lib/agent_jido/demos/signal_routing/actions/set_name_action.ex 19 lines
defmodule AgentJido.Demos.SignalRouting.SetNameAction do
  @moduledoc """
  Sets a human-readable name in agent state.
  """

  use Jido.Action,
    name: "set_name",
    description: "Sets agent name",
    schema: [
      name: [type: :string, required: true, doc: "Name to set on agent state"]
    ]

  @impl true
  @spec run(map(), map()) :: {:ok, map()}
  def run(%{name: name}, _context) do
    {:ok, %{name: name}}
  end
end