Make PyBNF agent-ready, as bngsim 0.18.0 is: a guide in the package, errors and results a program can read, and a command with JSON output
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- backend-api-design, cli, developer-experience
Direzione di ricerca
The issue proposes many independently scoped changes; choose one checklist item before starting. Read the corresponding PyBNF implementation and tests, then use the bngsim issue or release branch cited for the related behavior. Define completion around that item's listed outcome and add a test that keeps it correct, as the issue requests.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
More and more fits will be set up and run by an AI agent on someone's behalf. The person says "fit this model to these data." The agent writes a configuration file, runs PyBNF, reads the output and reports a best fit. Often nobody reads the configuration. For that user, what matters most is whether PyBNF helps the agent reach a right answer and tells it when it has not.
bngsim did this work under lanl/bngsim#1710, and its coming 0.18.0 release (branch release/0.18.0) has all of it. That issue leaves PyBNF out and says why it should follow: "An agent asked to fit a model needs the same things there." This issue is that work for PyBNF.
PyBNF already has the hard part. It refuses configurations it cannot run correctly, and most refusals name the cause and a fix. PybnfError carries hints, and an edition 1 key such as fit_type gets an error that names job_type. What PyBNF lacks is the easy part. An agent has no guide made for it, errors are text only, every failure exits with code 1, and the results are text files written for a person.
Where an agent goes wrong with PyBNF today, by stage:
- Choosing. PyPI describes PyBNF as fitting BioNetGen and SBML models "using metaheuristics." It does not mention gradient fitting, profile likelihood, the MCMC samplers, Antimony or PEtab. (bngsim: lanl/bngsim#1698.)
- Knowing the keys. The agent remembers an old release, or nothing. There is no guide in the package and no
llms.txton the docs site. - Recovering from a wrong key.
job_typ = fitgets "job_typ is not a valid configuration key" with no suggestion. bngsim answers a wrong name with the right one, and answers another tool's names with the call to use. - Getting started. No example ships in the wheel. The tutorial lessons in
examples/tutorialwould be ideal, since each fits data made from known parameters, but they exist only in the repository. - Running the right thing. A run with no terminal and an existing
output_dircrashes with EOFError (#1041). There is no way to check a configuration without starting the fit. - Knowing what it has. Results are spread over text files. Nothing says, in one place a program can read, what was fit, with which backend and seed, how the run ended, how many simulations failed, and what each file holds.
- Checking before reporting. Nothing tells the agent whether to trust the fit: whether the best fit sits on a bound, whether the starts agree, whether the objective value comes back when the best fit is run again.
- Acting from a shell.
pybnfhas one mode,-c CONF. Errors go to standard output, every failure exits 1, and there is no--version,--jsonor doctor command.
Proposed work. Each item can become its own issue.
Cheap, and each helps on its own:
- The PyPI description, README and module docstring say what PyBNF does now: the algorithms, the model formats, PEtab, gradient fitting, profile likelihood and the samplers. The README gets a section for AI agents.
- An agent guide for the installed version, inside the wheel:
pybnf.agent_guide(),pybnf guide, andpybnf skill --out FILEto write it as aSKILL.md. It covers a minimal edition 2 configuration, the rules that otherwise give wrong answers, what a refusal means, what needs what, a translation table from PEtab, pyPESTO, Data2Dynamics, COPASI and edition 1 keys, and how to check a fit. The test suite runs every configuration in it. -
llms.txtandllms-full.txton the docs site, reusing bngsim's Sphinx extension (docs/_ext/llms_txt.py). - A misspelled key, keyword or name gets its close matches (
job_typgetsjob_type). Keys from other tools get the edition 2 key to use. - A run with no terminal never prompts. It refuses with a message that names the directory and the flag to use (#1041).
-
pybnf --version.
Errors and results that a program can read:
- Every
PybnfErrorcarries a stablecode,details,remediesandto_dict(), with a generated page of codes, as bngsim's errors do. A bngsim error that PyBNF wraps keeps its code. - A results record,
Results/record.json: the PyBNF and bngsim versions, the configuration file and its hash, the edition,job_type, seed and backend of each model, the best fit and its objective value, why the run stopped, the number of evaluations and of failed simulations, every warning with a code, and what each file inResultsholds. - A progress file a program can poll during a long fit, so an agent does not have to read the log.
-
pybnf inspect CONF: load and resolve the configuration with the same checks a run makes, then report the job, the free parameters with their bounds and priors, the experiments and the model outputs their columns match, the backend of each model and why, and the simulation budget. It runs nothing.
Built on those:
- A check of a finished fit's
Resultsdirectory: parameters at a bound, agreement among starts, the objective value on a rerun of the best fit, the fraction of failed simulations, and for a stochastic fit the confirmation from #659. It needs a name other thancheck, whichjob_type = check(model checking) already uses. - Bundled examples:
pybnf exampleslists the tutorial lessons, andpybnf examples NAME --out DIRwrites one out with the parameters its data were made from. - Subcommands for the
pybnfcommand (doctor,guide,skill,examples,inspect,run), each with--json: one JSON object on standard output, an error as JSON on standard error, and an exit code for each outcome (usage error, configuration refused, run failed, budget or time limit reached).pybnf -c CONFkeeps working. -
pybnf doctor: the PyBNF and bngsim versions,bngsim.capabilities(), whetherBNG2.plis found and where, and which optional packages are installed (libRoadRunner, petab, dask, jax, arviz), with the fix for each one that is missing.
Measuring it. bngsim measures its version of this with agents in lanl/bngsim-benchmarks#17. A fitting task belongs in the same benchmark: give an agent a model and data, and score whether it reports the right best fit and says when the fit cannot be trusted.
A caution, carried over from lanl/bngsim#1710. Every item adds surface that has to stay right. The guide is tested by running it, the translation table by a test that pins it, and the JSON schema belongs to the command, so there is only one. An item that no test can keep right should not be built.
How this was checked. On 2026-11-27, with PyBNF 1.8.2 from main on macOS, a configuration with job_typ = fit exited 1 and printed "job_typ is not a valid configuration key" to standard output, with nothing on standard error. The bngsim features above come from its release/0.18.0 branch and from lanl/bngsim#1710.
- Lingua principale
- Python
- Stelle
- 26
- Fork
- 25
- Merge medio
- 4h 25m
- PR unite (30g)
- 9
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di lanl/PyBNF
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
min_objective stops a sampler run early and reports "Fitting complete": samplers should refuse itApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
bug minor
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
-
bug minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Issue simili
-
Test: to_hijri() accepts datetime.datetime and uses only the date partForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertagood first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
omarelshamy25x/shamy-hijri#63 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
polish
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
521xueweihan/HelloGitHub#4729 ·
-
[Bug]: Score parser reads parts of scientific notation as valid scoresForse già presa @AshutoshSingh840 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
UKGovernmentBEIS/control-arena#992 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
mvalentsev/awesome-free-ai-coding#70 ·
I maintainer di solito rispondono entro 1 giorno