Description
Enhance the existing TimelapseOrchestrator to support truly asynchronous, dynamically configurable timelapse acquisition where each embryo operates on independent schedules that can be modified at runtime.
Current State
TimelapseOrchestrator exists with background asyncio task
- Per-embryo
EmbryoAcquisitionState tracks intervals and timepoints
- Stop conditions and interval rules exist but are set at start time
Requirements
1. Independent Embryo Scheduling
Each embryo should have its own acquisition schedule that can be started/stopped/modified independently without affecting others.
2. Dynamic Configuration
Allow runtime modification of:
- Acquisition intervals per embryo
- Number of slices, exposure settings
- Stop conditions (add/remove/modify)
- Priority ordering
- Focus drift correction parameters
3. Spawn-on-Demand
Ability to add new embryos to an ongoing timelapse without restarting.
4. Asynchronous Event Handling
- Detection-triggered interval changes should apply immediately
- Stage-based adaptive imaging (speed up before hatching)
5. Fluorescence Signal-Driven Acquisition
- Monitor embryos periodically (low frequency) for fluorescence signal expression (e.g., red channel)
- When signal starts expressing, automatically increase imaging frequency for that embryo
- Support configurable signal thresholds and frequency escalation rules
- Use case: Late-expressing reporters where expression timing varies per embryo
Technical Approach
- Refactor
TimelapseOrchestrator._run_loop() to use per-embryo asyncio tasks instead of sequential loop
- Add
EmbryoTimelapseTask class managing individual embryo acquisition lifecycle
- Add real-time configuration update API via tools
- Implement
FluorescenceMonitor for signal-triggered acquisition:
- Periodic low-frequency monitoring task (configurable interval)
- Signal detection via intensity thresholding or detector system
- Automatic interval adjustment rules when signal detected
- Per-embryo signal tracking state
Key Files
gently/agent/timelapse_orchestrator.py
gently/agent/state.py (EmbryoAcquisitionState)
gently/agent/tools/timelapse_tools.py
Description
Enhance the existing
TimelapseOrchestratorto support truly asynchronous, dynamically configurable timelapse acquisition where each embryo operates on independent schedules that can be modified at runtime.Current State
TimelapseOrchestratorexists with background asyncio taskEmbryoAcquisitionStatetracks intervals and timepointsRequirements
1. Independent Embryo Scheduling
Each embryo should have its own acquisition schedule that can be started/stopped/modified independently without affecting others.
2. Dynamic Configuration
Allow runtime modification of:
3. Spawn-on-Demand
Ability to add new embryos to an ongoing timelapse without restarting.
4. Asynchronous Event Handling
5. Fluorescence Signal-Driven Acquisition
Technical Approach
TimelapseOrchestrator._run_loop()to use per-embryo asyncio tasks instead of sequential loopEmbryoTimelapseTaskclass managing individual embryo acquisition lifecycleFluorescenceMonitorfor signal-triggered acquisition:Key Files
gently/agent/timelapse_orchestrator.pygently/agent/state.py(EmbryoAcquisitionState)gently/agent/tools/timelapse_tools.py