{"skill":{"slug":"cad-agent","displayName":"CAD Agent","summary":"Send build123d CAD commands via HTTP to render images, allowing visual iteration on 3D models entirely within a containerized CAD environment.","description":"# CAD Agent\n\n> Give your AI agent eyes for CAD work.\n\n## Description\n\nCAD Agent is a rendering server that lets AI agents see what they're building. Send modeling commands → receive rendered images → iterate visually.\n\n**Use when:** designing 3D-printable parts, parametric CAD, mechanical design, build123d modeling\n\n## Architecture\n\n**Critical:** All CAD logic runs inside the container. You (the agent) only:\n1. Send commands via HTTP\n2. View the returned images\n3. Decide what to do next\n\n```\nYOU (agent)                     CAD AGENT CONTAINER\n─────────────                   ───────────────────\nSend build123d code      →      Executes modeling\n                         ←      Returns JSON status\nRequest render           →      VTK renders the model\n                         ←      Returns PNG image\n*Look at the image*\nDecide: iterate or done\n```\n\n**Never** do STL manipulation, mesh processing, or rendering outside the container. The container handles everything — you just command and observe.\n\n## Setup\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/clawd-maf/cad-agent.git\ncd cad-agent\n```\n\n### 2. Build the Docker Image\n\n```bash\ndocker build -t cad-agent:latest .\n```\n\nOr using docker-compose:\n\n```bash\ndocker-compose build\n```\n\n### 3. Run the Server\n\n```bash\n# Using docker-compose (recommended)\ndocker-compose up -d\n\n# Or using docker directly\ndocker run -d --name cad-agent -p 8123:8123 cad-agent:latest serve\n```\n\n### 4. Verify Installation\n\n```bash\ncurl http://localhost:8123/health\n# Should return: {\"status\": \"healthy\", ...}\n```\n\n> **Docker-in-Docker caveat:** In nested container environments (e.g., Clawdbot sandbox), host networking may not work—`curl localhost:8123` will fail even though the server binds to `0.0.0.0:8123`. Use `docker exec cad-agent python3 -c \"...\"` commands instead. On a normal Docker host, localhost access works fine.\n\n## Workflow\n\n### 1. Create Model\n\n```bash\ncurl -X POST http://localhost:8123/model/create \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"name\": \"my_part\",\n    \"code\": \"from build123d import *\\nresult = Box(60, 40, 30)\"\n  }'\n```\n\n### 2. Render & View\n\n```bash\n# Get multi-view (front/right/top/iso)\ncurl -X POST http://localhost:8123/render/multiview \\\n  -d '{\"model_name\": \"my_part\"}' -o views.png\n\n# Or 3D isometric\ncurl -X POST http://localhost:8123/render/3d \\\n  -d '{\"model_name\": \"my_part\", \"view\": \"isometric\"}' -o iso.png\n```\n\n**Look at the image.** Does it look right? If not, modify and re-render.\n\n### 3. Iterate\n\n```bash\ncurl -X POST http://localhost:8123/model/modify \\\n  -d '{\n    \"name\": \"my_part\", \n    \"code\": \"result = result - Cylinder(5, 50).locate(Pos(20, 10, 0))\"\n  }'\n\n# Re-render to check\ncurl -X POST http://localhost:8123/render/3d \\\n  -d '{\"model_name\": \"my_part\"}' -o updated.png\n```\n\n### 4. Export\n\n```bash\ncurl -X POST http://localhost:8123/export \\\n  -d '{\"model_name\": \"my_part\", \"format\": \"stl\"}' -o part.stl\n```\n\n## Endpoints\n\n| Endpoint | What it does |\n|----------|--------------|\n| `POST /model/create` | Run build123d code, create model |\n| `POST /model/modify` | Modify existing model |\n| `GET /model/list` | List models in session |\n| `GET /model/{name}/measure` | Get dimensions |\n| `POST /render/3d` | 3D shaded render (VTK) |\n| `POST /render/2d` | 2D technical drawing |\n| `POST /render/multiview` | 4-view composite |\n| `POST /export` | Export STL/STEP/3MF |\n| `POST /analyze/printability` | Check if printable |\n\n## build123d Cheatsheet\n\n```python\nfrom build123d import *\n\n# Primitives\nBox(width, depth, height)\nCylinder(radius, height)\nSphere(radius)\n\n# Boolean\na + b   # union\na - b   # subtract\na & b   # intersect\n\n# Position\npart.locate(Pos(x, y, z))\npart.rotate(Axis.Z, 45)\n\n# Edges\nfillet(part.edges(), radius)\nchamfer(part.edges(), length)\n```\n\n## Important\n\n- **Don't bypass the container.** No matplotlib, no external STL libraries, no mesh hacking.\n- **Renders are your eyes.** Always request a render after changes.\n- **Iterate visually.** The whole point is you can see what you're building.\n\n## Design File Safety\n\nThe project has safeguards against accidentally committing CAD outputs:\n- `.gitignore` blocks *.stl, *.step, *.3mf, etc.\n- Pre-commit hook rejects design files\n- User's designs stay local, never versioned\n\n## Links\n\n- [Repository](https://github.com/clawd-maf/cad-agent)\n- [build123d docs](https://build123d.readthedocs.io/)\n- [VTK](https://vtk.org/)\n","tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":4831,"installsAllTime":18,"installsCurrent":18,"stars":6,"versions":1},"createdAt":1769435364320,"updatedAt":1778485857338},"latestVersion":{"version":"1.0.0","createdAt":1769435364320,"changelog":"CAD Agent is a rendering server that lets AI agents see what they're building. Send modeling commands → receive rendered images → iterate visually.\n\nUse when: designing 3D-printable parts, parametric CAD, mechanical design, build123d modeling","license":null},"metadata":null,"owner":{"handle":"clawd-maf","userId":"s177z9s1c14nytxtc46qprq2dn885xqy","displayName":"clawd-maf","image":"https://avatars.githubusercontent.com/u/256975267?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779916630701}}