Catalog PyPI
PACKAGE EXPLORERView in registry

agentcad-cli

PyPI

Agent-first CAD workflow runtime

Versions collected1
Direct dependencies2From release 0.3.1
Last observed20 Oct, 21:36 UTC

README

Version 0.3.1 documentation

AgentCAD

PyPI

AgentCAD is a CLI-first CAD workflow runtime for coding agents.

It gives a coding agent a repeatable workspace, a contract-driven modeling protocol, deterministic build/export, geometric measurement, multi-view previews, design-time and post-build validation, regression snapshots, assembly validation, workflow diagnostics, and a delivery manifest — so the agent can iterate on CAD models with measurable feedback instead of visual intuition.

discovery -> concept -> design contract -> suggest-checks -> precheck
  -> params/source -> build -> measure -> render -> validate
  -> preview-check -> probe proof -> review -> quality review -> workflow

If interrupted at any stage, agentcad doctor <model> reports workflow gaps and recommends the next command. Before final handoff, agentcad workflow <model> is the hard gate: it runs the nonblocking proof loop and writes outputs/workflow.json.

What's in the box

StageCommandPurpose
Initagentcad init <workspace> [--model <name>]Initialize workspace scaffold (optionally create first model)
Scaffoldagentcad new <model>Create model folder inside an existing workspace
Scaffoldagentcad new <model>:<variant>Create a variant (same part.py, different params.json)
Syncagentcad sync [--dry-run] [--only <path>] [--prune-deprecated]Refresh workspace scaffold from latest templates, preview changes, or prune deprecated scaffold paths
Suggestagentcad suggest-checks <model> [--apply]Analyze design contract and recommend missing concrete checks by feature classification, evidence gaps, existing artifacts, and probe plan; --apply writes only concrete suggestions
Precheckagentcad precheck <model>Solve design.json statically (schema, feature coverage, min_clearance) before part.py is written
Buildagentcad build <model>[:<variant>]Run part.py through build123d, export STEP + STL, hash-cache stale runs
Measureagentcad measure <model>[:<variant>]Mesh stats + structural facts (bbox, watertight, triangles, voids)
Renderagentcad render <model>Iso/front/top/side/back SVG previews with dimension annotations + Z/X/Y cross-section SVGs with measurement sidecars
Previewagentcad preview <name>[:<variant>]Interactive Three.js preview for models and assemblies served through a local HTTP server
Preview checkagentcad preview-check <name>[:<variant>]Nonblocking HTTP health check for preview.html, STL, SVG, and artifact links
Probeagentcad probe <model>Cross-section diameter / bbox / component analysis plus ad-hoc line, point, and region measurements; --scan to discover step changes; --cx/--cy avoid negative-number parsing issues
Inspectagentcad inspect <model>Three-axis scan + automatic section SVGs + measurement JSON + suggested probes
Validateagentcad validate <model>[:<variant>]Build + measure + render all orthographic previews + design checks + feature coverage + fix suggestions (includes timing and section cache)
Validate allagentcad validate all [--models] [--assemblies] [--include-variants] [--fail-fast]Batch validate all workspace targets with project-level report
Snapshotagentcad snapshot write [--target <name>]Write regression snapshots for validated targets
Snapshotagentcad snapshot compare [--target <name>]Compare current vs baseline snapshots (check drift, geometry drift, artifact changes)
Diffagentcad diff <model> [--last]Compare current vs previous validation run: fixed/regressed/stable checks + geometry drift
Doctoragentcad doctor <model>[:<variant>]Workflow state diagnostics: severity-graded findings and recommended next command
Reviewagentcad review <model>Pre-delivery checklist with pairwise relations matrix, hole-access enforcement, weak-check blocking gates, and must-view SVG list
Workflowagentcad workflow <model>[:<variant>]Final model gate: suggest-checks, precheck, validate, preview-check, probe proof, review, and deliver manifest
Cleanagentcad clean [--model <name>] [--dry-run] [--no-validation-history] [--no-debug] [--previews]Remove debug SVGs, old validation history, optionally preview SVGs
Assemblyagentcad assembly init/list/validate/reviewOptional multi-model assembly contracts with component transforms, mate residuals, fit checks, combined/exploded SVGs, preview generation, MJCF export, and metadata interface validation
Deliveragentcad deliver <model>[:<variant>]Delivery manifest
Reportagentcad report <model>Markdown summary of validation result
CADBenchagentcad cadbench [--root examples/cadbench]Evaluate contract-only failure-mode fixtures for evidence coverage, suggestion specificity, placeholder budgets, and probe relevance

Every command prints stable machine-readable JSON output. Failures include stage, error.type, and error.message. Validation failures include suggested_fix with likely_source, next_commands, and param_candidates.

Validation check types

TypeLayerNotes
bbox_sizepost-buildOuter envelope dimensions
watertightpost-buildSTL is a closed manifold
min_trianglespost-buildMesh density floor
artifact_existspost-buildSTEP / STL / SVG present
metadata_equalspost-buildAsserts a value emitted from part.py
outer_diameter_at_zpost-buildCross-section radial size at Z
inner_diameter_at_zpost-buildInner cavity diameter at Z
section_bbox_at_zpost-buildCross-section state or dimensions at Z; expected accepts "solid", "void", or [width, depth]; expected: "void" requires region
section_component_countpost-buildCount disconnected section contours for repeated slots/cavities
diameter_decreases_along_zpost-buildMonotonicity for tapers / lead-ins
volume_rangepost-buildVolume sanity bounds
min_clearancedesign-time + post-buildPure-shape edge-to-edge clearance between two declared shapes (no STL required)
hole_accessibilitypost-buildAnnular clearance around a hole at the working plane; supports X/Y/Z access axes
min_wall_thicknesspost-buildMinimum point-pair distance inside a defined region; supports range mode (axis + range + samples) for multi-slice evaluation
feature_positionpost-buildAssert a 3D point is solid or void
feature_coverageautomaticEvery declared feature must reference at least one check
design_schemaautomaticField-level schema errors with structured SchemaIssue paths, severity, and hints

The geometric relation checks (min_clearance, hole_accessibility, min_wall_thickness, feature_position) close the historical gap where inner_diameter_at_z would report a correct diameter for a hole that was half-covered by an adjacent wall.

agentcad review treats missing hole-access checks as blocking when holes are declared, and load-bearing attachment features without root/interface checks as blocking warnings. agentcad suggest-checks generates check templates for the same gaps before validation runs and reports suggestion_quality metrics: template count, placeholder count/ratio, concrete template count, and exact placeholder paths. A concrete suggestion should use params.json, metadata.json, existing checks, geometry bbox, and the probe plan instead of leaving unresolved <...> fields.

Assembly validation

Assemblies live in assemblies/<name>/assembly.json and reference existing models by component id, model name, and rigid transform. agentcad assembly validate <name> rebuilds stale components, resolves metadata anchors and interfaces, validates interface schema (cylindrical_male/female, screw_axis, dovetail, snap_pin/socket, gear_axis, planar), measures declared cylindrical interfaces against STL sections, emits mate residuals, checks pair coverage, writes combined/exploded SVG previews, exports <name>.mjcf.xml, generates an interactive preview.html, and round-trips the MJCF body/site data against assembly_geometry.json.

Interference validation uses two layers: AABB broad phase first, then a mesh narrow phase for overlapping component pairs. The narrow phase records triangle-contact evidence, inside-sample penetration depth, and sampled minimum surface distance.

Batch validation and regression

agentcad validate all discovers models, variants, and assemblies across the workspace, runs validation in deterministic order, and emits a project-level JSON report with per-target summaries and timings.

agentcad snapshot write stores normalized snapshots (stripping volatile timestamps/paths, keeping check results, geometry metrics, and artifact presence). agentcad snapshot compare reports check status drift, geometry metric drift (bbox, volume, triangles), and artifact changes between current and baseline — useful for CI regression detection.

Quick start

uv tool install agentcad-cli
agentcad --help

Create a workspace and start modeling:

agentcad init my-agentcad-project --model demo
cd my-agentcad-project
claude

Then ask Claude to design your target model (for example: "Design an adapter from an 8025 fan to a round duct") — it will read CLAUDE.md in this workspace and follow the workflow automatically.

For local development:

uv sync
uv run agentcad --help

Quick example

agentcad init my-cad-project --model bracket
cd my-cad-project

# 1. Suggest missing checks based on the design contract
agentcad suggest-checks bracket

# 2. Design-time: solve the contract before geometry
agentcad precheck bracket

# 3. Implement part.py, then run the post-build pipeline
agentcad validate bracket

# 4. Final hard gate before handoff
agentcad workflow bracket

# 5. If interrupted, diagnose workflow gaps
agentcad doctor bracket

The default generated model is a simple build123d cuboid. Agent rules and common-error catalog live in AGENTS.md, CLAUDE.md, and references/ (always-on reference docs for build123d patterns and validation strategy).

Feature helpers

AgentCAD ships a library of geometry helpers that build common mechanical features and optionally emit contract checks via ContractBuilder:

HelperWhat it makesTier
plate, boss, rib, slotBase plate, raised boss, reinforcing rib, routing slot1
duct_socket, mounting_pattern, stepped_bore, knurl, sinusoidal_threadCylindrical socket, screw hole pattern, counterbore/countersink, knurled grip, helical thread1
tube, prismoid, wedge, teardrop, chamfer_mask, nut_trap, screw_holeHollow tube, tapered prism, wedge cut, teardrop hole, chamfer edge mask, hex nut pocket, screw clearance hole2
living_hinge_mask, threaded_rod, dovetail, hex_panel, snap_pin + snap_pin_socket, spur_gearFlexible hinge cutout, threaded shaft, interlocking dovetail, honeycomb panel, snap-fit pin pair, involute gear2
rounding_mask, torus, rect_tube, pie_slice, nut_body, nema_mountFillet edge mask, torus ring, rectangular tube, cylindrical sector, hex nut solid, NEMA motor mount3
screw, threaded_nut, sparse_wall, ring_gearScrew/bolt solid, threaded nut solid, grid infill wall, internal ring gear3

Helpers auto-emit contract checks (inner_diameter, section_bbox, volume_range, etc.) and metadata interfaces (cylindrical_male/female, screw_axis, snap_pin, dovetail) so every feature gets validation coverage without manual authoring. A hardware dimension database (agentcad.hardware) provides ISO/DIN specs for screws, nuts, washers, and heat-set inserts.

Examples

PathWhat it shows
examples/fan-adapter-8025/Two validated models plus assemblies/fan_with_screen/ for inter-model clearance, section, STL, MJCF, and preview validation
examples/iphone15pro-case/Real-world phone case with multi-cutouts + section validation
examples/e2e-test/Sub-agent end-to-end test: design → precheck → build → validate → review on a mounting bracket
examples/e2e-real-cable-hook/Real e2e surface-mounted cable hook with concept + quality review artifacts
examples/e2e-bit-holder/Two-part body/lid design that motivated first-class assembly validation
examples/e2e-l-bracket/L-shaped bracket demonstrating variants, diff, and fix suggestions
examples/e2e-feature-helpers/End-to-end workspace focused on ContractBuilder and Phase 3 helper usage
examples/e2e-feature-demo/Smaller helper-driven model used as a feature-library smoke fixture
examples/drone-panel/Lightweight drone panel with sparse_wall, hex_panel, torus seal, cover lip
examples/gear-housing/Spur + ring gear housing demonstrating gear helpers
examples/pipe-coupling/Pipe coupling with tube, dovetail, and chamfer_mask helpers
examples/cadbench/Contract-only failure-mode benchmark for evidence/suggest/probe quality gates

Re-run any example:

cd examples/fan-adapter-8025
agentcad validate fan_duct_adapter_8025
agentcad review fan_duct_adapter_8025
agentcad workflow fan_duct_adapter_8025

Batch validate the whole workspace:

cd examples/fan-adapter-8025
agentcad validate all
agentcad snapshot write
agentcad snapshot compare

Tests

uv run pytest -v

The full test suite currently reports 741 passed. It covers CLI dispatch, workspace scaffolding and sync modes, STL reading and measurement, section extraction and SVG rendering, JSON IO, post-build validation checks, feature classification, weak-check severity and review blocking gates, design schema hardening, negative regression fixtures, min_wall_thickness range mode, metadata interface schema, ContractBuilder interface emission, feature helpers, hardware lookup tables, geometric primitives, interactive previews, variants, assembly validation, batch validation, regression snapshots, workflow diagnostics (doctor), suggest-checks, CADBench quality gates, suggested-fix enrichment, timing instrumentation, section cache, executable helper cookbook, and artifact cleanup. GitHub Actions runs the fast suite on pushes and PRs; slow tests run on a scheduled/manual workflow.

Documentation

  • docs/DESIGN.md — architecture, first principles, and V0–V6 iteration roadmap (with delivered milestones marked).
  • docs/STATUS.md — current implementation state, recent lessons, delivered validation gates, and remaining roadmap direction.
  • docs/ROADMAP.md and docs/ROADMAP_EXECUTION_PLAN.md — prioritized future work plus PR-level execution, test, and acceptance plans. P0–P4 are marked Done; P5 (optional integrations) is next.
  • AGENTS.md / CLAUDE.md (workspace) — operating rules for the coding agent, including the 16-stage TDD workflow and the common design-error catalog.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.3.115 May 20262

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:36 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:dfe5893cf86407f4420cc9bce67a30ff47cf633178b08e7f39e57f15bf531edf