theadarshai/experiment-sequencer
🧪 Experiment Sequencer Dashboard
Welcome to the Experiment Sequencer, a premium, glassmorphism-themed dashboard and AI agent integration for scientific discovery. This project provides a robust OpenEnv-compatible environment for evaluating AI agents' ability to design and sequence scientific experiments autonomously.
🚀 Overview
The Experiment Sequencer is built to be portable, modern, and intelligent. It features:
- Premium Glassmorphism UI: A stunning, responsive dashboard for real-time monitoring.
- AI Agent Integration: A background-running agent that can sequence experiments automatically using Large Language Models.
- Real-time Streaming Logs: Watch the agent "think" and act via WebSockets.
- Simulation/Mock Mode: Test the entire system heuristically without requiring expensive LLM API keys.
🔬 Technical Architecture & Reinforcement Learning (RL) Mechanics
At its core, the Experiment Sequencer is framed as a Markov Decision Process (MDP) where an AI Agent interacts with a simulated physical environment. The agent must optimize a 'black-box' reward function under a constrained experiment budget.
1. The Environment (OpenEnv Standard)
The environment (experiment_sequencer.server.environment) exposes three core actions via a persistent WebSocket connection:
reset(task_id): Initializes the episode, establishing a fresh scientific budget and seeding the latent noise generators. Returns the initialExperimentObservation.step(action): The agent submits anExperimentAction. The environment routes this to the underlying physics/biology simulations (simulations.py), adds Gaussian noise to simulate real-world experimental variance, and returns the experimental yield as areward.state(): Yields the current environment configuration and best-known results.
2. The RL Agent (agent.py & inference.py)
Rather than traditional Deep Q-Networks or PPO algorithms, the agent here is an LLM-based autonomous researcher.
- Observation Space: The agent receives strict JSON definitions of the parameter space, the remaining budget, and the full history of previous experiments and their noisy rewards.
- Action Space: The agent outputs a JSON-formatted set of experimental parameters (e.g., temperatures, concentrations) representing the next trial.
- Exploration vs. Exploitation: The LLM must implicitly manage the exploration-exploitation tradeoff—initially sampling the space broadly, and eventually refining parameters around high-yield regions.
3. The Scientific Domains (Reward Landscapes)
The environment is structured to test different experimental reasoning strategies:
- Task 1: Plant Growth (OFAT Strategy)
- Mechanics: Variables (light, water, soil) are purely independent and additive. There are no cross-variable interactions.
- Goal: The agent should employ One-Factor-At-A-Time (OFAT) or simple grid search methodologies to find the peak.
- Task 2: Drug Formulation (Factorial Design)
- Mechanics: Introduces hidden variable interactions. Certain combinations of drugs create Synergistic Effects, while high temperatures and acidic pH create Degradation.
- Goal: The agent is forced to use Factorial Design to uncover latent correlations that would be missed by isolated variable testing.
- Task 3: Materials Science (Bayesian Optimization)
- Mechanics: A strictly continuous 2D surface (carbon ratio vs. sintering temp) containing both a heavily-weighted Global Peak and a deceptive Local Peak.
- Goal: Tests the agent's ability to maintain a broad Gaussian Process or Bayesian Optimization framework. If the agent acts too greedily, it will converge on the local peak and fail to discover the global optimum.
4. Graders (graders.py)
At the end of an episode (when the budget reaches 0), the trajectory of experiments is sent to a grader. The grader evaluates the agent on:
- Accuracy (Efficacy): Did the agent eventually try a configuration mathematically close to the true hidden optimum?
- Efficiency: How much of the constrained budget was wasted on suboptimal experiments before converging?
- Exploration Bonus (Task 3 only): Did the agent adequately map the entire landscape instead of falling for local traps?
🛠️ How to Run
Option 1: Live on Hugging Face Spaces (Recommended)
- Visit the Experiment Sequencer Space.
- Click the Settings (Gear Icon) in the top right.
- Enter your Hugging Face Write Token (or type
mockto run in Simulation Mode). - Select a task (e.g., "Materials Science") and click "Run AI Agent".
- Watch the agent's reasoning process and experimental results stream in the console!
Option 2: Local Development
# Install dependencies
pip install -r experiment_sequencer/server/requirements.txt
# Start the server
python -m uvicorn experiment_sequencer.server.app:app --host 0.0.0.0 --port 8000Open http://localhost:8000 in your browser.
🧠 Simulation / Mock Mode
Don't have an API key? By entering mock as your token in the settings, the dashboard will trigger a Virtual Agent. This virtual agent doesn't use an LLM—instead, it uses hardcoded heuristic logic (like random grid searching) to interact with the environment. This is an excellent way to watch the WebSocket streaming functionality in action instantly!
Built with ❤️ for the Hugging Face OpenEnv Hackathon.
