Preflight checks
Before an agent run begins, the platform can execute a suite of checks against the project repository inside the sandbox. These checks surface problems such as a broken build, failing tests, or a missing environment that would cause the agent to struggle from the start.
The check suite is run by swecli preflight run and produces a JSON report. The platform reads that report and makes it available in the session.
Modes
Preflight supports three modes, passed as --mode:
The platform uses session mode by default (sandbox_preflight_required_mode).
When preflight runs
Preflight runs on demand through the session API. In a chat session, you can trigger it from the agent by asking it to run preflight, or the platform may run it automatically before handing control to the agent. The result is attached to the session and visible in the run record.
A completion gate is available but off by default (sandbox_preflight_completion_gate_enabled). When it is on, the platform requires preflight to pass before an implementation run is allowed to proceed.
Commands
Inside a sandbox, swecli exposes three preflight subcommands:
All three write output as JSON by default (--format json) and accept --format markdown for human-readable output.
Where results appear
The preflight report is a JSON object with a status field (passed, failed, or error) and per-check detail. When the platform triggers preflight on a session, the result is stored in the run record for that session and visible in Run History under the session's entry. An error result means the check runner itself malfunctioned, not that the project tests failed.
Preflight runs inside the sandbox, so it sees the repository at the exact state the agent will start from. A passing result does not guarantee later agent work will succeed if the agent modifies the environment.
Next steps
- Agent sandboxes: sandbox lifecycle and creation.
- Runs: where run records and their attached evidence live.