Jido.Messaging.AgentRunner (Jido Messaging v1.0.0)

Copy Markdown View Source

GenServer that manages an agent's participation in a specific room thread.

Each assigned thread gets its own AgentRunner process that:

  • Subscribes to room-level message_added signals
  • Filters down to one room/thread assignment
  • Invokes the configured handler
  • Delivers replies through Jido.Messaging.Deliver

Summary

Functions

Returns a specification to start this module under a supervisor.

Get current runner state.

Returns the Zoi schema.

Start an AgentRunner for an assigned room thread.

Gracefully stop the runner.

Check if a thread-scoped agent runner is running.

Types

agent_config()

@type agent_config() :: %{
  :agent_id => String.t(),
  :handler => (map(), map() ->
                 {:reply, String.t()} | :noreply | {:error, term()}),
  :name => String.t(),
  optional(:mention_handles) => [String.t()],
  optional(:trigger) => atom()
}

t()

@type t() :: %Jido.Messaging.AgentRunner{
  agent_config: map(),
  agent_id: binary(),
  instance_module: any(),
  room_id: binary(),
  subscribed: boolean(),
  thread_id: binary()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_state(server)

Get current runner state.

schema()

Returns the Zoi schema.

start_link(opts)

Start an AgentRunner for an assigned room thread.

Required options:

  • :room_id
  • :thread_id
  • :agent_id
  • :agent_config
  • :instance_module

stop(server)

Gracefully stop the runner.

via_tuple(instance_module, room_id, thread_id, agent_id)

Generate a registry via tuple.

whereis(instance_module, room_id, thread_id, agent_id)

Check if a thread-scoped agent runner is running.