Skip to main content

sciworld

Turn published papers into research environments an AI agent can actually work in.

Every paper with public code is a frozen research trajectory — problem, method, baseline, metric, result. sciworld packages one of those into an isolated workspace, hands the keys to an agent (Claude Code or Codex), and lets it try to reproduce, improve, or solve from scratch — then scores the result.

pip install sciworld

Or from source:

git clone https://github.com/TaiMingLu/sciworld.git
cd sciworld
pip install -e .

CLI

sw init                                         # one-time setup wizard
sw config [section]                             # view/edit (paths, compute, prompt, test-prompt, …)
sw select [--id ID]                             # browse papers; clones <data_dir>/envs/<id>/source/
sw info --id <arxiv_id> [--full]                # show paper overview/problem/experiments
sw research --id <arxiv_id> [flags]             # build + launch a research env
sw evaluate --id <arxiv_id> [--run NAME]        # compare run scores to paper scores

sw research flags

Flag What it does
--id ARXIV_ID paper to work on (required for non-interactive use)
--mode improve | scratch agent gets the method + results (improve) vs problem-only (scratch)
--agent claude-code | codex which CLI runs inside the container
--tag TAG suffix for the run folder (e.g. v2, ablation)
--path DIR override workspace destination
--loop keep resuming the agent's session until status.json.done=true
--max-loops N safety cap for --loop (default 10)
--setup-only build the env + write launch.sh but don't launch the agent
--refresh bypass paper cache

sw research always writes a standalone launch_<run_name>.sh as a sibling of the workspace. Normal runs execute it inside tmux/screen/nohup. With --setup-only, nothing starts — the env is prepared and you can run bash <path>/launch_<run_name>.sh yourself (inside your own job scheduler, cron, or another session manager). Re-running the script is safe.

Train / test split (anti-shortcut)

After the agent sets status.json.done=true, sciworld silently enters a test phase: copies the hidden source/eval/test/ + scripts/evaluate_test.sh into the workspace, resumes the agent with a strict "be honest, do not cheat, do not modify your method" prompt, and records the test-side scores to scoring/scores_test.json. The test phase locks method/ read-only. Nothing test-related is present in the workspace during main-phase operation.

Trajectory and token capture

Each CLI invocation writes raw JSONL events to <env_dir>/trajectory/turn_NNNN_raw.jsonl and merges a unified summary into <env_dir>/trajectory/stats.json with {input_tokens, output_tokens, num_turns, duration_s, cost_usd, tool_uses} — identical shape for Claude Code and Codex.

Python API

Every CLI command is also a Python function with the same name and matching kwargs. Required args missing → TypeError; non-zero exit → RuntimeError (no interactive prompts — notebook/script-safe).

import sciworld
from pathlib import Path

info = sciworld.research(
    id="2505.19252", agent="claude-code", mode="scratch",
    loop=True, max_loops=5,
    system_prompt=Path("~/my_prompts/strict.md").expanduser(),
    test_prompt="Run evaluate_test.sh, write reflection.md, stop.",
    setup_only=False,       # True → write launch.sh, don't launch
)
# → {"arxiv_id", "run_name", "env_dir", "source_dir", "launch_script"}

sciworld.evaluate(id="2505.19252", run=info["run_name"])
sciworld.info(id="2505.19252")
sciworld.select(id="2505.19252")
sciworld.config()                               # returns current config dict
sciworld.config(section="compute")              # opens the interactive editor
sciworld.init(force=False)                      # first-time setup wizard

Prompt kwargs (system_prompt, mode_prompt, continue_prompt, test_prompt, compute) accept either a literal str or a pathlib.Path — paths are read at call time. Use import sciworld as sw if you prefer the two-letter alias.

Where things live

Path What's there
~/.sciworld/config.json your config (paths, container, session, env bindings)
~/.sciworld/instructions/*.md your customized prompts (system, research_scratch, continue, test, compute)
<data_dir>/envs/<id>/source/ cloned paper repo
<data_dir>/envs/<id>/<run_name>/ per-run agent workspace (bind-mounted into container)
<data_dir>/envs/<id>/launch_<run_name>.sh launcher — outside the workspace, not visible to the agent
<run_workspace>/agent.log full pretty-printed session log
<run_workspace>/trajectory/ raw per-turn JSONL + merged stats.json
<run_workspace>/scoring/scores_train.json agent's train-side scores
<run_workspace>/scoring/scores_test.json agent's test-side scores (written during test phase)
<run_workspace>/idea.md, reflection.md agent's end-of-run notes

Default prompts

All bundled prompts live as markdown under sciworld/prompts/ — nothing prompt-related is hardcoded in Python. Per-user overrides go into ~/.sciworld/instructions/ via sw config ….

File When it's used
system_prompt.md base role description, prepended to every launch
improve.md, scratch.md mode-specific task instructions
environment.md container housekeeping note (appended to every launch)
continue.md follow-up message for each --loop iteration
test.md strict test-phase prompt (sent only at test-phase transition)

Run any command with --help for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sciworld-0.1.0.tar.gz (78.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sciworld-0.1.0-py3-none-any.whl (88.4 kB view details)

Uploaded Python 3

File details

Details for the file sciworld-0.1.0.tar.gz.

File metadata

  • Download URL: sciworld-0.1.0.tar.gz
  • Upload date:
  • Size: 78.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for sciworld-0.1.0.tar.gz
Algorithm Hash digest
SHA256 692db3d9ec968b4c06b6c95d37a3c902bec4c28c8c05c2047492c76089d96cd9
MD5 d6f3187ab269e7c1fabb684294124cea
BLAKE2b-256 4ef217c701da64c84adc68280716ff4c587935ff9200ca5c20b39c006972430b

See more details on using hashes here.

File details

Details for the file sciworld-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sciworld-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 88.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for sciworld-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92c9b13bbf45735314170a35649f4c8079690ec860a991d5ce9cf86c363301c6
MD5 62d9a83ca34963957a1549c3679e578b
BLAKE2b-256 673d86996df18bf54f4de4326e60b9d6c132766322f6e4b36c6f362b2e1cd5e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page