Skip to content

Runner

The runner is the site_agent ChatProcessor plugin, behind \Drupal\site_agent\Runner\RunnerInterface. The site_agent.runner_plugin container parameter names the plugin, so another runner can replace it.

  • One execute() is one model turn, in two phases. beginTurn() appends the user's message, if any, and handles the calls still waiting from the model's previous reply. finishTurn() makes at most one model call, streamed, and stores the reply with its tool calls for the next turn to handle. Every request is a fresh execute(); state lives in the transcript and the tool-call records.
  • Model calls go through ai.provider with the model from the settings.
  • Tool definitions are built from each tool's Tool API JSON Schema, with refinements applied, and converted with Tool API's AI connector.
  • Calls run in the order the model returned them, through Tool API, as the requesting user. The provider never runs them. Before a call runs, its arguments are checked against the toolset's refinements, the structure gate, the tool's declared permission, its validation and its access().
  • Where a tool takes a revision log message, the runner hides that input from the model and fills it with the thread reference, such as "Site Agent thread 12: Change the hours", so the revision names the thread. Its title is the first line of the thread's first message, not the thread's current title: the reference is part of a pending call's payload, and the owner may rename the thread before approving. The write runs as the requesting user, who becomes the revision author.
  • After 100 rounds of tool calls without a user message, the runner stops and waits for one. The number is a setting.