ad-sdl/madsci/madsci-experiments
Claude Code and agent skill by ad-sdl/madsci
- community
Checking that the SKILL.md file is still in the repository.
Working with MADSci experiment modalities and the experiment lifecycle. Use when creating, modifying, or debugging experiments using ExperimentScript, ExperimentNotebook, ExperimentTUI, or ExperimentNode.
Install
npx vskill@latest install ad-sdl/madsci/madsci-experimentsSKILL.md
MADSci Experiments
MADSci provides four experiment modalities, all built on ExperimentBase which uses MadsciClientMixin (composition, not RestNode inheritance). Choose the right modality for your use case, then implement run_experiment().
Key Files
| File | Purpose | |
|---|---|---|
src/madsci_experiment_application/madsci/experiment_application/experiment_base.py | Base class, lifecycle, context manager | |
src/madsci_experiment_application/madsci/experiment_application/experiment_script.py | Simple run-once modality | |
src/madsci_experiment_application/madsci/experiment_application/experiment_notebook.py | Jupyter notebook modality | |
src/madsci_experiment_application/madsci/experiment_application/experiment_tui.py | Terminal UI modality | |
src/madsci_experiment_application/madsci/experiment_application/experiment_node.py | REST server modality | |
src/madsci_common/madsci/common/types/experiment_types.py | ExperimentDesign, Experiment, ExperimentStatus | |
src/madsci_client/madsci/client/experiment_client.py | Experiment Manager HTTP client | |
src/madsci_client/madsci/client/client_mixin.py | MadsciClientMixin with 7 lazy client properties | |
src/madsci_common/madsci/common/bundled_templates/experiment/ | Templates for all 4 modalities |
Choosing a Modality
| Modality | Best For | Entry Point | Interactive? | |
|---|---|---|---|---|
| ExperimentScript | Batch processing, automated pipelines | run() or main() | No | |
| ExperimentNotebook | Exploratory analysis, Jupyter workflows | start() / end() | Yes (cell-by-cell) | |
| ExperimentTUI | Operator-attended experiments needing pause/cancel | run_tui() | Yes (terminal) | |
| ExperimentNode | Remote-controlled experiments via REST API | start_server() | Via HTTP |
Architecture
Key design choice: ExperimentBase uses composition (MadsciClientMixin), not inheritance from RestNode. Only ExperimentNode creates a RestNode internally when it needs server capabilities.
ExperimentDesign vs Experiment
- ExperimentDesign: Template/blueprint. Defines experiment_name, description, resource_conditions. Reusable across runs. Can be loaded from YAML.
- Experiment: Runtime instance. Has experiment_id (ULID), status, timestamps, ownership. Created by
start_experiment_run().
ExperimentScript (Simplest Modality)
Entry points:
run(*args, **kwargs): Instance method. Merges config args with passed args.main(*args, **kwargs): Class method. Creates instance and callsrun().
Config class: ExperimentScriptConfig adds run_args and run_kwargs fields for CLI/env configuration.
ExperimentNotebook (Jupyter)
Designed for cell-by-cell interactive use in Jupyter notebooks.
Or use as context manager:
Key methods:
start(run_name, run_description): Starts experiment, displays status. Returnsself.end(status): Ends experiment, displays summary. Returnsself.run_workflow(workflow_name, parameters, display_result): Convenience wrapper forworkcell_client.run_workflow().display(data, title): Rich-formatted display (falls back to plain print).
Config class: ExperimentNotebookConfig adds rich_output: bool = True and auto_display_results: bool = True.
ExperimentTUI (Terminal UI)
Interactive terminal interface with pause/cancel controls via Textual.
Thread-safe controls:
request_pause()/request_resume()/request_cancel(): Called from TUI threadcheck_experiment_status(): Called in experiment thread. Usesthreading.Event(no server round-trips). RaisesExperimentCancelledErrorif cancelled. Blocks while paused.
Config class: ExperimentTUIConfig adds refresh_interval: float = 1.0 and show_logs: bool = True.
Requires: pip install textual (optional dependency).
ExperimentNode (REST Server)
Exposes run_experiment() as a node action, controllable via the workcell manager.
Internals: Creates a RestNode instance internally. Wraps run_experiment as a non-blocking action inside manage_experiment() context.
Config class: ExperimentNodeConfig adds server_host: str = "0.0.0.0", server_port: int = 6000, cors_enabled: bool = True.
Lifecycle and Context Manager
manage_experiment() (Recommended)
The context manager:
- Calls
start_experiment_run()-> registers with Experiment Manager - Sets up hierarchical logging context (experiment_id, experiment_name, run_name, experiment_type)
- Yields
self - On success:
end_experiment(COMPLETED) - On exception:
handle_exception()then re-raises
Manual lifecycle
Exception handling
Override handle_exception() for custom behavior:
ExperimentStatus
Exception Types
Client Access (via MadsciClientMixin)
All experiment modalities provide 7 lazy-initialized client properties:
Clients are created on first access. URLs resolved from config or lab context (service discovery).
Configuration
All configs inherit from ExperimentBaseConfig (MadsciBaseSettings, env prefix EXPERIMENT_):
Config files searched via walk-up: settings.yaml, experiment.settings.yaml, .env, experiment.env.
Creating Experiments from Templates
Templates in src/madsci_common/madsci/common/bundled_templates/experiment/:
script/->{name}.pynotebook/->{name}.ipynbtui/->{name}_tui.pynode/->{name}_node.py
Checking Experiment Status (Pause/Cancel)
Call check_experiment_status() at natural checkpoints in long-running experiments:
ExperimentTUI behavior: Uses local threading.Event (no network calls). Other modalities: Polls Experiment Manager with exponential backoff (5s -> 60s). Logs "Still waiting" every 5 minutes.
Common Pitfalls
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsrc/madsci_common/madsci/common/bundled_templates/_skills/madsci-experiments/SKILL.md
Popularity
- Repository stars
- 82
- Repository forks
- 11
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ad-sdl/madsci/madsci-experiments)