| --- |
| title: CMBAgent |
| sdk: docker |
| app_port: 7860 |
| --- |
| |
|
|
| # cmbagent |
|
|
| [](LICENSE) [](https://arxiv.org/abs/2507.07257) |
| [](https://pypi.org/project/cmbagent/) |
|
|
| <a href="https://www.youtube.com/@cmbagent" target="_blank"> |
| <img src="https://img.shields.io/badge/YouTube-Subscribe-red?style=flat-square&logo=youtube" alt="Subscribe on YouTube" width="140"/> |
| </a> |
| |
| <a href="https://discord.gg/UG47Yb6gHG" target="_blank"> |
| <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white&style=flat-square" alt="Join us on Discord" width="140"/> |
| </a> |
| |
| Autonomous Research System, Powered by [AG2](https://github.com/ag2ai/ag2). Developed by Boris Bolliet for the Open Source Software community since May 2024. Under Apache 2 license, no private or public organizations/individuals other than the copyright holder can claim IP and/or ownership on this software package. |
|
|
| CMBAgent is a generalist multi-agent system for autonomous scientific research. Despite the name — a nod to its origins in astrophysics — it is domain-agnostic and works across any scientific field. |
|
|
| 🎉 **News**: Cmbagent won a **first place award** at the **NeurIPS 2025 [Fair Universe Competition](https://fair-universe.lbl.gov/)**. |
|
|
|
|
| Cmbagent is the autonomous research engine for [Denario](https://astropilot-ai.github.io/DenarioPaperPage/), our end-to-end research system. |
|
|
| We are currently deploying cmbagent on the cloud, it will be in production soon! |
|
|
| Check our [demo videos](https://www.youtube.com/@cmbagent) on YouTube! |
|
|
| Join our [Discord Server](https://discord.gg/UG47Yb6gHG) to ask all your questions! |
|
|
| This is open-source research-ready software. |
|
|
| - Check the [demo notebooks](https://github.com/CMBAgents/cmbagent/tree/main/docs/notebooks). |
|
|
| - Best performances are obtained with [top-scoring models](https://lmarena.ai/?leaderboard). |
|
|
| We emphasize that [cmbagent](https://github.com/CMBAgents/cmbagent) is under active development and apologize for any bugs. |
|
|
| **The backbone of [cmbagent](https://github.com/CMBAgents/cmbagent) is [AG2](https://github.com/ag2ai/ag2)**. **Please star the [AG2](https://github.com/ag2ai/ag2) repo ⭐ and cite [Wu et al (2023)](https://arxiv.org/abs/2308.08155)!** |
|
|
| ## Strategy |
|
|
| **Cmbagent** acts according to a **Planning and Control** strategy with **no human-in-the-loop**. |
|
|
| You give a task to solve, then: |
|
|
| **Planning** |
|
|
| - A plan is designed from a conversation between a planner and a plan reviewer. |
| - Once the number of feedbacks (reviews) is exhausted the plan is recorded in context and **cmbagent** switches to **control**. |
|
|
| **Control** |
|
|
| - The plan is executed **step-by-step**. |
| - Sub-tasks are handed over to a single agent in each step. |
|
|
| ## Installation |
|
|
| With Python 3.12 or above: |
|
|
| ```bash |
| python3 -m venv cmbagent_env |
| source cmbagent_env/bin/activate |
| pip install cmbagent |
| ``` |
|
|
| ### Optional Dependencies |
|
|
| ```bash |
| # Development tools (pytest, ipython, jupyter) |
| pip install cmbagent[dev] |
| |
| # Local execution (if not using the web UI) |
| pip install cmbagent[local] |
| |
| # Domain-specific packages (for specialized agents or local execution) |
| pip install cmbagent[materials] # pymatgen, ASE, phonopy, matminer |
| pip install cmbagent[biochem] # BioPython, RDKit, MDAnalysis, ProDy |
| pip install cmbagent[astro] # CAMB, AstroPy, HEALPix, Cobaya |
| pip install cmbagent[data] # scipy, scikit-learn, seaborn, plotly |
| |
| # Everything |
| pip install cmbagent[all] |
| |
| # Or combine multiple domains |
| pip install cmbagent[materials,biochem,data] |
| ``` |
|
|
| ## Installation for developers |
|
|
| ```bash |
| git clone https://github.com/CMBAgents/cmbagent.git |
| cd cmbagent |
| python3 -m venv cmbagent_env |
| source cmbagent_env/bin/activate |
| pip install -e . |
| ``` |
|
|
| You can then open the folder in your VSCode/Cursor/Emacs/... and work on the source code. |
|
|
| To install optional domain-specific packages (examples provided, add your own in `pyproject.toml`): |
|
|
| ```bash |
| # Single domain |
| pip install -e .[materials] |
| pip install -e .[biochem] |
| pip install -e .[astro] |
| pip install -e .[data] |
| |
| # Or combine multiple domains |
| pip install -e .[materials,biochem,data] |
| ``` |
|
|
| ## Run |
|
|
| We assume you are in the virtual environment where you installed cmbagent. |
|
|
| Here is a one-liner you can run in terminal: |
|
|
| ```bash |
| python -c "import cmbagent; task='''Draw two random numbers and give me their sum'''; results=cmbagent.one_shot(task, agent='engineer', engineer_model='gpt-4o-mini');" |
| ``` |
|
|
| If you want to run the notebooks, first create the ipykernel (assuming your virtual environment is called cmbagent_env): |
| |
| ```bash |
| pip install ipykernel jupyterlab |
| python -m ipykernel install --user --name cmbagent_env --display-name "Python (cmbagent_env)" |
| ``` |
| |
| Then launch jupyterlab: |
| |
| ```bash |
| jupyter-lab |
| ``` |
| |
| Select the cmbagent kernel, and run the notebook. |
| |
| ## API Keys |
| |
| Before you can use cmbagent, you need to set your OpenAI API key as an environment variable. Do this in a terminal, before launching Jupyter-lab. |
| |
| For Unix-based systems (Linux, macOS), do: |
| |
| ```bash |
| export OPENAI_API_KEY="sk-..." ## mandatory for the RAG agents |
| export ANTHROPIC_API_KEY="sk-..." ## optional |
| export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json" ## optional for Vertex AI |
| ``` |
| |
| (paste in your bashrc or zshrc file, if possible.) |
| |
| For Windows, use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) and the same command. |
| |
| By default, cmbagent uses models from oai/anthropic/google. If you want to pick different LLMs, just adapt `agent_llm_configs` as above, or the `default_agent_llm_configs` in [utils.py](https://github.com/CMBAgents/cmbagent/blob/main/cmbagent/utils.py). |
|
|
| ## References |
|
|
| ```bash |
| |
| @software{CMBAGENT_2025, |
| author = {Boris Bolliet}, |
| title = {CMBAGENT: Open-Source Multi-Agent System for Science}, |
| year = {2025}, |
| url = {https://github.com/CMBAgents/cmbagent}, |
| note = {Available at https://github.com/CMBAgents/cmbagent}, |
| version = {latest} |
| } |
| |
| @misc{xu2025opensourceplanning, |
| title={Open Source Planning & Control System with Language Agents for Autonomous Scientific Discovery}, |
| author={Licong Xu and Milind Sarkar and Anto I. Lonappan and Íñigo Zubeldia and Pablo Villanueva-Domingo and Santiago Casas and Christian Fidler and Chetana Amancharla and Ujjwal Tiwari and Adrian Bayer and Chadi Ait Ekiou and Miles Cranmer and Adrian Dimitrov and James Fergusson and Kahaan Gandhi and Sven Krippendorf and Andrew Laverick and Julien Lesgourgues and Antony Lewis and Thomas Meier and Blake Sherwin and Kristen Surrao and Francisco Villaescusa-Navarro and Chi Wang and Xueqing Xu and Boris Bolliet}, |
| year={2025}, |
| eprint={2507.07257}, |
| archivePrefix={arXiv}, |
| primaryClass={cs.AI}, |
| url={https://arxiv.org/abs/2507.07257}, |
| } |
| |
| |
| @misc{Laverick:2024fyh, |
| author = "Laverick, Andrew and Surrao, Kristen and Zubeldia, Inigo and Bolliet, Boris and Cranmer, Miles and Lewis, Antony and Sherwin, Blake and Lesgourgues, Julien", |
| title = "{Multi-Agent System for Cosmological Parameter Analysis}", |
| eprint = "2412.00431", |
| archivePrefix = "arXiv", |
| primaryClass = "astro-ph.IM", |
| month = "11", |
| year = "2024" |
| } |
| ``` |
|
|
| ## Acknowledgments |
|
|
| Our project is funded by the [Cambridge Centre for Data-Driven Discovery Accelerate Programme](https://science.ai.cam.ac.uk). We are grateful to [Mark Sze](https://github.com/marklysze) for help with [AG2](https://github.com/ag2ai/ag2). |
|
|