Skip to content

How a turn runs

Start with a concrete request. Suppose notes.txt contains:

[ ] Check the build
[x] Update the changelog
[ ] Run the tests

You ask Harness to report the unchecked items without changing files. The client sends the prompt to the daemon, which opens a turn for the session’s agent. The turn holds the work needed to answer, and may contain several model requests rather than one response and its tools.

The agent is the conversational worker: it has instructions and a pointer to its history. The daemon runs it. Runtime and session state explains that process and shared-state split.

For each request, the daemon prepares the agent’s history, instructions, available tools, and session settings. The request uses a selected model over a configured connection. A driver is the code that talks to a kind of model service; a connection is a configured link to it, such as an account.

An Actor handles one model request. While the reply streams, clients can show temporary progress. When it ends, the Actor records the successful or failed outcome in the session document and finishes. The Agent remains the conversational worker for later requests in the turn.

The model might request a read of notes.txt. The daemon records it as a separate tool job, checks that request against policy, runs it only when allowed, and records its result on the job. An approval applies to that request alone, not every operation in the turn. The request is a leaf: one operation beneath the surrounding work container. Tools and permissions explains policy decisions and human confirmation.

The model can instead submit a Scheme program that searches, filters, and reads selected files. The evaluator carries out those specified steps without asking the model to choose each step again. Every inner tool still has its own job and authorization. Composing tools shows a complete example.

After a tool finishes, its result can enter another model request in the same turn. A new Actor handles that request; the Agent’s conversation continues. For the example, the model can use the read result to report “Check the build” and “Run the tests.”

The model can also delegate a bounded task, such as asking a reviewer to check an edit. The worker has its own session and history. The caller records the delegation as a tool job and receives the worker’s explicit response as its result. The worker does not automatically receive the parent’s conversation or all its tools. See Agents and delegation.

One turn contains
model request: read notes.txt
tool request: authorization
→ file contents
next model request
→ answer

This sequence is illustrative, not a recorded provider transcript. The work could use more requests, tools, or delegation; the task and model determine the sequence.

A completed answer normally ends the turn. Work still queued, input that needs attention, or a worker that still owes a response can keep the loop going. The runtime also checks whether a text-only reply needs another model request; the session reference describes those checks.

A prompt submitted after a turn closes creates another turn linked to it, and advances the agent’s current-turn pointer. Input while a turn is open can steer that turn or queue a later one; it does not always create a turn immediately. The terminal renders history from session state rather than keeping a separate authoritative message list.

Recorded outcomes persist in the session document. Streaming progress is temporary, not a finished result. A crash does not show whether an unrecorded external effect happened, and reattaching does not mean every interrupted tool can safely be replayed.

Work and ownership defines the execution boundaries. Session, agent, and job gives the stored model fields, history links, and background-work rules.

This explanation follows the Harness session model and runtime implementation. The detailed rules and their source paths are linked from those reference pages.