One turn through OpenHands

    architecture node:

    Representation at this boundary

    Source modules

      Loop map

      One pass — send_message → hook interception on the event stream → view-built prompt → llm.generate → classify_response → parallel tool batch → observations → critic-gated finish. Everything is an event; the model only ever sees the cached view, never the raw stream.
      Hooks, not branches — hooks are stream interceptors, not turn branches: UserPromptSubmit, PreToolUse, and Stop hooks run inside on_event. A deny blocks the message or the action; a Stop-hook deny un-finishes a turn. Hook executors are fail-open.
      Outer turn loop — max_iteration_per_run (500) bounds the loop, but finish is a proposal, not a stop: the critic’s iterative refinement and Stop hooks can both veto it. The next user message re-enters at step 1; the event log persists every step as JSONL.