Execution lifecycle¶
One execution has a configuration phase followed by a bounded model and tool loop.
1. Configure¶
Before the first provider call, Pilota:
- creates an execution ID,
- selects or validates limits,
- builds the result codec and schema,
- renders instruction inputs,
- combines explicit tools with resource tools,
- validates unique tool names,
- snapshots the workspace,
- records
execution.started.
Configuration failures stop before the model receives a request.
2. Request a model action¶
Pilota constructs a ModelRequest containing:
- execution ID,
- task,
- context,
- rendered instructions,
- tool specifications,
- result schema,
- prior tool calls,
- matching observations.
The provider returns one of:
- a
ToolCall, - a batch of
ToolCallvalues, - a
FinalResult.
3. Execute tool actions¶
Tool-call batches are executed sequentially. For each call, Pilota:
- checks cancellation and wall time,
- checks the tool-call budget,
- finds the named tool,
- records
tool.started, - invokes the tool,
- records completion, denial, or failure,
- stores an observation for the next model request.
A final result submitted in the same batch as other tools is rejected. Completion must be a separate action after prior tools finish.
4. Validate completion¶
Pilota decodes the submitted value with the requested result type.
If validation fails:
- it records
result.rejected, - adds the validation error as an observation,
- requests a corrected result if retry and model-call budgets remain.
If validation succeeds, Pilota records result and artifact events and returns Execution[T].
5. Preserve partial evidence¶
Cancellation, limit exhaustion, and provider failures attach the execution ID, trace, and current workspace artifacts to the raised error.