Reusable generation, validation, provider, and project-object core for Blueprint OSS.
Project description
Blueprint
Blueprint is AI-native full-stack hardware. It turns a prompt (and optionally an image) into a structured, validated Hardware IR package plus generated product imagery, wiring diagrams, BOM, and build steps.
This repository is an MVP and research prototype focused on low-voltage maker electronics (3.3V–5V) and safe, educational projects.
What you can do
- Compile a hardware idea into typed Hardware IR (Pydantic)
- Run rule-based electrical validation (shorts, voltage mismatch, unpowered ICs, pin conflicts, overcurrent risk)
- Visualize wiring with:
- Interactive React Flow schematic
- Generated SVG schematic
- View a lightweight 3D mechanical layout (Three.js / React Three Fiber)
- Generate an optional product concept image with an image model
- Persist generated projects to Supabase through the Supabase client when configured, with an automatic SQLite fallback and
BLUEPRINT_DEV_MODEfor SQLite-only local work - Trace generation runs and structured LLM calls with Langfuse when project keys are configured
- Let external agents integrate over REST long-polling, WebSocket, optional TCP JSONL sockets, or MCP-style JSON-RPC tools
How it works
Blueprint follows a sequential processing pipeline:
- Input: User provides a prompt and optional image
- Agent Processing: ADK-style sequential agents process the input using the configured structured LLM provider
- Hardware IR Generation: Agents produce typed Hardware IR (Pydantic models)
- Validation & Repair: Rule-based validation checks the design and repairs issues automatically
- UI Outputs: Generate interactive visualizations (product image, React Flow schematic, SVG diagrams, 3D mechanical layout) and save to database
- Persistence: Project data is stored in Supabase or SQLite
MVP scope & safety boundaries
Blueprint intentionally limits scope to low-voltage maker electronics:
- 3.3V–5V DC systems
- Breadboard-friendly microcontrollers, sensors, displays, and actuators
- Educational and hobbyist prototypes
It blocks or warns on high-risk domains (mains AC, medical, automotive control, weapons, high-power battery packs). See docs/validation.md.
Local setup (quick)
Detailed instructions live in docs/setup.md. The short version:
Run Everything
From the repo root:
./scripts/dev.sh
This starts the FastAPI backend and Next.js frontend together. Use BACKEND_PORT, FRONTEND_PORT, BACKEND_HOST, or FRONTEND_HOST to override defaults.
Python Package (PyPI)
The reusable core is published on PyPI as caid-blueprint-core. The distribution name is caid-blueprint-core; the Python import package is blueprint_core.
pip install caid-blueprint-core
import blueprint_core
from blueprint_core.generation import HardwarePipelineOrchestrator, list_workflows
from blueprint_core.models import HardwareIR
Docker
Build and run both images from the repo root:
docker compose up --build
The Docker setup runs the backend on port 8000, the frontend on port 3000, and stores SQLite data in a named Docker volume. Set LLM_PROVIDER, OPENAI_API_KEY, LLM_API_KEY, or the other variables from .env.example before running Compose to use a live model provider; otherwise the backend defaults to simulation mode.
If you change the published backend URL, rebuild the frontend with a matching public API URL:
BACKEND_PORT=8010 NEXT_PUBLIC_API_URL=http://localhost:8010 docker compose up --build
Backend (FastAPI)
From the repo root:
python3 -m venv .venv
source .venv/bin/activate
pip install -r backend/requirements.txt
Optional: seed the component library The server auto-seeds the component library on startup if empty. To seed manually:
python3 backend/seed_db.py
Run the backend:
uvicorn backend.main:app --reload --port 8000
Backend CLI:
./scripts/blueprint-backend serve --reload
./scripts/blueprint-backend health
./scripts/blueprint-backend jobs --status running
./scripts/blueprint-backend jobs --local --limit 10
./scripts/test.sh
./sample.py "Describe a low-voltage plant watering monitor with OLED status"
./sample_async.py --llm openai/gpt-5.5 --llm runpod/caid-technologies/parti-base "Describe a low-voltage plant watering monitor with OLED status"
./scripts/blueprint-backend generate "plant watering monitor" --llm openai/gpt-5.5
./scripts/blueprint-backend generate "plant watering monitor" --llm runpod/caid-technologies/parti-base
curl -X POST http://127.0.0.1:8000/projects/<project-id>/iterate -H 'Content-Type: application/json' -d '{"instruction":"Add battery charging and make the enclosure splash resistant","namespace":"product.mech","provider":"openai","model":"gpt-5.5"}'
./scripts/verify-llm-providers.py --list
./scripts/verify-llm-providers.py
./scripts/verify-llm-providers.py --save
./scripts/run-llm-smoke-tests.py
./scripts/verify-llm-providers.py --llm openai/gpt-5.5
./scripts/verify-llm-providers.py --llm runpod/caid-technologies/parti-base --timeout-seconds 1200
./scripts/verify-llm-providers.py --llm baseten/deepseek-ai/DeepSeek-V4-Pro
./scripts/verify-llm-providers.py --llm huggingface/Qwen/Qwen2.5-Coder-3B-Instruct:nscale
./scripts/verify-llm-providers.py --llm nvidia/meta/llama-3.1-8b-instruct
./scripts/blueprint-backend seed
scripts/test.sh runs the offline unit suite with unittest after a Python compile check. sample.py sends the same prompt to each configured/allowed provider-model pair and saves a comparison report under .logs/model-samples/. sample_async.py does the same work concurrently, running one nonblocking task per selected model up to --concurrency. verify-llm-providers.py discovers the configured runtime provider/model pairs from .env, sends a tiny structured JSON prompt, and exits non-zero if any live provider returns invalid output. Use --config-only to validate selectors without spending tokens or waiting on long Runpod jobs. Use --save or run-llm-smoke-tests.py to write timestamped reports under .logs/llm-smoke/, plus .logs/llm-smoke/latest.json. The automated runner also accepts LLM_SMOKE_LLM, LLM_SMOKE_CONFIG_ONLY, LLM_SMOKE_TIMEOUT_SECONDS, and LLM_SMOKE_OUTPUT_DIR for CI or cron-style runs.
Generation and project iteration logic lives in the reusable blueprint_core package, published as the caid-blueprint-core PyPI distribution. New code should import from blueprint_core.generation, blueprint_core.iteration, blueprint_core.project_objects, blueprint_core.models, blueprint_core.validation, blueprint_core.llm, blueprint_core.images, blueprint_core.runtime, and blueprint_core.selectors; the old backend modules are compatibility wrappers. Projects are represented as BlueprintProjectObject values with an object version plus versioned namespaces such as product.mech, product.electrical, product.validation, product.assembly, project.docs, and project.history. ProjectIterator.iterate_project(...) takes an existing HardwareIR plus a natural-language instruction, can target a namespace, returns a full revised HardwareIR, normalizes revision/history/object metadata, redacts bulky data URLs from LLM context, and reruns circuit validation before returning. ProjectSelfCorrectionAgent builds validation-driven repair instructions and applies them through the same namespace-aware iterator.
Benchmarks live under benchmarks/ and save JSON reports under .logs/benchmarks/:
./scripts/benchmark.sh
./benchmarks/benchmark_models.py --iterations 1
./benchmarks/benchmark_models.py --live --llm openai/gpt-5.5 --iterations 3 --concurrency 2
benchmark_models.py defaults to config-only mode so it can run safely without spending provider calls. Add --live when you want real LLM latency measurements. Each completed provider/model attempt is also flushed immediately to per-run JSONL and CSV files named model-job-results-*.jsonl and model-job-results-*.csv, including status, round, completion time, and duration fields.
Benchmark, output, and eval artifacts can be uploaded to a Hugging Face dataset repo:
export HF_TOKEN=...
export HF_ARTIFACT_REPO_ID=username/blueprint-metrics
./benchmarks/benchmark_models.py --live --iterations 3 --upload-huggingface
./benchmarks/benchmark_offline.py --upload-huggingface
./scripts/upload-artifacts-to-huggingface.py --artifact-type outputs examples/results
./scripts/upload-artifacts-to-huggingface.py --artifact-type evals .logs/evals
The CLI uses .venv/bin/python when present and falls back to python3. health
checks the root, component, and A2A jobs endpoints; jobs --local reads the
SQLite job metadata store directly when the API server is not running. Job
tables include the generation source when known: Catalog, Web Research, or
both.
To run with OpenAI:
LLM_PROVIDER=openai OPENAI_API_KEY=your_openai_api_key_here OPENAI_MODEL=gpt-4o-mini uvicorn backend.main:app --reload --port 8000
Environment variables (recommended via a repo-root .env; see .env.example):
LOG_LEVEL: Backend logging level, for exampleINFOorDEBUG.BACKEND_LOG_FILE: Optional rotating log file for backend and uvicorn logs, for example./blueprint-backend.log.BLUEPRINT_DEBUG: Whentrue, API errors and failed job metadata include redacted traceback/context debug payloads. Intended for trusted local/dev environments.SUPABASE_URL: Supabase project API URL, for examplehttps://your-project-ref.supabase.co.SUPABASE_SERVICE_ROLE_KEY/SUPABASE_SECRET_KEY: Backend-only Supabase key for writes. Do not use anon/publishable keys.BLUEPRINT_DEV_MODE: Whentrue, forces SQLite for app data and A2A job metadata, disables Supabase Storage writes, and keeps reference/product image data inline in the SQLite project record.NEXT_PUBLIC_BLUEPRINT_DEBUG/NEXT_PUBLIC_BLUEPRINT_DEV_MODE: Frontend-visible local/dev flags. TheKeysintegrations UI,Listening Jobs, andBackend Logsare shown only in Next development mode or when a debug/dev-mode flag is truthy. Keep these unset orfalsein public production builds.DATABASE_BACKEND: Optional override:supabaseorsqlite.SQLITE_DATABASE_URL: SQLite fallback URL (default:sqlite:///./blueprint.db).BLUEPRINT_DEPLOYMENT: Whentrue, deployed builds without a live LLM show generated examples plus an alpha signup form instead of running generation.LLM_PROVIDER: Live generation provider:baseten,gemini,huggingface,nvidia,openai,openai-compatible,runpod,runpod-serverless, orsimulation. Userunpodfor Runpod OpenAI-compatible/vLLM endpoints andrunpod-serverlessfor queue-style/runsyncworkers.LLM_ALLOWED_PROVIDERS: Optional comma-separated allowlist for per-request provider overrides.OPENAI_ALLOWED_MODELS/BASETEN_ALLOWED_MODELS/HUGGINGFACE_ALLOWED_MODELS/NVIDIA_ALLOWED_MODELS/OPENAI_COMPATIBLE_ALLOWED_MODELS/GEMINI_ALLOWED_MODELS/RUNPOD_ALLOWED_MODELS: Optional comma-separated allowlists for per-request model overrides. Without an explicit allowlist, runtime overrides are limited to the configured default/fallback model for that provider./api/generatealso accepts optionalproviderandmodelfields for runtime switching. Each generated project records the requested provider/model and actual provider/model inassembly_metadata.OPENAI_API_KEY: API key for first-party OpenAI whenLLM_PROVIDER=openai.OPENAI_MODEL: OpenAI model ID. The example default isgpt-4o-mini.OPENAI_RESPONSE_FORMAT: OpenAI response format. Defaults tojson_schema;json_objectandnoneare also supported.OPENAI_TIMEOUT_SECONDS: First-party OpenAI read timeout. Defaults to300.OPENAI_REASONING_EFFORT: Optional reasoning effort for GPT-5/o-series models, for examplelow.OPENAI_TEMPERATURE: Optional first-party OpenAI sampling temperature. Omitted by default so models that only support their default temperature can run.OPENAI_PROJECT_ID/OPENAI_ORG_ID: Optional OpenAI project and organization routing headers.LANGFUSE_PUBLIC_KEY/LANGFUSE_SECRET_KEY: Optional Langfuse project keys. When both are set, the backend traces each generation request and structured LLM call.LANGFUSE_BASE_URL: Optional Langfuse host (defaulthttps://cloud.langfuse.com).LANGFUSE_TRACING_ENVIRONMENT/LANGFUSE_TRACING_RELEASE: Optional Langfuse trace attributes.LANGFUSE_MAX_FIELD_CHARS: Optional traced payload preview cap (default20000).LANGFUSE_ENABLED: Optional explicit on/off switch. Set tofalseto disable tracing even when keys are present.IMAGE_OUTPUT_ENABLED: Optional global default for generated product images. The UI and API can opt in per job withgenerate_image=true.IMAGE_PROVIDER: Image provider. Supportsopenai,openai-compatible, ornone.OPENAI_IMAGE_MODEL: OpenAI image model ID. The example default isgpt-image-2.OPENAI_IMAGE_SIZE: Generated image size, for example1024x1024.OPENAI_IMAGE_API_KEY/OPENAI_API_KEY: First-party OpenAI image credentials.IMAGE_PROVIDER=openaidoes not inheritLLM_API_KEYorLLM_BASE_URL; useIMAGE_PROVIDER=openai-compatibleplusIMAGE_BASE_URL/IMAGE_API_KEYorLLM_BASE_URL/LLM_API_KEYfor compatible image endpoints.FIREWORKS_API_KEY: Enables Video tab self-correction. Auto mode samples the saved video withffmpeg, reviews frames with the Fireworkskimi-k2p6image-input model, then applies the review throughProjectIterator.FIREWORKS_VIDEO_REVIEW_INPUT_MODE:autoby default. Auto uses the workingkimi-k2p6frame-review fallback unless native video deployment routing is configured.FIREWORKS_ACCOUNT_ID/FIREWORKS_VIDEO_REVIEW_DEPLOYMENT_ID: Optional Fireworks dedicated deployment routing for native video/audio models. With these set and no explicit frame model override, auto mode usesqwen3-omni-30b-a3b-instruct.FIREWORKS_VIDEO_REVIEW_MODEL: Fireworks review model slug or full deployment path. Defaults tokimi-k2p6for frame review. For native video, useqwen3-omni-30b-a3b-instruct,molmo2-4b,molmo2-8b, or a fullaccounts/<account>/models/<model>#accounts/<account>/deployments/<deployment>path.FIREWORKS_BASE_URL/FIREWORKS_VIDEO_REVIEW_MAX_FRAMES/FIREWORKS_VIDEO_REVIEW_MAX_SECONDS/FIREWORKS_VIDEO_REVIEW_NATIVE_FPS/FIREWORKS_VIDEO_REVIEW_NATIVE_HEIGHT/FIREWORKS_VIDEO_REVIEW_MAX_MEDIA_BYTES/FIREWORKS_TIMEOUT_SECONDS: Optional Fireworks video-review endpoint, preprocessing, and timeout overrides.SUPABASE_S3_ENDPOINT: Supabase Storage S3 endpoint associated with image uploads. Defaults fromSUPABASE_URL; this project useshttps://knmuwxhfrgkykyvblzwi.storage.supabase.co/storage/v1/s3.SUPABASE_S3_BUCKET: Supabase Storage bucket for image uploads (default:contents).SUPABASE_S3_ACCESS_KEY_ID/SUPABASE_S3_SECRET_ACCESS_KEY: Optional S3-compatible fallback credentials. The normal backend path uploads through the Supabase client withSUPABASE_URLplus the service-role/secret key.SUPABASE_IMAGE_SIGNED_URL_SECONDS: Lifetime for refreshed Supabase Storage read URLs when projects are loaded (default:86400).LLM_API_KEY: Generic provider API key alias. For Gemini,GEMINI_API_KEYorGOOGLE_API_KEYstill work.LLM_MODEL: Model to use, for examplegemini-3.5-flashor an OpenAI/OpenAI-compatible model ID.LLM_TIMEOUT_SECONDS: Generic read timeout. OpenAI-compatible endpoints default to90.LLM_REASONING_EFFORT: Optional generic reasoning effort for compatible endpoints that support it.LLM_TEMPERATURE: Optional generic sampling temperature. OpenAI-compatible endpoints default to0.2; setdefault,none, oromitto omit it.BASETEN_API_KEY/BASETEN_BASE_URL: Baseten Model APIs configuration whenLLM_PROVIDER=basetenor a request usesprovider=baseten.BASETEN_BASE_URLdefaults tohttps://inference.baseten.co/v1.BASETEN_MODEL: Baseten model slug, for exampledeepseek-ai/DeepSeek-V4-Pro.HF_TOKEN/HUGGINGFACE_API_KEY/HUGGINGFACE_HUB_TOKEN: Hugging Face Inference Providers token whenLLM_PROVIDER=huggingfaceor a request usesprovider=huggingface.HUGGINGFACE_BASE_URL: Hugging Face OpenAI-compatible router URL. Defaults tohttps://router.huggingface.co/v1.HUGGINGFACE_MODEL: Hugging Face model ID, for exampleQwen/Qwen2.5-Coder-3B-Instruct:nscale.HF_ARTIFACT_REPO_ID/HUGGINGFACE_ARTIFACT_REPO_ID/HF_DATASET_REPO_ID: Optional Hugging Face dataset repo for uploaded benchmark, output, and eval artifacts.HF_ARTIFACT_PATH_PREFIX: Optional path prefix inside the artifact repo. Defaults toblueprint.EXTERNAL_SOURCE_PROVIDER: External web/source provider forworkflow=web_research:auto,tavily,firecrawl, ornone.autoprefers Tavily whenTAVILY_API_KEYis set.TAVILY_API_KEY: Tavily API key for external source research.TAVILY_SEARCH_LIMIT/TAVILY_SEARCH_DEPTH/TAVILY_INCLUDE_ANSWER/TAVILY_INCLUDE_RAW_CONTENT: Tavily search controls for the web research workflow.NVIDIA_API_KEY/NVIDIA_BASE_URL: NVIDIA Build/NIM configuration whenLLM_PROVIDER=nvidiaor a request usesprovider=nvidia.NVIDIA_BASE_URLdefaults tohttps://integrate.api.nvidia.com/v1.NVIDIA_MODEL: NVIDIA model slug, for examplemeta/llama-3.1-8b-instruct.RUNPOD_API_KEY/RUNPOD_OPENAI_BASE_URL: Runpod OpenAI-compatible/vLLM configuration whenLLM_PROVIDER=runpodor a request usesprovider=runpod.RUNPOD_ENDPOINT_ID/RUNPOD_ENDPOINT_URL: Runpod Serverless queue configuration whenLLM_PROVIDER=runpod-serverlessor a request usesprovider=runpod-serverless.RUNPOD_MODEL_ENDPOINTS: Optional JSON mapping of Runpod model IDs to endpoint IDs or endpoint URLs when each model uses a different Serverless endpoint.RUNPOD_TIMEOUT_SECONDS: Runpod HTTP read timeout. Defaults to1200so 10-15 minute cold starts or long generations can finish.RUNPOD_POLL_TIMEOUT_SECONDS: Runpod Serverless/statuspolling timeout. Defaults to1200.RUNPOD_EXECUTION_TIMEOUT_MS/RUNPOD_TTL_MS: Runpod Serverless job policy values. Use1200000for 20-minute generation windows.RUNPOD_PARTI_SEED_TIMEOUT_SECONDS: Optional timeout just for thecaid-technologies/parti-baseseed call. Defaults toRUNPOD_TIMEOUT_SECONDS; set lower if you prefer fast catalog repair when Parti is slow.RUNPOD_INPUT_TEMPLATE: Optional JSON payload template for Runpod workers. Use{prompt}and, for single-endpoint multi-model workers,{model}placeholders.STRICT_LLM: Set totrue(default) to fail fast when model validation is enabled and the model is unavailable. Set tofalseto attempt fallback.LLM_FALLBACK_MODEL: Optional fallback model whenSTRICT_LLM=false.LLM_BASE_URL: Optional base URL for OpenAI-compatible providers.JOB_METADATA_BACKEND: Durable A2A job metadata backend.autouses Supabase when the main app DB is Supabase, otherwise SQLite.JOB_METADATA_DB_PATH: SQLite file used when A2A job metadata is on SQLite (default:./blueprint_jobs.db).A2A_SOCKET_ENABLED: Set totrueto start the optional TCP JSONL A2A socket.A2A_SOCKET_HOST/A2A_SOCKET_PORT: Host and port for the optional TCP JSONL listener.
If no live LLM provider is configured or generation fails, the backend returns deterministic simulation outputs based on built-in example projects.
Frontend (Next.js)
cd frontend
npm install
npm run dev
Open:
- http://localhost:3000 (UI)
- http://localhost:8000/api/docs (API docs)
Tip: load an example directly with http://localhost:3000/?example=pocket_mp3_player (or any JSON under frontend/public/examples/).
Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file caid_blueprint_core-0.1.1.tar.gz.
File metadata
- Download URL: caid_blueprint_core-0.1.1.tar.gz
- Upload date:
- Size: 220.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd1bca0c48bab1d305a8f8957a92e8c8695855939e0e1703077cb51ada34fc8e
|
|
| MD5 |
396a4257b97c9f626550dab948d7800f
|
|
| BLAKE2b-256 |
7e8c19dd490239cdf14f31be9ee548fd88792bdc81bd8a65001a21e57ba979d4
|
File details
Details for the file caid_blueprint_core-0.1.1-py3-none-any.whl.
File metadata
- Download URL: caid_blueprint_core-0.1.1-py3-none-any.whl
- Upload date:
- Size: 203.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a8e5330f2667bff71748facf4e17050e335bd6810e254f88a7ce3b88db31608
|
|
| MD5 |
4c368a4dc535187090d09f0cd273976b
|
|
| BLAKE2b-256 |
40d037b0bd83e25a451c2d188b0768e3f61719fb233d6846b6527bbb5a8792c0
|