Autonomous microscopy control with advanced imaging capabilities
🔬 Try Live Demo | ⚡ Quick Start | 📦 Installation
Agent-Lens is a web-based platform for intelligent microscopy control, combining:
- Hardware Control: Multi-microscope coordination with robotic sample handling
- AI Integration: SAM segmentation, CLIP/DINOv2 similarity search
- Advanced Imaging: Time-lapse, multi-channel, OME-Zarr data management
- Interactive UI: Real-time stage maps, annotations, and visualization
Visit https://hypha.aicell.io/reef-imaging/apps/agent-lens/
# Setup
bash scripts/setup_dev.sh
conda activate squid
# Connect to Hypha server (no local server needed)
python -m agent_lens connect-server \
--workspace_name=reef-imaging \
--server_url=https://hypha.aicell.io
# Access at: https://hypha.aicell.io/reef-imaging/apps/agent-lens-test/docker pull ghcr.io/aicell-lab/agent-lens:main
docker run -d -p 9527:9527 \
-e WORKSPACE_TOKEN=$WORKSPACE_TOKEN \
ghcr.io/aicell-lab/agent-lens:main🔬 Microscopy: XYZ positioning, autofocus, multi-channel illumination, well plate navigation
🤖 AI Features: Segmentation, similarity search, autonomous operation
🔍 Similarity Search: CLIP-based annotation matching across datasets
🧬 Cell Segmentation: Fine-tuneable microSAM via BioEngine
⏱️ Time-Lapse: Automated multi-timepoint, multi-position imaging
🤖 Robotics: Automated sample transfer with incubator integration
💾 Data: OME-Zarr format with S3 storage and efficient chunked access
- Conda/Miniconda
- Node.js 20+
- Python 3.11+
- Docker (optional)
git clone https://github.com/aicell-lab/agent-lens.git
cd agent-lens
bash scripts/setup_dev.shThis creates a conda environment, installs dependencies, and prompts for Hypha tokens.
# Create environment
conda create -n squid python=3.11
conda activate squid
# Install dependencies
pip install -e ".[test]"
npm install --prefix frontend
playwright install chromium
# Configure tokens
echo "WORKSPACE_TOKEN=your_token" > .env
echo "PERSONAL_TOKEN=your_token" >> .env
# Get tokens from: https://hypha.aicell.ioWORKSPACE_TOKEN=<required> # Get from https://hypha.aicell.io
PERSONAL_TOKEN=<optional> # For private workspaces
SERVER_URL=https://hypha.aicell.io
LOG_LEVEL=INFOHypha Server (hypha.aicell.io)
├── Frontend Service (ASGI + React)
├── Microscope Services (squid-1, squid-2, simulation)
├── Helper Services (Cellpose segmentation, similarity search)
├── BioEngine (Cellpose as BioEngine app)
└── Orchestrator (time-lapse scheduling)
agent-lens/
├── agent_lens/ # Python backend
│ ├── register_frontend_service.py # ASGI service + REST APIs
│ ├── register_tools_service.py # AI/ML tools service
│ └── utils/ # Artifact manager, embeddings, ChromaDB
├── frontend/ # React application
│ ├── components/
│ │ ├── map_visualization/ # Stage map & OME-Zarr
│ │ ├── similarity_search/ # Vector search UI
│ │ └── microscope_acquisition/ # Scan config
│ └── utils/ # Zarr loader, embeddings, OpenAI
├── bioengine-app/ # Cellpose & microSAM deployment
├── tests/ # Test suite (Python + JavaScript)
├── docker/ # Containerization
└── scripts/ # Automation scripts
conda activate squid
python -m agent_lens connect-server --workspace_name=reef-imagingcd frontend
npm start # Hot reload at http://localhost:5173# Fast tests (recommended for development)
python scripts/run_tests.py --type fast
# With coverage
python scripts/run_tests.py --coverage
# Frontend E2E
python scripts/run_tests.py --frontend-service
# Component tests
node tests/test-frontend-components/run_tests.js# Frontend only
cd frontend && npm run build
# Docker image
docker build -f docker/dockerfile -t agent-lens:latest .Deploy microSAM & Cellpose for cell segmentation:
# Start worker
conda activate microsam
python -m bioengine.worker \
--workspace reef-imaging \
--head_num_gpus 2
# Deploy service (see bioengine-app/README.md)
python scripts/deploy_cellsegmenter.pyUsage:
segmenter = await server.get_service("reef-imaging/cell-segmenter")
result = await segmenter.segment_all(image=image)Interactive OpenLayers map with:
- Real-time FOV indicator and well plate overlay
- OME-Zarr tile streaming with multi-scale pyramids
- Annotation tools and similarity search layer
- Efficient chunked data loading via artifact manager
- Draw annotations to find similar cells across datasets
- CLIP/DINOv2 embeddings
- Cross-experiment and time-series search
- Sub-second queries on thousands of annotations
- Multi-position, multi-channel acquisition
- Task scheduling with orchestrator service
- Autofocus at each timepoint
- Hardware coordination (microscope + incubator + robotic arm)
- Robotic sample transfer between incubator and microscopes
- Collision prevention with operation locking
- State tracking and error recovery
- OME-Zarr format with S3-compatible storage
- Chunked compression for efficient access
- Multi-scale pyramids for visualization
- Artifact manager for datasets and galleries
docker-compose -f docker/docker-compose-agent-lens-app.yml up -ddocker run --gpus all \
-e WORKSPACE_TOKEN=$WORKSPACE_TOKEN \
ghcr.io/aicell-lab/agent-lens:main- Non-root user (UID 1000)
- Token-based authentication
- CORS and security headers configured
Circular dependencies
npm run check:circles --prefix frontendToken errors
export WORKSPACE_TOKEN=your_tokenPlaywright issues
playwright install chromiumGPU not detected
# Install NVIDIA Container Toolkit
docker run --gpus all ghcr.io/aicell-lab/agent-lens:mainexport LOG_LEVEL=DEBUG
python scripts/run_tests.py --verboseTest categories:
--type fast: Unit tests (< 2s, best for development)--type integration: Service communication tests--type slow: AI model tests (CLIP, DINOv2, microSAM, Cellpose)--frontend-service: Playwright E2E tests--coverage: Generate coverage reports
CI/CD runs automatically on push via GitHub Actions.
Backend: FastAPI, Hypha-RPC, PyTorch, CLIP, DINOv2, zarr, scikit-image
Frontend: React 18, Vite, Bootstrap 5, Tailwind CSS, OpenLayers, zarrita
Infrastructure: Docker, GitHub Actions, MinIO, Weaviate
AI: DINOv2, CLIP, BioEngine app for microSAM and Cellpose Segmentation
- CLAUDE.md - Comprehensive development guidelines
- tests/README.md - Testing documentation
- bioengine-app/README.md - BioEngine services
MIT License - Copyright (c) 2024 Agent-Lens Contributors
See LICENSE for details.