• English
  • Execution loop

    ConceptResponsibility
    ThreadKeep one conversation and its history in a fixed workspace
    TurnExecute an admitted prompt or worker-result report
    StepInvoke the executor once and record its output

    Main requests, worker tasks, and result collection share the same execution machinery.

    One cycle

    Admit input
      → Apply pending model selection
      → Capture context and consume queued input
      → Request a model response
      → Validate completion
      → Execute requested tools in order
      → Record the step
      → Continue with tool results, or finish

    The captured settings and tool router govern both the model request and its tool calls. A tool result becomes input to the next step. Turns continue until completion, failure, interruption, or an explicitly configured step limit. Root and child turns have no step-count limit by default. The CLI accepts --max-steps Infinity (case insensitive) or a positive integer.

    Progress and committed history

    Text streams to the browser while the response is arriving. Core validates the complete response before executing its requested tools, then records history and publishes lifecycle events. Partial streamed text is provisional.

    Open Activity to see LLM calls, tool calls, and execution notices in a single vertical timeline in the right-hand panel, distinguished by icons. Chat and the composer remain visible. Activity omits user messages and assistant replies; Chat retains them. Select a call in Chat or Activity to expand its Request and Response tabs at the corresponding timeline row. Selecting another call collapses the previous exchange; no detail column opens. Bodies and fenced code support syntax highlighting and copying. These details survive browser reloads during the server session. Failed requests retain the request and any received error response; transport failures may have no response. Authentication headers and encrypted reasoning are excluded from diagnostics.

    Input and failure

    Next-step input steers an active turn. Next-turn input waits in the browser until the conversation is idle. Agent messages are read at step boundaries and do not start an idle conversation.

    Tool errors return to the model as results it can act on. Provider failures end the turn while retaining completed steps and tool effects. Child interruption cancels execution and preserves history for later reuse.

    Implementation: session/turn.rs.