An open-source agentic harness for high-energy physics: literature, data, statistics, and real reinterpretation of LHC searches.
Project description
fisicai
An open-source agentic harness for high-energy physics.
fisicai gives an AI agent the tools a particle physicist actually uses: the INSPIRE-HEP literature database, arXiv, HEPData, the Scikit-HEP analysis stack, and — most importantly — published statistical likelihoods from real LHC searches. It doesn't just talk about papers. It reinterprets them.
$ fisicai "download the pyhf likelihood for the ATLAS sbottom 1Lbb search and \
compute the CLs exclusion for the (600, 280, 150) GeV signal point"
A real session (full walkthrough): the agent fetches the ATLAS SUSY-2018-31 published likelihood and reproduces its CLs to all published digits — from the analysis's own statistical model, not a digitized curve.
Why
A single LHC analysis takes a team of physicists years: skims, background estimates, systematics, multivariate discriminants, statistical interpretation. Reinterpreting that analysis for a new theory model — the thing that makes a search scientifically durable — usually never happens, because nobody has the time.
But the field quietly built the infrastructure to change that. ATLAS (and increasingly CMS)
now publish their full statistical models as pyhf JSON
workspaces on HEPData. An agent that can read a paper, fetch its
likelihood, patch in a new signal, and run pyhf.infer can do in minutes what today takes a
phenomenologist weeks.
fisicai is the harness that makes that loop routine.
What it can do today
- Literature — search INSPIRE-HEP, fetch arXiv abstracts and full text.
- Data — locate HEPData records and their resources, including published pyhf workspaces.
- Statistics — apply signal patches to published likelihoods and compute observed and
expected CLs limits with
pyhf. - Analysis — the agent works in a sandbox with the Scikit-HEP stack (
uproot,awkward,hist,pyhf,matplotlib) available for cutflows, histograms, and plots.
Domain knowledge lives in versioned markdown skills (src/fisicai/skills/) — how to
reinterpret a search, how to run a cutflow. This is the community contribution surface: teach
the agent your workflow by writing a skill, not by patching code.
Quickstart
$ pip install fisicai # or: pip install -e . from a checkout
$ fisicai "find the latest CMS top squark search and summarize its exclusion reach"
$ fisicai chat # interactive session
fisicai is built on the Claude Agent SDK and uses
your existing Claude Code credentials (claude CLI login or ANTHROPIC_API_KEY). Select a
model with --model or FISICAI_MODEL.
Use it from the agent you already have (MCP)
The tools are also exposed as a standard MCP server — vendor-neutral, works with Claude Code, Cursor, opencode, LangChain adapters, or any other MCP client:
$ claude mcp add fisicai -- fisicai-mcp # Claude Code
or in any MCP client config:
{ "mcpServers": { "fisicai": { "command": "fisicai-mcp" } } }
Your agent then has inspire_search, inspire_bibtex, arxiv_fetch, hepdata_get,
hepdata_download_likelihood, pyhf_list_patches, pyhf_cls — plus the write-up
machinery: note_template, writeup_macros, and bundle_validate, so any MCP client
can produce and validate full analysis bundles, not just query data.
Analysis bundles: the code and the paper
Research output isn't a chat answer — it's an analysis. fisicai analyze makes the agent
deliver a complete, reproducible analysis bundle: the analysis code, every result as
data, and a compiled LaTeX note.
$ fisicai analyze "measure the Z boson mass in the Open Data dimuon skim"
produces:
analyses/<name>/
├── analysis.py # deterministic, runs end-to-end
├── results/
│ ├── results.json # every number the note quotes
│ └── results.tex # auto-generated \newcommand macros (python -m fisicai.writeup)
├── figures/*.pdf
└── note/
├── note.tex # quotes numbers ONLY via the macros — no hand-typed values
├── references.bib # every entry fetched from INSPIRE (inspire_bibtex tool)
└── note.pdf # compiled with tectonic
The invariant: the note cannot drift from the code. Prose numbers come from generated
macros; citations come from INSPIRE's own BibTeX; rerunning analysis.py regenerates the
whole artifact. See analyses/zmumu_z_mass for a complete example
produced by the agent.
Notes follow experiment-publication conventions: a shipped LaTeX template
(python -m fisicai.writeup --init-note note/) with the canonical section structure
(Introduction / Detector and data / Event selection / Method / Systematic uncertainties /
Results / Summary), hepnote.sty macros (\pt, \GeV, \stat/\syst, …), and
mplhep-styled figures.
HEPAnalysisBench (HEPAbench)
How do you trust an AI with physics? You score it against results that are already known.
HEPAbench is a benchmark of analysis tasks with published reference answers — from a
toy-workspace CLs fit to reproducing a real ATLAS exclusion from its published likelihood.
The scorer is harness-agnostic: any agent that writes an answer.json can be benchmarked.
$ hepabench list
$ hepabench run --offline # tasks that need no network
$ hepabench run # the full suite, driven by the fisicai agent
$ hepabench score toy_cls answer.json # score any agent's answer
$ hepabench validate analyses/zmumu_z_mass # validate an analysis bundle
hepabench validate turns "the agent wrote a paper" into "the agent wrote a
reproducible paper": it reruns analysis.py in a clean copy and requires an identical
results.json, checks that results.tex regenerates from it, that no result value is
hand-typed in the note, that every citation resolves, and that the note compiles from
scratch. The shipped Z-mass bundle passes all six checks.
Every check carries a continuous score in [0, 1] — numeric answers earn more the closer they land to the reference (1.0 exact, 0.5 at the tolerance edge, 0 beyond twice the tolerance) — and the suite reports one aggregate number. That makes HEPAbench a target function: harnesses, models, and prompts can be optimized against it, and improvements show up as score, not anecdotes.
Current v0 suite — the fisicai agent scores 4/4:
| Task | Reference | Agent result |
|---|---|---|
toy_cls — CLs fit on a toy workspace |
0.0525 (pyhf docs) | 0.05251 |
literature_stop_4body — INSPIRE retrieval |
arXiv:2301.08096 | exact |
atlas_multib_cls — CLs from the ATLAS SUSY-2018-31 published likelihood |
0.24444 | 0.24444 |
opendata_zmumu — Z mass from real CMS 2012 collision data |
91.1876 GeV (PDG) | 90.95 GeV |
The opendata_zmumu skim ships with the package (3.7 MB, regenerable from CERN Open Data
with scripts/make_zmumu_skim.py), so that task runs offline on a laptop.
The recorded agent answers behind this table are committed under hepabench_results/ and re-scored on every push in CI, which also runs the full bundle validation — the claims above are continuously verified, not prose.
Contributing a task = one YAML file with a prompt and a published reference value
(src/fisicai/hepabench/tasks/) — see CONTRIBUTING.md. Tasks that
agents fail are the most valuable ones.
Roadmap
- M1 — Literature agent: end-to-end INSPIRE/arXiv research tasks. (done)
- M2 — Reinterpretation: reproduce a published ATLAS exclusion point from its HEPData likelihood — an objective, physics-grade correctness check. (done — see examples/reinterpret_sbottom.md)
- M3 — Community: grow HEPAbench (CMS Open Data cutflow tasks, more published likelihoods), recast scans over patchsets, simplified-likelihood support, and whatever the reinterpretation community asks for first.
- Beyond: the simulation chain for reinterpreting new models (MadGraph → fast sim → efficiency maps → patched likelihoods), and new results on new data.
The north star
The long-term goal is not tooling — it is to advance physics itself. Agents that can hold the entire literature, run every published likelihood, and test a theory against all existing data at once change what a single physicist can ask. Deeper questions — unification, what lies beyond the Standard Model — stay on this README as the direction of travel. The wedge is making today's analyses fast, reproducible, and reinterpretable.
Contributing
Issues and PRs welcome — especially new skills, support for more published-likelihood formats, and reports of analyses the agent gets wrong. Physics correctness bugs are the highest-value contributions (there's an issue template for them). See CONTRIBUTING.md for dev setup and the HEPAbench task-authoring guide.
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fisicai-0.1.0.tar.gz.
File metadata
- Download URL: fisicai-0.1.0.tar.gz
- Upload date:
- Size: 3.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
475f714f5e78852bf59b0add64ded93d80c17cd2cbf67a71b87fcebd2958726d
|
|
| MD5 |
0f3a30837a439decce6e96388713f362
|
|
| BLAKE2b-256 |
753924f930878344397dbec233775be4e20a9ed4d5d4ac86569029fbc5510ec7
|
Provenance
The following attestation bundles were made for fisicai-0.1.0.tar.gz:
Publisher:
release.yml on diogodebastos/fisicai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fisicai-0.1.0.tar.gz -
Subject digest:
475f714f5e78852bf59b0add64ded93d80c17cd2cbf67a71b87fcebd2958726d - Sigstore transparency entry: 2203409427
- Sigstore integration time:
-
Permalink:
diogodebastos/fisicai@5980a1ef5ef6c211daa6fc3d33af1e00eaff7585 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/diogodebastos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5980a1ef5ef6c211daa6fc3d33af1e00eaff7585 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fisicai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fisicai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f19d6ffcf53017c2d7fd22a2698c53379d56390f38f0a79fa9c5482b7b41cd8
|
|
| MD5 |
f584fdb57e7f0f214f9b1f8fe6511597
|
|
| BLAKE2b-256 |
c59c002c7de6ef7434ff32df09468d8297daf4afebe3145de30af6fecd0297e9
|
Provenance
The following attestation bundles were made for fisicai-0.1.0-py3-none-any.whl:
Publisher:
release.yml on diogodebastos/fisicai
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fisicai-0.1.0-py3-none-any.whl -
Subject digest:
8f19d6ffcf53017c2d7fd22a2698c53379d56390f38f0a79fa9c5482b7b41cd8 - Sigstore transparency entry: 2203409439
- Sigstore integration time:
-
Permalink:
diogodebastos/fisicai@5980a1ef5ef6c211daa6fc3d33af1e00eaff7585 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/diogodebastos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5980a1ef5ef6c211daa6fc3d33af1e00eaff7585 -
Trigger Event:
push
-
Statement type: