Sandbox
@Xiangyue-Zhang/auto-deep-researcher-24x7

Autonomous experiment agent for Claude Code and Codex

This repo packages a leader-worker agent system that keeps deep learning experiments moving in a loop: plan, execute, monitor, and reflect. The agent reads project briefs, edits code, launches runs, watches progress with low cost, and stores memory across cycles.

1,291 stars114 forksPythonUpdated 3mo ago
Who it's for

Builders who want Claude Code or Codex to run long experiment loops on their projects and keep track of results over time.

What it delivers

You can let an agent run training, monitor progress, and pick the next experiment while you stay focused on the research direction.

What it does

Leader-worker experiment loop

A leader agent plans each cycle and hands work to idea, code, and writing agents.

Persistent experiment memory

Ledger and journal files store hypotheses, results, dead ends, and durable insights across cycles.

Zero-cost monitoring

Training is watched with process and log checks instead of repeated LLM calls.

Multiple execution backends

Local, SSH, and Slurm execution modes let the controller stay separate from the training host.

Packaged Claude and Codex automation

The installer sets up slash commands for Claude Code and local skills for Codex.

Repo-reading and literature tools

Tools like code search, tree listing, file reads, paper lookup, and arXiv search support experiment work.

Safety and rate limits

Optional gates, stagnation signals, and cycle caps help avoid runaway loops.

How to get it

  1. 1Don't have an API key? Get one at console.anthropic.com and set it
    export ANTHROPIC_API_KEY="sk-ant-xxxxx"
    # Add to ~/.bashrc or ~/.zshrc to make it permanent
  2. 2Let's say you want to train a ResNet on CIFAR-100. Create a project folder with a…
    mkdir ~/my-first-experiment
    cd ~/my-first-experiment
  3. 3Open Claude Code and type
    /auto-experiment --project ~/my-first-experiment --gpu 0
  4. 4Option B: Through Python directly
    python -m core.loop \
      --project ~/my-first-experiment \
      --gpu 0 \
      --max-cycles 5    # Stop after 5 cycles (remove for unlimited)
  5. 5While the agent is running, you can check on it
    # In Claude Code:
    /experiment-status --project ~/my-first-experiment
    
    # Or check GPU usage:
    /gpu-monitor
  6. 6If vault_path is set, the agent writes
    DeepResearcher/my-first-experiment/Dashboard.md
    DeepResearcher/my-first-experiment/Daily/YYYY-MM-DD.md

README

Deep Researcher Agent

Deep Researcher Agent

24/7 Autonomous Deep Learning Experiment Agent

An AI agent that autonomously runs your deep learning experiments 24/7 while you sleep.

English | 中文 | 日本語 | 한국어

Quick Start Architecture

Python Claude Code Codex CLI License Stars

Technical Report


Recent Updates

2026-06-03 — Domestic LLM API presets

  • Run the agent on a Chinese LLM API instead of a Claude/Codex subscription by setting agent.provider to a one-word preset — deepseek, qwen (dashscope), kimi (moonshot), or glm (zhipu). The preset auto-fills the OpenAI-compatible base_url and the default key env (DEEPSEEK_API_KEY / DASHSCOPE_API_KEY / MOONSHOT_API_KEY / ZHIPUAI_API_KEY); you just set model to that vendor's model id. base_url / api_key_env stay overridable for self-hosted or proxied endpoints. This is a thin alias over the existing OpenAI-compatible path — no new dependency. (core/agents.py)

    agent:
      provider: "deepseek"      # or qwen / kimi / glm
      model: "deepseek-chat"    # vendor's model id
    

2026-06-02 — Slurm execution backend + truthful experiment outcomes

  • Slurm execution backend — added execution.mode: "slurm" so the agent can drive experiments on a Slurm cluster. The controller stays local; training is submitted to the login node with sbatch --parsable over a single transient SSH call that exits immediately — no process is ever left running on the login node. sacct is the sole liveness authority (Slurm enforces --time), GPU status is read from the partition's squeue occupancy, and two bounds inside the liveness check (consecutive-unknown grace + a --time-derived wall-clock backstop) guarantee the monitor loop terminates even if the cluster goes unreachable — without ever reaping a job sacct still reports as queued or running. File and repo-reading ops reuse the SSH path (the login node shares the NFS workspace). (core/execution.py)
  • Truthful experiment outcomes — the monitor now asks the backend for a finished job's real terminal state via final_status(), so a FAILED / TIMEOUT / CANCELLED run is no longer silently recorded as completed. The outcome flows into state.json, the experiment ledger, and the REFLECT context, so the agent reasons over what actually happened. On Slurm the state comes from sacct; pid-only backends (local/ssh) report it as indeterminate and keep prior behavior. (core/monitor.py, core/loop.py)
  • Additive and opt-in; local/ssh behavior is unchanged. (+21 unit tests, no cluster required.)

2026-06-01 — v2.0 (major update)

This release gives the agent (a) a persistent, queryable memory of its own experiments, (b) explicit progress/quality/safety signals derived from that memory, and (c) much stronger code- and literature-reading tools. Every change is additive and backward-compatible — existing projects keep working unchanged, the new gate and rate limit are opt-in, and the whole suite is unit-tested without a GPU or network (60 → 99 tests).

New: autonomy layer

  • Experiment ledger — every cycle's hypothesis, metrics, and outcome are appended to workspace/experiments.jsonl. Crash-safe, zero token cost, and fed back into planning so the agent remembers what it already tried. (core/ledger.py)
  • Data-driven stagnation signal — the planner is told, from the ledger's metric trajectory, whether results are still improving or have stalled (set ledger.metric_key), instead of only a binary repeat-counter.
  • Append-only research journalsDEAD_ENDS.md (failed approaches — do not retry) and INSIGHTS.md (durable observations). Never compacted; rotated to dated backups when large, so history is never silently dropped. (core/journal.py)
  • Zero-cost violation scanner + advisory phase gate — surface stuck/stale states and whether a baseline metric bar is met, as pure functions over state + ledger. (core/safety.py, core/ledger.py)
  • Proactive anti-burn rate limiting — optional agent.max_cycles_per_hour cap protects budget when the agent is stuck in a loop.

New: agent tools

  • Code comprehensionsearch_code (regex grep across the workspace), list_tree (recursive, depth-limited repo map), and read_file line ranges so large files are no longer blindly truncated. Symlink-safe (never escapes the workspace).
  • Literatureget_paper (paper details + reference/citation snowballing) and search_arxiv (freshest preprints), alongside the existing Semantic Scholar search.
  • All new tools work identically in local and SSH execution modes.

Config: new optional sections ledger:, stagnation:, journal:, safety:, gates:, and agent.max_cycles_per_hour — all default to current behavior. See config.yaml.

2026-04-22

  • Added explicit compatible-API configuration, dual Claude/Codex skill installation, and safer skill-installer ownership checks.

2026-04-21

  • Added an optional SSH execution backend so the controller can stay local while code edits, training, logs, PID checks, and GPU queries run on one remote host.

2026-04-19

  • Added a real multi-turn worker tool-use loop with authoritative tool-result handoff, stricter CLI behavior, and safer tool-call parsing.

2026-04-18

  • Added subscription-backed claude_cli and codex_cli provider modes with fail-fast provider validation and more defensive CLI subprocess handling.

2026-04-09

  • Reduced token growth and tightened loop/tool safeguards with leader-history resets, no-progress fallback, and stronger path and shell protections.

2026-04-08

  • Added progress tracking exports with optional Obsidian sync and local text fallback when no vault is configured.

Start In 3 Steps

If you only want the shortest path to a working experiment loop, do this:

  1. Create a project folder with one file: PROJECT_BRIEF.md
  2. Run /auto-experiment --project /path/to/project --gpu 0
  3. Check progress with /experiment-status or optional Obsidian/local text notes

Prefer AI-guided setup? Open AI_GUIDE.md in Claude / ChatGPT / Codex and let the assistant walk you through it.

What You Actually Need

RequirementRequiredNotes
Python 3.10+YesRuntime
1+ NVIDIA GPUYesFor training
API keyYesAnthropic-compatible or OpenAI-compatible endpoint
PROJECT_BRIEF.mdYesMain control file
Project config.yamlOptionalOnly if you want to override defaults
Obsidian vaultOptionalIf absent, notes fall back to local text files

Minimum Working Example

The smallest project you can launch looks like this:

my-first-experiment/
├── PROJECT_BRIEF.md
└── workspace/                  # auto-created

Minimal PROJECT_BRIEF.md:

# Goal
Train a ResNet-50 on CIFAR-100 to reach 80%+ accuracy.

# Codebase
Create the training code from scratch in PyTorch.

# What to Try
- Start with a basic ResNet-50 baseline.
- If accuracy < 75%, improve optimization and schedule.
- If accuracy is 75-80%, try augmentation.
- If accuracy > 80%, stop and report.

# Constraints
- Use GPU 0 only
- Max 100 epochs per run

That is enough to start. Everything else is optional refinement.

What This Project Is Good At

This project is for people who already know what experiment they want to run, but do not want to babysit the loop:

  • edit code
  • launch training
  • monitor runs
  • parse logs
  • decide the next variation
  • keep going while you sleep

It is not trying to replace the researcher. It is trying to take over the repetitive experiment-ops layer.

Why It Feels Different From A Simple Script

  • It does not just launch one run. It keeps iterating.
  • It does not just monitor. It reflects and decides the next step.
  • It stays cheap because training-time monitoring makes zero LLM calls.
  • It stays controllable because the human can override direction at any cycle.
  • It now supports persistent progress notes in Obsidian or local text files.

How You Stay In Control

You control the research direction through three files:

  • PROJECT_BRIEF.md: stable goal, constraints, allowed search space
  • HUMAN_DIRECTIVE.md: temporary redirect for the next cycle
  • workspace/MEMORY_LOG.md: rolling memory of results and decisions

Common control patterns:

# Keep the search narrow
- Only tune augmentation.
- Do not change the backbone.
- Keep training budget fixed.
# Make the agent stop exploring a weak direction
- If gain stays below 0.3 points for 3 runs, stop this branch.
- Return to the last trusted baseline and try a different idea.
# Force result verification
- If a result looks unusually strong, rerun with the same seed and one new seed.
- Do not claim improvement until both reproduce.

How You See Progress

You should never have to guess what the agent is doing.

  • /experiment-status shows current goal, best result, cycle count, running status, and recent decisions
  • /progress-report generates a structured summary
  • /obsidian-sync refreshes persistent notes manually
  • workspace/progress_tracking/ stores local text notes when no Obsidian vault is configured

If you want a dashboard outside the terminal:

obsidian:
  enabled: true
  vault_path: "~/Documents/MyObsidianVault"   # Optional
  auto_append_daily: true

If vault_path is empty, the same information is saved locally:

workspace/progress_tracking/Dashboard.txt
workspace/progress_tracking/Daily/YYYY-MM-DD.txt

💛 A Note on Why We Built This — and How We Hope You'll Use It

Our hope is simple: science stays pure, and the human stays in the loop.

We built this framework for one reason — to take the repetitive, mechanical parts of running deep learning experiments off the researcher's plate (launching jobs, watching GPUs, parsing logs, sweeping hyperparameters) so that more of your time can go into the part that actually matters: thinking.

If you're here because you want to spend less time babysitting training runs and more time reading, reasoning, and chasing your own ideas — welcome. That's exactly who we built this for.

A gentle thought we'd love every user to share with us:

The agent is happy to run the experiments. But please let the ideas, the interpretation, and the scientific judgment remain yours. We don't see automation and academic integrity as being in tension — quite the opposite. The hours this tool gives back are meant to be reinvested in deeper thinking, not in skipping it.

So we'd kindly ask that this project not be used to fabricate results, to generate "research" with no human in the loop, or to shortcut the parts of science that depend on a human actually understanding what they're doing. That isn't the future we want to help build — and we don't think it's the one most of you want either.

Science should stay pure. The agent can run the experiments — but the ideas, the interpretation, and the responsibility belong to the human.

学术应当保持纯粹。 Agent 可以替你跑实验,但 idea、判断与责任,请留给人来承担。我们真心希望每一位使用者都能 human in the loop 地去思考,把这个工具省下来的时间,投入到真正属于你自己的研究方向里。

科学は純粋であるべきです。 Agent は実験を走らせることができますが、アイデア・解釈・責任は、どうか人間の手に残してください。

과학은 순수해야 합니다. Agent는 실험을 대신 실행해 줄 수 있지만, 아이디어와 해석, 그리고 책임은 부디 사람의 몫으로 남겨주세요.

We trust the people who pick up this tool to take that seriously — and we built it because we believe most of you already do. Thank you for being one of them. 💛


The Core Idea

You design the experiment. The agent handles the repetitive loop.

Deep Researcher Agent:

  1. Thinks — Reads your project brief, analyzes previous results, plans the next experiment
  2. Executes — Modifies code/configs, runs a dry-run, launches training on GPU
  3. Monitors — Watches training at zero LLM cost (just process checks + log reads)
  4. Reflects — Parses results, compares with baselines, decides what to try next
  5. Repeats — 24/7, without human intervention
You sleep 8 hours     → Agent runs 3 experiment cycles
You go on vacation    → Agent explores 50+ hyperparameter configs  
You write your paper  → Agent already has the results table ready

Battle-Tested Results

Not benchmarks. Real results from months of 24/7 autonomous operation across research projects.

MetricResult
Autonomous experiment cycles completed500+
Best single-project improvement52% over baseline (across 200+ auto-run experiments)
Concurrent projects managed4 projects across 4 GPU servers
Longest continuous autonomous operation30+ days without human intervention
Average LLM cost per 24h cycle~$0.08

Key Innovation: Zero-Cost Monitoring

The #1 concern with running LLM agents 24/7: cost.

Most agent frameworks call the LLM every few minutes to "check progress". That's $50+/day.

Experiment Agent sleeps during training — zero API calls. It only wakes the LLM when training finishes.

                    LLM Active              Zero Cost              LLM Active
                  ┌────────────┐    ┌─────────────────────┐    ┌────────────┐
                  │   THINK    │    │   TRAIN & MONITOR    │    │  REFLECT   │
                  │ (5-10 min) │    │   (hours/days)       │    │ (5-10 min) │
                  │            │    │                      │    │            │
                  │ • Analyze  │    │ • kill -0 $PID       │    │ • Parse    │
                  │ • Plan     │    │ • nvidia-smi         │    │   logs     │
                  │ • Code     │    │ • tail log           │    │ • Compare  │
                  │            │    │                      │    │ • Decide   │
                  │  ~$0.05    │    │      $0.00           │    │  ~$0.03    │
                  └────────────┘    └─────────────────────┘    └────────────┘

24-hour cycle with 8 hours of training: ~$0.08 in LLM calls.


Architecture

The THINK → EXECUTE → REFLECT Loop

┌──────────────────────────────────────────────────────┐
│  ┌──────────┐    ┌──────────┐    ┌──────────┐       │
│  │  THINK   │───→│ EXECUTE  │───→│ REFLECT  │──┐    │
│  │          │    │          │    │          │  │    │
│  │ Analyze  │    │ Dry-run  │    │ Evaluate │  │    │
│  │ Plan     │    │ Launch   │    │ Compare  │  │    │
│  │ Decide   │    │ Monitor  │    │ Update   │  │    │
│  └──────────┘    └──────────┘    └──────────┘  │    │
│       ↑                                         │    │
│       └─────────────────────────────────────────┘    │
│                    ↻ 24/7 Loop                       │
└──────────────────────────────────────────────────────┘

Leader-Worker Agent System

Only ONE worker runs at a time. Others idle at zero cost.

              ┌───────────────┐
              │    Leader     │  Persistent conversation
              │   (Planner)   │  within each cycle
              └───┬───┬───┬───┘
                  │   │   │
          ┌───────┘   │   └───────┐
          ↓           ↓           ↓
    ┌──────────┐ ┌──────────┐ ┌──────────┐
    │   Idea   │ │   Code   │ │ Writing  │
    │  Agent   │ │  Agent   │ │  Agent   │
    │ (4 tools)│ │ (5 tools)│ │ (3 tools)│
    └──────────┘ └──────────┘ └──────────┘

Two-Tier Memory (Constant Size Forever)

┌─────────────────────────────────────────┐
│ Tier 1: PROJECT_BRIEF.md               │
│ • Frozen project reference              │
│ • Max 3,000 chars                       │
├─────────────────────────────────────────┤
│ Tier 2: MEMORY_LOG.md                   │
│ • Key Results (auto-compact at 1,200ch) │
│ • Recent Decisions (rolling last 15)    │
│ • Max 2,000 chars                       │
├─────────────────────────────────────────┤
│ Total: ~5K chars / ~1,500 tokens        │
│ SAME whether running 1 day or 6 months  │
└─────────────────────────────────────────┘

Cost Control Strategies (8 Total)

#StrategySavings
1Zero-LLM monitoring during training90%+ of runtime is free
2Two-Tier memory with auto-compactionFixed context window
3Leader conversation persists within cycleBrief sent once per cycle
4Anthropic prompt cachingSystem/tools cached
5Per-agent minimal tool sets (3-5 tools)Less schema overhead
6Slim system promptsFewer input tokens
7State trimmed before sendingNo bloat
8Single worker at a timeNo parallel LLM costs

Getting Started (Step by Step)

Complete beginner? Follow every step below. You'll go from zero to a running experiment agent in ~10 minutes.

Prefer AI-guided setup? Open AI_GUIDE.md in Claude Code, ChatGPT, or Codex — the AI will walk you through everything interactively.

Step 0: What You Need

RequirementWhyHow to Check
Python 3.10+Runtimepython3 --version
Claude CodeThe AI backboneclaude --version
1+ NVIDIA GPUFor trainingnvidia-smi
Anthropic API keyLLM callsecho $ANTHROPIC_API_KEY

Don't have an API key? Get one at console.anthropic.com and set it:

export ANTHROPIC_API_KEY="sk-ant-xxxxx"
# Add to ~/.bashrc or ~/.zshrc to make it permanent

Step 1: Install

# Clone the repo
git clone https://github.com/Xiangyue-Zhang/auto-deep-researcher-24x7.git
cd auto-deep-researcher-24x7

# Install Python dependencies
pip install -r requirements.txt

# Install 8 Claude slash commands and 8 Codex local skills
python install.py

# Verify everything works
python -m core.loop --check

You should see:

  Deep Researcher Agent — Installer
  ========================================

    ✓ Claude /auto-experiment
    ✓ Claude /experiment-status
    ✓ Claude /gpu-monitor
    ✓ Claude /daily-papers
    ✓ Claude /paper-analyze
    ✓ Claude /conf-search
    ✓ Claude /progress-report
    ✓ Claude /obsidian-sync
    ✓ Codex $auto-experiment
    ...

  Done! 8 Claude commands and 8 Codex skills installed.

Step 2: Create Your First Project

Let's say you want to train a ResNet on CIFAR-100. Create a project folder with a PROJECT_BRIEF.md:

mkdir ~/my-first-experiment
cd ~/my-first-experiment

Now write the brief — this is the most important file. It tells the agent what you want:

cat > PROJECT_BRIEF.md << 'EOF'
# Goal
Train a ResNet-50 on CIFAR-100 to reach 80%+ test accuracy.

# Codebase
The agent should create the training code from scratch using PyTorch.
- Use torchvision for the dataset (auto-download)
- Save checkpoints to ./checkpoints/
- Log metrics to ./logs/

# What to Try
- Start with a basic ResNet-50, lr=0.1, SGD, 100 epochs
- If accuracy < 75%, try cosine annealing + warmup
- If accuracy 75-80%, try adding mixup or cutout augmentation
- If accuracy > 80%, the goal is reached

# Constraints
- Use GPU 0 only
- Max 100 epochs per run
- Batch size 128

# Current Status
No experiments run yet. Starting from scratch.
EOF

Tips for writing a good brief:

  • Be specific about the goal (metric + target value)
  • Tell it where the code/data is (or say "create from scratch")
  • List constraints (which GPU, max epochs, etc.)
  • Give it a decision tree ("if X, try Y") — this guides the agent like you would guide a junior student

Step 3: Launch the Agent

Option A: Through Claude Code (recommended)

Open Claude Code and type:

/auto-experiment --project ~/my-first-experiment --gpu 0

Option B: Through Python directly

python -m core.loop \
  --project ~/my-first-experiment \
  --gpu 0 \
  --max-cycles 5    # Stop after 5 cycles (remove for unlimited)

Step 4: Watch What Happens

The agent will now do everything automatically. Here's what each cycle looks like:

=== Cycle 1 ===

[THINK] Reading PROJECT_BRIEF.md...
        Goal: ResNet-50 on CIFAR-100, target 80%+
        No previous experiments. Starting with baseline.
        Plan: Basic ResNet-50, lr=0.1, SGD with momentum, 100 epochs.

[EXECUTE] Creating train.py...
          Creating config.yaml...
          Running dry-run (2 steps)... ✓ No errors
          Launching training: nohup python train.py --config config.yaml
          PID: 12345, Log: logs/exp001.log

[MONITOR] Training in progress... (zero LLM cost)
          15:00 — PID alive, GPU 98%, Epoch 12/100, loss=2.34
          15:15 — PID alive, GPU 97%, Epoch 25/100, loss=1.87
          15:30 — PID alive, GPU 98%, Epoch 38/100, loss=1.54
          ...
          17:45 — PID alive, GPU 97%, Epoch 100/100, loss=0.82
          18:00 — PID terminated. Training complete.

[REFLECT] Parsing logs... test accuracy = 76.3%
          Result: 76.3% — below 80% target
          Brief says: "If < 75%, try cosine annealing"
          76.3% > 75%, so try augmentation instead.
          Decision: Add mixup augmentation, keep lr=0.1 + cosine
          Milestone logged: "Exp001: ResNet-50 baseline, 76.3%"

=== Cycle 2 ===

[THINK] Best so far: 76.3% (Exp001)
        Plan: Add mixup (alpha=0.2) + cosine annealing schedule
        ...

Step 5: Check Progress Anytime

While the agent is running, you can check on it:

# In Claude Code:
/experiment-status --project ~/my-first-experiment

# Or check GPU usage:
/gpu-monitor

You'll see something like:

# Experiment Status — my-first-experiment

## Goal
ResNet-50 on CIFAR-100 → 80%+ accuracy

## Progress
- Cycles completed: 3
- Current best: 79.1% (Exp003: ResNet-50 + mixup + cosine)
- Status: TRAINING (PID 12389, GPU 0, running 1.5h)

## Key Results
[04-07 15:00] Exp001: ResNet-50 baseline, 76.3%
[04-07 18:30] Exp002: + cosine annealing, 77.8%
[04-07 22:00] Exp003: + mixup α=0.2, 79.1%   ← best

## Current Training
Epoch 67/100 | loss: 0.71 | acc: 79.4%

Step 5.5: Save Progress to Obsidian or Local Text

Enable progress export in your project config.yaml:

obsidian:
  enabled: true
  vault_path: "~/Documents/MyObsidianVault"   # Optional
  project_subdir: "DeepResearcher/{project_name}"
  auto_append_daily: true

If vault_path is set, the agent writes:

DeepResearcher/my-first-experiment/Dashboard.md
DeepResearcher/my-first-experiment/Daily/YYYY-MM-DD.md

If vault_path is empty, it falls back to project-local files:

workspace/progress_tracking/Dashboard.txt
workspace/progress_tracking/Daily/YYYY-MM-DD.txt

Manual refresh:

/obsidian-sync --project 

Files in the repo

Repository payload22 top-level entries
  • .githooks
  • .github
  • agents
  • assets
  • core
  • docs
  • examples
  • gpu
  • paper
  • skills
  • tests
  • .gitignore
  • .mailmap
  • AGENTS.md
  • AI_GUIDE.md
  • CLAUDE.md
  • config.yaml
  • CONTRIBUTING.md
  • install.py
  • LICENSE
  • README.md
  • requirements.txt

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More agents

Hmbown/
Codewhale

Open-source coding agent for your terminal, built in Rust and on a journey of continuous community improvement. Issues and PRs welcome.

41k

A lightweight alternative to OpenClaw that runs in containers for security. Connects to WhatsApp, Telegram, Slack, Discord, Gmail and other messaging apps,, has memory, scheduled jobs, and runs directly on Anthropic's Agents SDK

31k
TokenRhythm/
opensquilla

OpenSquilla — Token-Efficient AI Agent with same budget, higher intelligence density

7k

An open-source AI coding agent that lives in your terminal.

28k
Untrivial-ai/
agent-orchestrator

Run and supervise teams of coding agents from planning to merge. Any harness (Claude code, codex, +25 more). Desktop, web, mobile, and cloud agents.

11k