Files
cdsl-cad/backend

Backend

The backend owns the application API and CAD generation workflow:

  • app/: HTTP API, jobs, orchestration, and persistence adapters.
  • agent/: AI prompts, tools, and skills used by the generation agent.
  • engine/: CDSL compiler, sketch solver, and STEP generation runtime.
  • cdsl_library/: Official CDSL examples, metadata, and search index.
  • tests/: Engine, API, and end-to-end generation tests.

Expected development entrypoint: app.main:app, served by Uvicorn.

Incremental Generation Configuration

Incremental generation is enabled by default. It requires a separately configured vision-capable review model and the Python OpenCascade/Pillow technical renderer; a run fails instead of skipping visual review when either is unavailable.

# Authoring provider/model must already be configured as usual.
CDSL_INCREMENTAL_GENERATION=1

# Must name one configured provider and one model listed in that provider's
# CDSL_<PROVIDER>_VISION_MODELS setting. It is intentionally not inferred
# from the authoring model.
CDSL_REVIEW_PROVIDER=openai
CDSL_REVIEW_MODEL=gpt-4.1-mini
CDSL_OPENAI_VISION_MODELS=gpt-4.1-mini

# Install Python rendering dependencies. The renderer reads the revision STEP
# file and creates canonical images without a browser or GPU driver.
pip install -r requirements.txt

# Optional per-node retry budgets.
CDSL_NODE_AUTHORING_ATTEMPTS=2
CDSL_NODE_REPAIR_ATTEMPTS=2
CDSL_NODE_REPLAN_ATTEMPTS=1

Every checkpoint is rebuilt from its fully materialized CDSL through the cdsl_only runtime. Checkpoint GLB files are preview-only; STEP, CDSL, and reports are available only after the task reaches COMPLETED.

The generation plan contains semantic node IDs only. The backend derives the unique CDSL feature and sketch IDs from each node, then writes them during fragment materialization. This keeps naming and topology ownership stable without requiring the authoring model to reproduce internal identifiers.