← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / README.md
OpenAI4S · Open AI for Scientist ### Open AI for Scientist ## 💸 Replicating Claude Science in two cuts or less **An open-source hybrid scientific research agent.**
JSON tools orchestrate; persistent Python/R kernels do the science. **Launched by the Peking University–YuanKong Intelligence AI Joint Research Laboratory.**
由北京大学—元空AI联合实验室推出。

License: MIT Python Core deps Paradigm Tests

Stars Forks Issues PRs Welcome

**English** · [简体中文](README_zh.md)

[!TIP] Why "two cuts"? No pricey frontier-model key needed — OpenAI4S runs on Doubao (豆包) via the cheapest "Small" plan on Volcengine Ark (火山方舟): ¥9.9 / month (≈ US$1.4). Pick the ark provider in the UI and you get a Claude-Science-class agent for less than a cup of coffee.

Volcengine Ark · Agent Plan — Small tier at ¥9.9/month
Volcengine Ark · Agent Plan (Personal) — the entry Small tier is ¥9.9 / month.

🧬 JSON orchestration, Code-as-Action science

OpenAI4S deliberately has two action planes. Provider-native JSON tool calls handle deterministic orchestration, permissions, metadata, external services, and human approval. Python/R Code-as-Action handles computation, exploration, analysis, simulation, and long-running scientific work in persistent kernels. Python cells can synchronously call the in-kernel host API while they run; R is an independent persistent analysis channel.

This is not a choice between tools and code: each does the job it is good at. Tool-only and conversational work can finish through the Engine-owned, strictly structured finalize_response action. Scientific cells keep the important host.submit_output(...) completion contract, including structured artifacts and metrics. host.submit_output is the only completion signal that can fire inside a Cell; a later sole finalize_response may still close the Engine after earlier Cells have run.

JSON control planePython/R science plane
Best forworkflow, permissions, metadata, servicescomputation, analysis, simulation
Action unitOne ordered native-tool batchOne complete code cell
Compositionauditable schemas and resource policyfor, if, libraries; Python also has mid-cell Host RPC
Stateappend-only Action Ledgerkernel memory + versioned artifacts
CompletionEngine-owned finalize_responsePython: host.submit_output(...); R: no in-cell completion
Extendingnamed Tool subclassimport a library or load a Skill
# ReAct: ~14 round-trips (read → … → filter → sort → plot).   OpenAI4S: one code cell.
hits   = [f for f in files if pattern in host.read_file(f)]
top3   = sorted(hits, key=os.path.getsize, reverse=True)[:3]
frames = [pd.read_csv(f) for f in top3]      # a 100k-row DataFrame stays in the kernel...
host.save_artifact(plot(frames))             # ...only "<DataFrame 100000×20>" hits context

📣 News


😮 Highlights


📦 What ships today

A capability map of the current tree — what is implemented and reachable, plane by plane.

plane what's implemented
Control & orchestration class-based native Tools · append-only Action Ledger · plan/review with a durable state machine · context compaction that archives the raw slices it summarizes · concurrent sub-agent delegation (fanout 48, depth 4) a user can stop mid-flight · enforced Specialist allowlists a child cannot widen · MCP connectors · cross-session memory
Scientific execution persistent Python and R kernels · synchronous mid-cell host RPC · object-level data lineage · versioned artifacts · environment provenance recorded per kernel generation, never borrowed from the daemon · background execution · 604 Skills (43 curated + 561 pinned bioSkills) · a FIFO execution coordinator with ABA-safe watchdog recovery
Data & retrieval seven normalized public-database connectors (UniProt · RCSB PDB · Ensembl · ChEMBL · PubChem · arXiv · OpenAlex) whose records carry source and time · a nightly canary over three of them · Agent-Plan-keyed Doubao Search Custom as the primary web search · Tavily and keyless search as backups · managed DataPro professional-dataset search
Workbench live streaming · Action Timeline · read-only-by-default Notebook · branch fork/activate/revert · verified recovery with an explicit Partial/Failed state · @file references pinned to the version they name · 2D chemistry/genome/sequence/MSA/LaTeX renderers · Markdown and .ipynb export
Sharing & portability read-only session shares over an outbound relay you operate · quarantined portable Session packages · an optional Jupyter KernelSpec bridge onto the same kernels
Ops, safety & release /api/v1 and a startup credential · Seatbelt/bubblewrap sandbox adapters with visible degraded and fail-closed modes · durable approvals that deny by default when unattended · redacted diagnostics · revocable telemetry · environments as a transaction · an 11-workflow/34-case benchmark against the real Store, kernels, and dispatcher · a staged release pipeline that verifies artifacts before anything becomes public

🎬 Demo

Live API workflow — from UniProt / RCSB to a 3D structure & report
Live API workflow: from UniProt / RCSB to a 3D structure and report
Real-data analysis — human insulin INS (P01308): from UniProt / RCSB to a reproducible report
Real-data analysis: human insulin INS / UniProt P01308 from UniProt / RCSB to a reproducible report
Visual artifact editing — “raise the confidence cutoff to 75” in one line
Visual artifact editing: raise the confidence cutoff to 75 in one line
Annotation-driven chart editing — lasso a region & recolor the legend
Annotation-driven chart editing: lasso a region and recolor the legend
Plan-mode research — artemisinin & paclitaxel solubility prediction
Plan-mode research: artemisinin and paclitaxel solubility prediction
Protein engineering — from sequence to ranked mutants & structural rationale
Protein engineering: from sequence to ranked mutants and structural rationale

⚡ Quickstart

git clone https://github.com/PKU-YuanGroup/OpenAI4S && cd OpenAI4S
./setup.sh     # one-time: build the environment with uv
./start.sh     # launch the web UI at http://127.0.0.1:8760/

setup.sh creates the lightweight control .venv with uv. For the comprehensive Python + R scientific kernels, install a Conda-family manager (micromamba, mamba, or conda) and run ./setup.sh --with-kernel-envs instead. Existing kernel environments can be synchronized with ./setup.sh --update-kernel-envs; updates do not prune user-installed packages. start.sh launches the daemon + web UI. No API key is needed to boot — set your model in the UI (Customize → Models). One-shot without the UI: uv run openai4s run "Compute the mean of [4,8,15,16,23,42] and submit it." -v.

macOS

[!NOTE] v0.3.0 publishes no macOS disk image. The release workflow uploads a .dmg only when it is Developer-ID-signed and notarized. The credentials for that do not exist yet, so the image is left out rather than shipped unsigned. On a Mac, install from PyPI as below, or run from the source checkout above. The older v0.2.0 preview image is still downloadable from the v0.2.0 release page (not from the latest release). It runs 0.2.0 without any of the 0.3.0 changes, and it must not open a data directory that 0.3.0 has already upgraded (Upgrading from 0.2.x).

Install from PyPI into a virtual environment of its own. This works on Apple Silicon and Intel, with Python 3.10 or newer:

python3 -m venv ~/.venvs/openai4s && source ~/.venvs/openai4s/bin/activate
pip install "openai4s[science]"   # numpy · pandas · matplotlib · scikit-learn; use [science,chemistry] for RDKit
openai4s serve                    # starts the daemon and opens the workbench with its access token

Data lives in ~/.openai4s. If you close the tab, openai4s url prints the authenticated workbench URL again. The R kernel needs a Conda-family manager (micromamba, mamba or conda); run openai4s setup once to build it.

First run — point it at a model, then at search. No key ships, so once the workbench is open:

  1. Model API — open Settings ⚙ → Models, pick a protocol (Ark-compatible for Doubao/GLM/Kimi/DeepSeek/MiniMax, or OpenAI- / Anthropic-compatible), paste your API Key, click Add, then Set active. Cheapest path: the ark protocol on Volcengine Ark's ¥9.9/mo plan.
  2. Search API (optional, recommended) — open Settings ⚙ → Network, keep Allow network access on, and paste your Ark Agent Plan Key into the primary Doubao Search Custom card → Save credential. If the active Ark model already uses that key, OpenAI4S reuses it automatically. Tavily and keyless engines remain backup options; the dedicated Doubao health check never reports a fallback result as Doubao.

Full walkthrough (install → model → search → R kernel, plus the Gatekeeper steps for the v0.2.0 preview image): Startup guide.

Linux app (no toolchain required)

[!NOTE] The Linux package ships with v0.2.0 and every later release. The Windows/WSL2 package ships from v0.3.0 on; see its section below. On older releases (v0.1.0 carried the macOS image only, and v0.2.0 had no Windows package), use the source checkout above or pip install openai4s.

Download OpenAI4S-<version>-linux-x86_64.tar.gz from the latest release, unpack it anywhere, and run it. It embeds its own Python and the pre-baked science stack, as a relocatable directory:

tar -xzf OpenAI4S-*-linux-x86_64.tar.gz && cd OpenAI4S-*-linux-x86_64
./OpenAI4S          # starts the daemon and opens http://127.0.0.1:8760/
./install.sh        # optional: `openai4s` on your PATH + an application-menu entry

install.sh is per-user and needs no root — it only writes into $HOME, and ./uninstall.sh undoes it while leaving your data in ~/.openai4s alone. Install bubblewrap (apt install bubblewrap) so cells run sandboxed; without it the default OPENAI4S_KERNEL_SANDBOX=auto reports a visibly degraded, unisolated kernel. Only x86_64 is published — on arm64 Linux, install from PyPI (pip install openai4s).

Windows (via WSL2)

Download OpenAI4S-<version>-windows-x86_64.zip, unzip it, and double-click OpenAI4S.cmd. The first run checks WSL2 and a working bubblewrap 0.8.0+ sandbox, verifies and installs the bundled Linux payload, creates ~/.local/bin/openai4s, starts the daemon there, and opens an authenticated local URL in your Windows browser. No application download, no pip, no toolchain. Ubuntu 24.04 is the supported baseline; mainland PyPI/Conda mirrors and an optional WSL-reachable proxy can be configured by the launcher. See the bilingual Windows/WSL2 guide.

v0.3.0 is the first release that ships this package. Its acceptance evidence covers WSL2 on x86_64 with the tested Ubuntu 24.04 distribution. The last section of the WSL2 parity audit ("Fix verification — 2026-09-07") leaves the following unverified:

Native Windows is not supported, and the program refuses to start a kernel there rather than warning and proceeding — it spawns POSIX subprocesses, the R channel rides file descriptors 3 and 4 through a shell redirection, and the sandbox has no Windows backend. WSL2 reports as Linux, so this package runs the same build every other platform runs. If you do not have WSL2 yet, the launcher stops and tells you the exact command (wsl --install, from an Administrator PowerShell). Details: Supported platforms.

🐳 Docker and Kubernetes

docker compose up -d --build          # http://127.0.0.1:8760/
docker compose exec openai4s openai4s url   # the URL, token included

The image is built from this tree — Debian-slim CPython, the wheel, and the science extra — and runs as an unprivileged user with one volume at /data. Supply the model key as OPENAI4S_SECRET_LLM_LLM_API_KEY (a Secret in the cluster); the image reads credentials from the environment and writes nothing credential-shaped to the volume. For a cluster, kubectl apply -f deploy/kubernetes.yaml gives a single-replica Deployment, a ReadWriteOnce claim and a ClusterIP Service, with probes on /health.

Release images are published to GitHub Packages as ghcr.io/pku-yuangroup/openai4s:<version> and :latest (linux/amd64, from 0.2.0 on) by publish-image.yml, which pushes an image only after it passes the same container_smoke.sh that gates every pull request. If docker pull ghcr.io/pku-yuangroup/openai4s:latest asks you to log in, build the image from the checkout as above. Two things are worth knowing before you expose it. Binding 0.0.0.0 inside the container makes the access token mandatory and switches the DNS-rebind Host allowlist off, so the token becomes the only control in front of endpoints that execute code — which is why the compose file publishes to loopback and the Service is a ClusterIP. And an unprivileged container cannot give bubblewrap the namespaces it needs, so the kernel sandbox degrades visibly and the container becomes the boundary; that is a coarser one, and the container guide says exactly what it stops covering.

🧩 Take the Skills anywhere (npx)

The 604 bundled Skills are recipes — prose, code, and the operational knowledge to run them — and nothing about them is OpenAI4S-specific. The npm release @pku-yuangroup/openai4s-skills@0.2.0 contains 603 Skills: 42 curated + 561 pinned bioSkills. Install that fixed release with:

npx @pku-yuangroup/openai4s-skills@0.2.0 install --all                  # v0.2.0: 42 curated Skills
npx @pku-yuangroup/openai4s-skills@0.2.0 install --collection bioskills # v0.2.0: 561 pinned bioinformatics recipes
npx @pku-yuangroup/openai4s-skills@0.2.0 install alphafold2 boltz --target claude
npx @pku-yuangroup/openai4s-skills@0.2.0 list
npx @pku-yuangroup/openai4s-skills@0.2.0 uninstall --all

npx @pku-yuangroup/openai4s-skills <command> selects the latest npm release. To use the current repository catalog instead (604 Skills: 43 curated + 561 bioSkills), run directly from GitHub; this form follows the default branch:

npx github:PKU-YuanGroup/OpenAI4S install --all                  # the 43 curated Skills
npx github:PKU-YuanGroup/OpenAI4S install --collection bioskills # the 561 pinned bioinformatics recipes

Both sources use the same target and overwrite rules. --target claude writes to ~/.claude/skills, --target openai4s to <data_dir>/user-skills, and --dir <path> anywhere you name; the resolved absolute path is printed before anything is written there, and --dry-run stops at that plan. Every installed file's SHA-256 goes into a manifest beside the Skills, so a reinstall refuses to overwrite a Skill you have edited or one it did not install, and an uninstall removes only files it wrote. Every curated Skill page and the collection root under skills/ carry an Install section with their own name already filled in, so you can install from whichever page you landed on.

If you already run OpenAI4S from this checkout, you already have all 604 — a bundled Skill takes precedence over a same-named one in your data directory. The command exists for the other direction.


📚 Documentation

The canonical bilingual documentation is published at openai4s.org/docs. Its public source and issue tracker live in Nobody-Zhang/openai4s-docs; the links below point to the code-adjacent copies kept with this repository.

doc what's inside
Startup guide macOS walkthrough: install from PyPI (v0.3.0 ships no .dmg) or use the v0.2.0 preview image, model setup, and one-key Doubao Search authorization (with Tavily/keyless backups)
Upgrading from 0.2.x Back up the database before the 27 → 32 schema migration, why going back to 0.2.x is unsupported, and the access token that is now always required
Architecture the hybrid action router, Action Ledger, host RPC, and lazy kernels
Backend extension guide where new Tool classes, host services, repositories, and session behaviour belong
Model backend bring-up local/remote GPU selection, checkpoint staging, real-inference canary admission, and connector portability
Skills 43 curated Skills + 561 pinned bioSkills + how to write your own
Remote compute BYOC GPU jobs, host.fold, auto-provisioning
Science connectors the seven public databases, their filters, and retrieval provenance
Web app UI features, Action Timeline, read-only Notebook, artifacts, and implementation status
Web sharing read-only session shares, the trust model, and running your own relay
Jupyter adapter optional standalone Python/R KernelSpecs, install commands, and compatibility limits
Configuration model providers, env vars, conda envs, CLI
Docker / Kubernetes the image, compose.yaml, the cluster manifests, and what a wildcard bind actually changes
Supported platforms the per-OS support tiers and why native Windows refuses to start a kernel
Windows / WSL2 Ubuntu 24.04 installation, sandbox checks, lifecycle commands, mainland mirrors, and localhost proxy behavior
Security defense-in-depth safety layers & remote-access notes

🗺️ Roadmap

Delivered

Next


💡 Contributing

OpenAI4S is a community effort to keep the Code-as-Action paradigm open.

Before opening a PR, please read .github/CONTRIBUTING.md — it defines branch naming, the PR checklist (.github/pull_request_template.md), code ownership (.github/CODEOWNERS), review & release policy, and the offline-test policy.

Development setup

Requires Python ≥ 3.10 and uv.

git clone https://github.com/PKU-YuanGroup/OpenAI4S && cd OpenAI4S
./setup.sh                          # uv sync --locked --extra science + pre-commit hook
./setup.sh --with-kernel-envs       # optional: full Python + R kernel stacks
uv run pytest                       # offline test suite (LLM mocked)
uv run pre-commit run --all-files   # format + lint everything

Style is enforced by pre-commit — black, isort (--profile black), and ruff, pinned in .pre-commit-config.yaml. Runtime deps: the core is zero-dependency (pure stdlib); the optional science extra pins numpy>=1.24 · pandas>=2.0 · matplotlib>=3.7.

What we welcome

Keep the core dependency-free, guard optional science imports behind try/except ImportError, and make sure uv run pytest and uv run pre-commit run --all-files pass before opening a PR.



🔒 License

Released under the MIT License — see LICENSE.


✨ Star History

Star History Chart


🤝 Community contributors

Nobody-Zhang wangyu-sd HowardLi1984 Linmj-Judy YuyangSunshine Lyu6PosHao Devin-jun Grace-xyx WenyuLiang ClarenceYC cursoragent yusowa0716 riiiiiiin jiangzx25 stau-7001 EQSTLab difficulttopickaname

Auto-generated daily from the GitHub contributors graph and a maintained public-recognition list by scripts/update_contributors.py.


OpenAI4S · code is the action, the kernel is the environment. · 简体中文 · Friend Link https://linux.do