Bringing general-purpose agents to optical engineering
OS Optics (os-optics) is a deterministic, stateless, local-first MIT Python optical design and physical simulation engine — built for engineers and multi-agent swarms to explore, verify, and collaborate across lens prescriptions and 3D free-space quantum benches.
python -m pip install os-optics MIT License · Local & offline · Free with no sign-up · Built for DeepSeek Harness / Claude Code / Codex / Cursor / WorkBuddy
Open-Source Optical Engineering
Every case paired from optical design to physics analysis
Three representative engineering cases spanning multi-element lens prescriptions and 160+ optic 3D free-space benches — each pairing the optical layout on the left with its physics or tolerance qualification on the right.
18 mm f/2 Full-Frame Mirrorless (14 Elements / 12 Groups) × Monte Carlo Tolerance
85 mm All-Spherical Portrait Lens × Polychromatic Diffraction MTF Benchmark
160+ Optic Rb-87 Cold-Atom Platform × 3D Pointing Tolerance Analysis
Why OS Optics
Built for high parallelism, deterministic physics, and multi-agent swarms
Skip closed GUI seat locks and ad-hoc scripts without validity bounds. OS Optics pairs a lean pure-Python engine with 3,000+ offline catalog optics and open handoff contracts across the scientific Python ecosystem.
- Natively parallel & swarm-ready
- Completely stateless, I/O-free core with zero license-seat locks. Spawn dozens of workers or multi-agent swarms concurrently and merge candidates via JSON and SHA-256 hashes.
- Non-sequential 3D & freeform optics
- Trace planes, spheres, conics, even aspheres, cylinders, axicons, Zernike / XY freeforms, GRIN rods, cube splitters, folded mirrors, holes, and lens arrays.
- Gaussian beams, polarization & interference
- Astigmatic Gaussian propagation, Jones and Stokes polarization, partial/unpolarized light, uniaxial birefringence, SHG slabs, two-beam fringes, and damage-rating checks.
- PSF, MTF, ghosts & cavities
- Calculate diffraction and geometric PSF/MTF, encircled energy, four-bounce interface ghosts with remainder bounds, coherent/speckle fields, vector focal fields, and cavities.
- Honest validity bounds & reproducibility
- Every number states whether it is a model value, proven bound, or out-of-limit estimate — targets outside model validity are flagged clearly and never disguised as passes.
- Real catalog + custom prescriptions
- Sync 3,000+ versioned offline catalog components alongside arbitrary custom lenses, dispersion laws, polarization coatings, and CSV lens prescriptions.
Scientific Ecosystem Interop os-optics interop
Keep the core ultra-light while connecting seamlessly to specialized diffraction, quantum, and optimization libraries:
Stateless evaluation loops & Sobol sensitivity
Standard transverse beam & stop handoffs
Lossy linear optical network & delay export
Domain-checked tabulated virtual elements
MIT Open-Source Ecosystem
A lean engine core + community toolkit
We keep the deterministic physics core separate from cases, plotting tools, and agent skills — two focused MIT repositories built to work together cleanly.
os-optics
Pure-Python optical design and simulation engine. Includes the versioned offline catalog, full geometric, Gaussian, polarization, and interference physics, imaging and ghost analyses, stateless parallelism, and a local 3D viewer.
os-optics-kit
Community toolkit built on the engine: 18 reproducible optical cases, vendor-neutral agent skills, parallel parameter sweeps, sensitivity and Monte Carlo tolerance studies, a local live read-only viewer, and publication-grade rendering.
Try It Right Now
Drive it with your AI agent, or run directly from terminal
Pick either the imaging lens prescription or free-space bench prompt below and send it to any coding agent that can read the web and run Python (DeepSeek Harness, Claude Code, Codex, Cursor, WorkBuddy, or ChatGPT).
Multi-element imaging lens design & optimization
For prime/wide/telephoto lenses, microscopy objectives, and MWIR imagers with custom surfaces, MTF, and tolerance targets.
Please read the "AI Agent Instructions" at https://opensci-optics.com/en/ and use the open-source os-optics and os-optics-kit packages locally to design and optimize the imaging lens below.
Lens specifications:
[EFL, F/#, full/half field of view, wavelength band, image height, element/asphere/TTL limits, MTF and distortion targets]
First turn my specs into measurable targets, build and optimize the lens prescription, then deliver the 2D optical section, 3D views, multi-field MTF/PSF, and tolerance sensitivity results. Free-space bench selection & 3D simulation
For beam expanders, dichroic routing, polarization setups, interferometers, and cold-atom optical tables using catalog optics.
Please read the "AI Agent Instructions" at https://opensci-optics.com/en/ and use the open-source os-optics and os-optics-kit packages locally to design and simulate the free-space optical system below.
System requirements:
[light source and wavelength, beam parameters (waist/divergence/polarization), optical function and targets, spatial constraints]
First turn my requirements into measurable targets, select catalog optics, lay out the 3D beam path, and verify all targets. Show me the optical layout, chosen parts, per-target results, and 3D views. Run your first 3D optical system in 60s
Requires Python 3.11+. Sync the offline optical catalog, run a reference design, and open the interactive 3D view. Run os-optics-kit cases list to copy and verify 18 worked cases.
python -m pip install os-optics os-optics-kit
os-optics catalog sync
os-optics project example --kind beam_expander > project.json
os-optics project run project.json --out-dir run
os-optics view run FAQ
- Is OS Optics completely free and open source?
- Yes. Both the core engine (os-optics) and the community toolkit (os-optics-kit) are released under the MIT License. Local design, simulation, and 3D viewing are free with no sign-up.
- Which AI agents work with it?
- Any general-purpose coding agent that can read web pages and run Python or shell commands, including DeepSeek Harness, Claude Code, Codex, Cursor, WorkBuddy, and ChatGPT.
- Are my optical designs uploaded to the cloud?
- No. After syncing the catalog once, all design, simulation, analysis, and rendering stay offline on your machine. Nothing leaves your computer unless you explicitly request external hardware pricing.
- What is the difference between os-optics and os-optics-kit?
- os-optics is the lean, deterministic physics kernel. os-optics-kit builds on top with worked cases, vendor-neutral agent skills, parallel sweeps, tolerance analysis, a live read-only viewer, and presentation rendering.
- Can I design custom multi-element imaging lenses outside the catalog?
- Yes. Alongside 3,000+ real catalog components, you can declare custom lenses, even aspheres, freeforms, crystals, and custom coatings, or import CSV lens prescriptions directly for MTF/PSF and tolerance studies.
- How can I join discussions, report issues, or contribute?
- Join GitHub Discussions on os-optics for optical design topics, open Issues or PRs for engine improvements, or share worked cases and agent skills in os-optics-kit (English or Chinese welcome).
When a free-space design moves to physical hardware
Open-source design and simulation are standalone with zero purchasing requirement. Whenever a catalog-based setup is ready for the bench, you can optionally connect through an OpenSci account for matched optics, assembly drawings, and alignment services (currently shipping within mainland China).
Join the OS Optics open-source community
Explore deterministic optical engineering locally with Python or your favorite coding agent. If OS Optics helps your work, give us a Star on GitHub!
For AI Agents
AI Agent Instructions
Agent: this entry guide is intentionally decoupled from specific package versions. After installing, always treat your local --help, capabilities, and the repositories' AGENT_GUIDE.md as the live source of truth.
1. Ground Rules & Discovery
- Install and run the tools directly in the user's local environment; optical design, physics simulation, analysis, and local viewing are free and require no account.
- Use standard PyPI packages: run python -m pip install os-optics and python -m pip install os-optics-kit (add the optional python -m pip install "os-optics[protected]" only when opening encrypted commercial assembly deliveries). Do not replace package installation with repository checkouts.
- Engine repository: https://github.com/JunLin615/os-optics; toolkit, cases, and skills repository: https://github.com/JunLin615/os-optics-kit (agent workflow guide: AGENT_GUIDE.md).
- Exact flags, metrics, capabilities, interop contracts, and exit-code rules evolve across releases — do not guess from memory. Query them dynamically via os-optics --help, os-optics capabilities, os-optics schema project, os-optics results metrics, os-optics interop list, and os-optics-kit skills list.
- If a step cannot run in your environment, preserve the Project JSON file and tell the user which step completed last and where the files are saved.
2. Local Design & Self-Discovery Commands
# Environment & dynamic self-discovery (Python 3.11+)
python -m pip install os-optics os-optics-kit
os-optics doctor # check environment, catalog, and next_steps
os-optics capabilities # discover current features, settings, and schemas
os-optics catalog sync # sync versioned offline optical catalog
os-optics interop list # discover verified scientific library handoffs
os-optics-kit skills list # list available agent skills (load only what you need)
os-optics-kit cases list # browse engine-reproducible reference cases
# Design, evaluate, simulate & inspect
os-optics catalog list --help # filter catalog components by form / wavelength / focal length
os-optics project example --kind beam_expander > project.json
os-optics project evaluate --describe # discover selective evaluation capabilities & analyses
os-optics project evaluate project.json # fast in-memory candidate evaluation (JSON)
os-optics project run project.json --out-dir run
os-optics results describe run # plus targets, monitors, imaging, ghosts, field, cavity ...
os-optics view run --snapshot shots # headless 3D/2D views (or os-optics-kit view run)
os-optics project verify run - Equivalent Python APIs live in os_optics.local (including EvaluationSession and run_optical_project) and os_optics.results.load_run; the engine is stateless and safe for parallel workers and multi-agent swarms.
- For custom multi-element imaging lenses or prescription import, inspect os-optics native --help and os-optics project import-prescription --help; for large free-space benches use os-optics workspace --help.
- For parameter sweeps, sensitivity ranking, Monte Carlo tolerance, and presentation figures, load the matching os-optics-kit skills.
3. Design Principles & Honest Reporting
- Quantify targets first: turn user requirements into measurable targets and ask only questions that change the optical architecture.
- Optics first: focus on sources, lens prescriptions or catalog optics, observation planes, targets, and adjustable DOFs — do not manually pick mounts, posts, or breadboards during optical design.
- Report bounds honestly: judge outcomes by each target's assessment, value_basis, and model_scope_issues. Call out any unmet, indeterminate, or out-of-scope item clearly; never report an estimate or unassessed target as passed.
- Return to the user: concise summary of targets and assumptions, optical architecture and parts/prescription, per-target results and findings, 2D section or 3D views, and local Project/run paths.
Optional: Commercial Hardware & Ordering (Only when requested)
Follow this section only when the user explicitly asks to price or order physical hardware. Routine local design and open-source simulation never require an account or token.
- Endpoints: Commercial Service base URL OPENSCI_API_URL=https://opensci-optics.com (capabilities /api/v1, OpenAPI /api/v1/openapi.json); Account site https://account.opensci-optics.com/.
- Self-discovery: inspect os-optics resolve --help, os-optics order --help, os-optics assembly --help, os-optics account --help, and os-optics feedback --help for current commercial commands and options.
- Security boundaries: use only an Agent token created by the user in Account (sent via Authorization: Bearer; never placed in URLs, shell arguments, or chat replies). Never ask for passwords, never log in for the user, never report a bank transfer unless the user confirms it, and never claim payment confirmation or signatures.
- Recovery: follow structured error.code and recovery fields from the service; if the service is unreachable, local open-source design continues normally.