Skip to content

Latest commit

 

History

History
142 lines (97 loc) · 3.5 KB

File metadata and controls

142 lines (97 loc) · 3.5 KB

AgentCAD

A web application for using AI agents to quickly generate 3D CAD models. Describe what you want in natural language and AgentCAD produces a STEP file you can open in any CAD software.

Example – robot arm generated by AgentCAD


Prerequisites

  • Python 3.12+
  • Node.js 18+ and npm
  • An API key for your chosen LLM provider (e.g. ANTHROPIC_API_KEY)

Quick Start

1. Clone the repository

git clone https://github.com/isayahc/AgentCAD.git
cd AgentCAD

2. Set up the backend

cd backend

# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate      # Linux / macOS
# .venv\Scripts\activate       # Windows

# Install dependencies
pip install -r ../requirements.txt

# Configure environment variables
cp example.env .env
# Edit .env and fill in your API key(s):
#   ANTHROPIC_API_KEY=sk-...
#   STEP_OUTPUT_FILE=          (optional)

Start the backend server:

cd src
uvicorn app:app --reload --host 0.0.0.0 --port 8000

The API will be available at http://localhost:8000.

3. Set up the frontend

Open a new terminal and navigate to the frontend directory:

cd frontend

# Install dependencies (use --legacy-peer-deps if you encounter peer dependency issues)
npm install --legacy-peer-deps

# Start the development server
npm run dev

The frontend will be available at http://localhost:3000. It automatically proxies API requests to the backend.

4. Run frontend + backend together (one command)

From the repository root:

chmod +x scripts/dev.sh
./scripts/dev.sh

This starts:

  • FastAPI backend at http://localhost:8000
  • Next.js frontend at http://localhost:3000

Press Ctrl+C to stop both.


Usage

  1. Open http://localhost:3000 in your browser.
  2. Type a natural-language prompt describing the 3D model you want (e.g. "make a simple robot arm").
  3. Optionally attach a reference image.
  4. AgentCAD generates a STEP file, which you can view in the browser or download and open in any CAD software.

Project Structure

AgentCAD/
├── assets/          # Static assets (example images)
├── backend/         # FastAPI backend + CAD-generation agent
│   ├── src/
│   │   ├── app.py                   # FastAPI application
│   │   └── step_generating_agent.py # LLM agent that generates STEP files
│   ├── example.env
│   └── pyproject.toml
├── data/            # Generated STEP files (created at runtime)
├── frontend/        # Next.js frontend with 3D viewer
│   ├── app/
│   ├── components/
│   └── package.json
└── requirements.txt # Python dependencies

Runtime dataset artifacts are stored in data/:

  • *.step / *.svg generated CAD outputs
  • agentcad.db SQLite database with job + output metadata

Environment Variables

Variable Description Default
ANTHROPIC_API_KEY API key for Anthropic (or the LLM provider you use)
STEP_OUTPUT_FILE Custom filename for the generated STEP file auto-generated
STEP_DATA_DIR Directory where STEP files are stored data/
BACKEND_URL Backend URL used by the Next.js proxy http://localhost:8000

Dataset endpoints

  • GET /jobs — list recent generation jobs
  • GET /jobs/{job_id} — fetch one job and all captured outputs (query, CadQuery code, STEP/SVG file paths, scores/feedback)

License

See LICENSE for details.