@QingQ77: 开源的"代码即动作"科研智能体,用持久化内核运行真正的 Python/R 代码而不是固定工具表,让研究者靠便宜模型(豆包 ¥9.9/月)复现 Claude Science 级别的科研自动化。 https://github.com/PKU-…
Summary
开源的科研智能体 OpenAI4S,通过持久化内核运行真正的 Python/R 代码,结合 JSON 工具编排,让研究者可以用极低成本(豆包 ¥9.9/月)复现 Claude Science 级别的科研自动化。
View Cached Full Text
Cached at: 07/13/26, 11:53 AM
Open-source “Code-as-Action” scientific research agent: runs real Python/R code with persistent kernels instead of fixed tool tables, enabling researchers to replicate Claude Science-level research automation using cheap models (Doubao ¥9.9/month). https://t.co/psflPDmCys https://t.co/wS57b1kB20
— # PKU-YuanGroup/OpenAI4S Source: https://github.com/PKU-YuanGroup/OpenAI4S
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.
English · Simplified Chinese
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
arkprovider in the UI and you get a Claude-Science-class agent for less than a cup of coffee. 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 plane | Python/R science plane | |
|---|---|---|
| Best for | workflow, permissions, metadata, services | computation, analysis, simulation |
| Action unit | One ordered native-tool batch | One complete code cell |
| Composition | auditable schemas and resource policy | for, if, libraries, mid-cell Host RPC |
| State | append-only Action Ledger | kernel memory + versioned artifacts |
| Completion | Engine-owned finalize_response | host.submit_output(...) |
| Extending | named Tool subclass | import a library or load a Skill |
python
# 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 "hits context
📣 News
2026-07-06🎉 Open-sourced — the pure-stdlib Code-as-Action engine, the scientific web app, 24 science Skills, and BYOC remote compute.
😮 Highlights
- 🧬 Hybrid action engine — class-based native JSON tools orchestrate while persistent Python/R kernels execute science. CLI and Web adapters start a language lazily, so tool/finalize-only runs do not spawn a kernel.
- 📒 Ledger-first runtime — action groups/events and terminal facts are append-only; execution attempts, generation lifecycle, usage, and completion records remain durable and reconstructable.
- 🐍 Pure-stdlib core — the engine and the web server are stdlib-only (
http.server+ hand-rolled WebSocket, no framework, no deps). The LLM client speaks OpenAI / Anthropic / Gemini overurllibalone. - 🔌 One-line multi-provider —
ark(doubao · glm · kimi · deepseek · minimax) plus officialchatgpt · claude · gemini, behind a singlehost.llm; switch from the UI. - 🖥️ Scientific workbench — live streaming, versioned artifacts, provenance, an Action Timeline surface, and a read-only-by-default Notebook. An explicit developer flag enables multiline Python/R input against the shared kernels.
- 🔐 Hardened local execution — strict child-environment allowlists, durable approvals, one-shot generation-bound
host.bashcapabilities, and OS sandbox adapters (Seatbelt on macOS, bubblewrap on Linux) with visible degraded/fail-closed modes. - 🔬 24 bundled Skills — 14 GPU/model science Skills (AlphaFold2 · ESMFold2 · Boltz · Chai-1 · OpenFold3 · ProteinMPNN · ESM-2 · Evo2 · Borzoi · scGPT · scVI · DiffDock …) + research-workflow Skills. Skills are recipes of code, not JSON schemas; user-authored Skills stay under the data directory and cannot shadow bundled trust.
- ☁️ BYOC remote compute — dispatch GPU jobs to your own machines via
ssh:or the bundled NVIDIA NIM provider; realhost.fold(single-sequence Protenix / AF3-class) under a strict no-fabrication policy.
🎬 Demo
Live API workflow — from UniProt / RCSB to a 3D structure & report Real-data analysis — human insulin INS (P01308): from UniProt / RCSB to a reproducible report Visual artifact editing — “raise the confidence cutoff to 75” in one line Annotation-driven chart editing — lasso a region & recolor the legend Plan-mode research — artemisinin & paclitaxel solubility prediction Protein engineering — from sequence to ranked mutants & 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 .venv with uv; start.sh launches the daemon + web UI from it. 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.
📚 Documentation
| doc | what’s inside |
|---|---|
| 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 |
| Skills | the 24 bundled Skills + how to write your own |
| Remote compute | BYOC GPU jobs, host.fold, auto-provisioning |
| Web app | UI features, Action Timeline, read-only Notebook, artifacts, and implementation status |
| Jupyter adapter | optional standalone Python/R KernelSpecs, install commands, and compatibility limits |
| Configuration | model providers, env vars, conda envs, CLI |
| Security | defense-in-depth safety layers & remote-access notes |
🗺️ Roadmap
- Ship the next-generation workbench foundation: branch activation and append-only Revert/Undo projections, verified recovery with explicit Partial/Failed state, dependency-level stale propagation, durable delegation, quarantined portable Session packages, checkpointed plan/review/memory state, and dedicated 2D chemistry/genome/sequence/MSA/LaTeX renderers. Arbitrary in-memory namespace objects are deliberately not serialized; recovery remains Partial unless a safe recipe can rebuild and verify them.
- Add stronger Linux isolation beyond bubblewrap where available (for example seccomp) and expand packaged sandbox smoke coverage.
-
Keyless
web_searchbeyond DuckDuckGo (rate-limit resilience). - More BYOC providers (Modal / SLURM) beyond SSH + NVIDIA NIM.
- A public benchmark of end-to-end scientific workflows.
- Local GPU model serving so structure/design Skills run without remote compute.
💡 Contributing
OpenAI4S is a community effort to keep the Code-as-Action paradigm open. Before opening a PR, please read 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 (https://docs.astral.sh/uv/).
git clone https://github.com/PKU-YuanGroup/OpenAI4S && cd OpenAI4S
./setup.sh # uv sync --extra science + pre-commit hook
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
- New Skills — a
SKILL.md(+ optionalkernel.py) underskills/— recipes of code, not schemas. - New providers — a wire adapter under
openai4s/llm/, or a BYOC compute provider. - Engine & UI — the core is pure stdlib and readable; the web app is framework-free. Keep the core dependency-free, guard optional science imports behind
try/except ImportError, and make sureuv run pytestanduv run pre-commit run --all-filespass before opening a PR.
👍 Acknowledgement & related work
- Claude Science (Anthropic) — the closed reference architecture whose Code-as-Action design, persistent kernel, host-RPC protocol, and safety layers OpenAI4S independently reproduces in open source.
- CodeAct — “Executable Code Actions Elicit Better LLM Agents” — code as a unified action interface.
- ReAct — “Synergizing Reasoning and Acting in Language Models” — the
tool_usebaseline this project departs from. - The science Skills stand on ColabFold / AlphaFold, ESM, OpenFold, Boltz, Chai, ProteinMPNN, DiffDock, Evo2, Borzoi, scGPT, scVI-tools and open data services (NCBI, UniProt, RCSB PDB, EBI, OpenAlex, Crossref).
🔒 License
Released under the MIT License — see LICENSE.
✨ Star history
✏️ Citing
@software{openai4s2026,
title = {OpenAI4S: An Open-Source Code-as-Action Scientific Research Agent},
author = {OpenAI4S contributors},
year = {2026},
url = {https://github.com/PKU-YuanGroup/OpenAI4S},
note = {Open AI for Scientist — a pure-stdlib reproduction of the Code-as-Action paradigm}
}
🤝 Community contributors
Auto-generated from the GitHub contributors graph by scripts/update_contributors.py (Contributors workflow).
OpenAI4S · code is the action, the kernel is the environment. · Simplified Chinese
Similar Articles
@php_martin: OpenAI Codex is now free. But what really shocked me isn't the free part — it's that local open-source models can deliver AI Agent performance close to the cloud experience. The video demonstrates 4 real-world scenarios: fixing a crashed space game, building a Whac-A-Mole web game in minutes, generating an Apple-style product homepage, and even launching a browser to search, download, and save files on its own.
OpenAI Codex is now free, but even more surprising is that local open-source models can achieve AI Agent performance close to the cloud, demonstrating scenarios like fixing games and developing web games without requiring API keys or internet.
@NFTCPS: An open-source project even Musk retweeted, and you haven't tried it yet? PraisonAI: Just 5 lines of code to set up an AI agent team that can autonomously run tasks 24/7 without you watching. Key highlights: ① Supports 100+ LLMs, plug and play ② Agents automatically hand off and correct each other ③ Visual drag-and-drop workflow orchestration, no coding needed…
PraisonAI is an open-source project that only needs 5 lines of code to deploy an AI agent team. It supports over 100 large language models, visual workflow orchestration, and can integrate with platforms like Slack/Discord for 24/7 autonomous task execution. The project was retweeted by Elon Musk.
@IndieDevHailey: Open-Source Claude Science Alternative Explodes! One Command, Switch Between DeepSeek/GLM Freely—Researchers Thrilled! OpenScience is an open-source AI research workbench from a YC-incubated team, a direct free alternative to Claude Science with zero restrictions. Give it a research goal, and it...
This article introduces the open-source AI research workbench OpenScience (YC-incubated), which serves as a free alternative to Claude Science, supports multiple model switching, comes with over 290 research skill packages and 30+ scientific databases, and can automate the entire research workflow. It also mentions Anthropic's official open-source Claude Cookbooks tutorial collection.
@VincentLogic: This open-source project cuts Claude Code's costs by 25%. It doesn't build new models or a new IDE. It just draws a "code map" for the AI coding agent. Traditional approach: the model reads the entire repo → token explosion. Its approach: first parse the code with Tree-si…
An open-source project uses Tree-sitter to parse code into a graph structure and store it in local SQLite, providing a code map for AI coding agents, thereby reducing token consumption and costs. On average, it saves 57% tokens and reduces costs by 25%. Supports tools like Claude Code, Cursor, aider, etc.
@GitHub_Daily: Running multiple tasks with Claude Code and Codex, switching back and forth in the terminal to check results is really inefficient. Recently I found Orca, which centrally manages multiple AI coding agents, letting them work in parallel and aggregating results in one interface. The core feature is support for parallel workspaces, sending one requirement to multiple agents simultaneously…
Orca is a unified AI coding agent management tool with support for parallel workspaces. It can send tasks simultaneously to multiple AI assistants like Claude Code and Codex, each generating code in independent git branches, allowing comparison of results, and comes with a mobile app for real-time tracking.