class

Autobot::Agent::Loop

Inherits Reference < Object

The agent loop is the core processing engine

It:

  1. Receives messages from the bus
  2. Builds context with history, memory, skills
  3. Calls the LLM via ToolExecutor
  4. Sends responses back

Constants

BACKGROUND_EXCLUDED_TOOLS = ["spawn"]

Tools excluded from background turns (cron jobs, subagent work).

FALLBACK_RESPONSE = "I've completed processing but have no response to give."
GENERIC_ERROR_MESSAGE = "Sorry, I encountered an unexpected error. Please try again."
HEARTBEAT_INTERVAL = 1.second
Log = ::Log.for("agent.loop")
LONG_MESSAGE_PREVIEW_LENGTH = 120
SHORT_MESSAGE_PREVIEW_LENGTH = 80
VOICE_NOTE_NOT_HEARD = "I could not hear that voice note. Voice transcription is not available here, so please type it instead."

Constructors

new(bus : Bus::MessageBus, provider : Providers::Provider, workspace : Path, tools : Tools::Registry, sessions : Session::Manager, model : String | Nil = nil, max_iterations : Int32 = 20, memory_window : Int32 = 50, cron_service : Cron::Service | Nil = nil, brave_api_key : String | Nil = nil, exec_timeout : Int32 = 60, exec_deny_patterns : Array(Regex) = Tools::ExecTool::DEFAULT_DENY_PATTERNS, exec_allow_patterns : Array(Regex) = [] of Regex, sandbox_config : String = "auto", rate_limiter : Tools::RateLimiter | Nil = nil, enabled_tools : Array(String) = [] of String, filesystem_roots : Array(String) = [] of String, web_allowed_domains : Array(String) = [] of String)
Source

Instance methods

process_direct(content : String, session_key : String = Constants::DEFAULT_SESSION_KEY, channel : String = Constants::CHANNEL_CLI, chat_id : String = Constants::DEFAULT_CHAT_ID) : String

Process a message directly (for CLI or cron usage).

Source
run

Run the agent loop, processing messages from the bus

Source
stop

Stop the agent loop

Source