Execution Boundary

How run workers, the agent runtime, harnesses, and LLMs fit together.

Every Agentty request for model reasoning or generation goes through a worker-owned execution boundary: Run Worker → Agent Runtime → Harness → LLM. This includes session turns, titles, focused reviews, summaries, commit messages, review-request metadata, and conflict assistance.

flowchart TD
  A[Application workflow] -->|SessionRunClient or RunClient| W[Run Worker]
  W -->|waits for a turn slot| S[Scheduler]
  W -->|dispatches request| R[Agent Runtime]
  R -->|selects adapter| H[Harness]
  H -->|calls| L[LLM]
  R -.->|turn events and result| W

Execution graph nodes take the same path: Graph Executor admits them under the limits of Graph Resources and hands each to a Run Worker lane.

Crates🔗

ComponentCratesResponsibility
Schedulerag-schedulerSession admission
Run Workerag-workerAdmission, scheduling, cancellation, recovery
Agent Runtimeag-runtimeAdapter composition, dispatch, provider lifecycle
Shared contractsag-contracts, ag-protocolRequests, events, policy types, response schemas
Harness (external)ag-agentCLI and app-server adapters, policy enforcement
Harness (native)ag-harness, ag-harness-cliModel loop run in process by ag-agent, and CLI
LLMNoneReached through the harness
Supportingag-session, ag-storeSession models, model selection, and persistence

Dependency Rule🔗

Only ag-worker depends on ag-runtime, and only ag-runtime depends on ag-agent. Only ag-harness-cli and ag-agent may depend on ag-harness. Applications configure worker handles and import shared types from ag-contracts. A host that enables harness sessions must also call ag_worker::dispatch_sandbox_helper first in main, before starting any runtime, so its own executable serves as the native sandbox helper; without the call, commands run unsandboxed and every turn warns about it.

Commands a host runs on its own behalf in the native sandbox, such as commit hooks, involve no model. They take the same worker, runtime, and harness path through RuntimeConfig::session_commands, without scheduler admission.

The check-execution-boundary hook enforces this boundary on every commit: dependency rules cover all workspace dependencies, including test code, and source checks keep raw adapter use and agent CLI launches out of production code outside the execution crates.

See Module Map for ownership and Runtime Flow for orchestration and recovery.