sUAS Intelligent Mission Planner
Deterministic energy and performance feasibility for small unmanned aircraft. The language model writes prose; the calculator writes every number. Advisory only: today operational mode is unreachable.
What it is. Deterministic energy and performance feasibility for small unmanned aircraft. The language model writes prose; the calculator writes every number.
What it is not. It is explicitly not an airspace, NOTAM, or regulatory clearance tool. A GO means only that the energy budget and airframe envelope close. Today operational mode is unreachable.
Eval. The frozen mission pack and generated leaderboard live in eval/. One failure trace, Qwen no_tools on pack_procedure pp-01 from the 2026-11-14 run, is in eval/traces/. The writeup of both local-model runs is in eval/WRITEUP.md. The advisory demo and this frozen pack are pinned at tag v0.4.0-eval.
[!WARNING]
Advisory only, not a clearance. This is an energy and performance
feasibility calculator. It is explicitly not an airspace, NOTAM, or regulatory
clearance tool, and a GO means only that the energy budget and airframe
envelope close. Today operational mode is unreachable: every plan comes back
advisory, with blockers naming what is missing. See
Advisory and operational.
An async AI orchestration and deterministic physics engine for small unmanned
aircraft system (sUAS) flight planning. A LangGraph state machine coordinates
validation, live weather, deterministic safety math, and a language-model
safety brief. A Next.js dashboard drives it. The reference data covers a set of
DIU/DCMA Blue UAS (NDAA-compliant) multirotor platforms.
Full demo recording (62 seconds, WebM): catalog, an advisory plan, review, signature, brief, and a NO-GO when the energy budget does not close. No operational claim. Every on-screen number comes from the committed fixtures and the calculator. The GIF above is a compact copy of that recording.
Contents
Quickstart
Docker Compose, from the repository root.
Demo, no keys
cp .env.example .env
DEMO_MODE=true docker compose up --build
Open http://localhost:3000. Demo mode needs no model key, no API key and no
weather provider. Every plan uses a fixed fixture reading tagged fixture, so
the gate blocks operational (WEATHER_NOT_LIVE) and every plan is advisory.
Never fly on a demo plan. With the stack up, python3 scripts/compose_smoke.py
checks the catalog through the frontend against the frontend's types and walks
plan, acknowledge and read-back. scripts/e2e.sh brings the stack up, runs
the smoke and then a Playwright browser test of the same path, and tears it
down. Both run locally; neither is a CI job.
Live weather
- Copy
.env.example to .env and set at least POSTGRES_PASSWORD. Add
OPENAI_API_KEY to enable the model narrative (optional).
- Run
docker compose up --build.
- Open
http://localhost:3000.
Without an OPENAI_API_KEY, the app still runs. The report node returns a
deterministic go/no-go summary instead of a model narrative.
Architecture
- Frontend. Next.js 15 (App Router, standalone output), React 19, TypeScript strict, TailwindCSS.
- Backend. FastAPI on Python 3.11 to 3.13, fully async request path.
- Orchestration. LangGraph 1.x
StateGraph with a conditional edge and durable checkpointing.
- Language model.
langchain-openai ChatOpenAI, called with ainvoke, timeout, and bounded retries.
- Database. PostgreSQL 16 via async SQLAlchemy 2.0 (SQLite for local and tests).
- Migrations. Alembic, async-aware, verified against the ORM models in CI.
- Persistence of graph state.
AsyncPostgresSaver in production, InMemorySaver otherwise.
- Observability. request correlation, JSON logs, Prometheus metrics, split liveness and readiness.
- Deployment. Docker Compose with health checks and non-root images.
Graph design
The graph is defined in backend/suas/graph/. Nodes are built by factories that
receive dependencies explicitly, so no node relies on global state and each is
unit testable. The flow is a single column, so it stays readable on a phone:
- START →
validate
validate → weather when the setup is viable, otherwise straight to report
weather → calculations → cite_limits → human_ack
human_ack → report on confirm, back to calculations on edit, or END on abort
report → END
human_ack interrupts the run and waits for a person. The order is a security
control rather than a workflow preference: the operator signs an assessment that
neither retrieved text nor generated prose has touched, so nothing a model
produces can change what was signed. See
ADR-004. The report node has
no tools bound, for the same reason. Both are pinned by tests that fail if the
invariant is removed.
The dashboard holds the same line. While a plan awaits its signature there is no
brief on screen, even if a response carried one; the review card shows only the
sealed verdict, mode, limiting factors, calculator version and the full inputs
hash it will sign. Editing any mission input after the assessment disables the
confirm until the mission is analyzed again (frontend/src/lib/review.ts).
State and checkpoints
State holds only JSON-native values. Pydantic models are dumped to dictionaries
before entering state, which keeps checkpoint serialization simple and safe.
The container sets LANGGRAPH_STRICT_MSGPACK=true to restrict checkpoint
deserialization to known-safe types.
Every request supplies a thread_id, or gets a server-generated UUID. A
client-chosen id must match ^[A-Za-z0-9_-]{1,128}$ (else 422): : is reserved
for the server's replan children, <id>:<n>, which belong to their parent's
operator. GET, ack and replan accept any id up to 255 characters, so ids stored
before that rule still resolve. The checkpointer persists state per thread,
so GET /api/plan/{thread_id} can retrieve a prior assessment and a follow-up
request can resume the same conversation. Checkpoints are written with
durability="sync", so a crash between the assessment and the signature loses
neither.
Authentication and the API key
The browser never holds a credential. It calls this app's own origin, and
server-side Next.js route handlers under frontend/src/app/api/ proxy each
request to the backend, attaching X-API-Key from BACKEND_API_KEY. That
variable is deliberately not prefixed NEXT_PUBLIC_, so Next.js will not inline
it into the client bundle.
This replaces an earlier arrangement where the key was read from
NEXT_PUBLIC_API_KEY and shipped inside the JavaScript bundle, which meant
enabling auth published the key to every visitor. Only the Next.js server needs
network reach to the backend now; the backend does not have to be exposed to
browsers at all.
Keys are per operator (#81). SUAS_API_KEYS=alpha:key-a,bravo:key-b gives
each key an operator id; the older single SUAS_API_KEY still works as operator
default. Each mission records the id of the key that planned it, and only that
key can read, acknowledge or replan it. Asking with another key gets exactly
the answer an unknown thread gets (found: false on GET, 404 elsewhere), so
holding someone's thread id tells you nothing. A key list that repeats an id or
a key refuses to start.
Each browser is its own operator (#82). The Next.js server gives every new
browser a random 256-bit session id in an HttpOnly, SameSite=Strict
cookie (Secure over HTTPS), and sends the backend
session.<id>.<HMAC-SHA256(secret, id)> instead of a shared key. The backend
checks the MAC with SUAS_SESSION_KEY_SECRET and scopes missions to that
session, so two browsers cannot read, acknowledge or replan each other's
threads. Neither the secret nor any derived key reaches the browser, and a
POST whose Origin is not this app's is refused with 403 before it reaches
the backend. The session is anonymous: clearing cookies loses that browser's
threads, and there are still no accounts or roles.
Default Compose ships a public, demo-only secret so this works with no setup;
the backend logs a warning while it is in use. Set SESSION_KEY_SECRET (32 or
more random characters) before anyone else can reach the stack. Without
BACKEND_SESSION_SECRET the proxy falls back to the single BACKEND_API_KEY.
Quality gates
Every job in .github/workflows/ci.yml, as of main
today. A blocking job turns the run red when its rule fails; changes merge only
on a fully green run. That is project practice: the branch ruleset does not yet
list required status checks. Rules and rationale for each gate are in
docs/engineering-practices.md.
backend (blocks). On Python 3.11, 3.12 and 3.13: ruff lint (including the bandit S rules), ruff format, mypy --strict, pytest with coverage at 80% or more, and migrations that apply and match the models.
postgres-integration (blocks). Real Postgres: migrations apply, the app boots end to end, /ready refuses an unmigrated database, and concurrent startup seeds all succeed.
calculator-version (blocks, pull requests only). A change to backend/suas/calculations/ must bump CALCULATOR_VERSION.
ub-mode (blocks). CRAP below 10 for every function in backend/suas, and no unlisted duplicate pair at 0.8 or above.
frontend (blocks). tsc, ESLint (cyclomatic complexity 10 or less, plus @next/eslint-plugin-next), the UI standard scan (docs/ui-standard.md), Prettier, Vitest (which includes axe-core over the planner page and a keyboard-only acknowledgment), production build.
docker (blocks on the build). Both images build. Its trivy scan of HIGH and CRITICAL findings is report-only (job summary).
workflow-lint (blocks). actionlint and zizmor over .github/: actions pinned to commits, no template injection, least-privilege tokens.
secrets-scan (blocks). gitleaks, a checksum-verified pinned release, over the full history.
mutation (report-only). Surviving mutants (mutator) in the changed backend modules, or the safety core on main.
Outside ci.yml, both report-only:
audit.yml runs pip-audit and npm audit
every Monday and on demand, and sbom.yml writes
CycloneDX SBOMs of both images on each v* tag.
Run the gates locally
Backend:
cd backend
ruff check suas tests alembic scripts ../eval # lint
ruff format --check suas tests # formatting
mypy suas # strict type check
pytest -q --cov=suas --cov-fail-under=80
alembic upgrade head && alembic check # migrations apply and match models
python scripts/smoke_check.py # boots the real lifespan end to end
Frontend: