geppetto-models 1.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- geppetto_models-1.8.0/LICENSE +202 -0
- geppetto_models-1.8.0/MANIFEST.in +5 -0
- geppetto_models-1.8.0/NOTICE +6 -0
- geppetto_models-1.8.0/PKG-INFO +79 -0
- geppetto_models-1.8.0/README.md +55 -0
- geppetto_models-1.8.0/geppetto_models/__init__.py +29 -0
- geppetto_models-1.8.0/geppetto_models/agent_profile.py +225 -0
- geppetto_models-1.8.0/geppetto_models/agent_registry.py +237 -0
- geppetto_models-1.8.0/geppetto_models/clap.py +150 -0
- geppetto_models-1.8.0/geppetto_models/drs.py +74 -0
- geppetto_models-1.8.0/geppetto_models/events.py +179 -0
- geppetto_models-1.8.0/geppetto_models/experiment.py +72 -0
- geppetto_models-1.8.0/geppetto_models/lab.py +426 -0
- geppetto_models-1.8.0/geppetto_models/pinocchio.py +68 -0
- geppetto_models-1.8.0/geppetto_models/pinocchio_outputs.py +232 -0
- geppetto_models-1.8.0/geppetto_models/py.typed +0 -0
- geppetto_models-1.8.0/geppetto_models/testing/__init__.py +1 -0
- geppetto_models-1.8.0/geppetto_models/testing/spectramax.py +103 -0
- geppetto_models-1.8.0/geppetto_models.egg-info/PKG-INFO +79 -0
- geppetto_models-1.8.0/geppetto_models.egg-info/SOURCES.txt +23 -0
- geppetto_models-1.8.0/geppetto_models.egg-info/dependency_links.txt +1 -0
- geppetto_models-1.8.0/geppetto_models.egg-info/requires.txt +5 -0
- geppetto_models-1.8.0/geppetto_models.egg-info/top_level.txt +1 -0
- geppetto_models-1.8.0/pyproject.toml +38 -0
- geppetto_models-1.8.0/setup.cfg +4 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
geppetto-models
|
|
2
|
+
Copyright 2026 Rutgers, The State University of New Jersey
|
|
3
|
+
Copyright 2026 Geppetto Ecosystem contributors
|
|
4
|
+
|
|
5
|
+
This material is based upon work supported by the U.S. National Science
|
|
6
|
+
Foundation under the PCL Test Bed Cooperative Agreement No. 2607521.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: geppetto-models
|
|
3
|
+
Version: 1.8.0
|
|
4
|
+
Summary: Shared data contracts for the Geppetto autonomous-lab ecosystem, including the PCL Agent Interoperability Profile
|
|
5
|
+
Author: Geppetto Ecosystem contributors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Keywords: cloud lab,self-driving lab,a2a,agent interoperability,pydantic
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
License-File: NOTICE
|
|
19
|
+
Requires-Dist: pydantic>=2.0
|
|
20
|
+
Requires-Dist: jsonschema>=4.21
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# geppetto-models
|
|
26
|
+
|
|
27
|
+
Shared data contracts for the Geppetto autonomous-lab ecosystem: the
|
|
28
|
+
Design-Build-Test-Learn platform behind COAST, a node of the NSF Programmable
|
|
29
|
+
Cloud Laboratories (PCL) Test Bed. The package contains Pydantic models only.
|
|
30
|
+
Its only dependencies are `pydantic` and `jsonschema`.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install geppetto-models
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## PCL Agent Interoperability Profile
|
|
37
|
+
|
|
38
|
+
`geppetto_models.agent_profile` defines the messages an orchestrator exchanges
|
|
39
|
+
with a **specialist agent** that another lab runs. It is profile version
|
|
40
|
+
`pcl-agent-profile/v0.1` (`PROFILE_VERSION`), carried over A2A (Agent2Agent).
|
|
41
|
+
|
|
42
|
+
| Role | Receives | Returns |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| Advisor: asked about an experiment's adaptive parameters before the next design | `ConsultRequest` | `Advisory` |
|
|
45
|
+
| Analyst: handed one iteration's raw instrument files for one technique (NMR, DSC, ...) | `AnalysisTask` (data passed by `DataRef`: a presigned URL plus a SHA-256) | `Analysis` |
|
|
46
|
+
|
|
47
|
+
The orchestrator records each reply with the fields it is the authority on.
|
|
48
|
+
These are the agent id from its registry, timestamps, input hashes and cost.
|
|
49
|
+
The recorded forms are `DomainAdvisory`, `DelegatedAnalysis` and `Provenance`.
|
|
50
|
+
|
|
51
|
+
`json_schemas()` returns the JSON Schema of each wire message, for agents
|
|
52
|
+
written in languages other than Python.
|
|
53
|
+
|
|
54
|
+
`geppetto_models.agent_registry` defines the agent registry record:
|
|
55
|
+
- `AgentDefinition` is what a lab submits, and `AgentRecord` is the stored entry with its approval state.
|
|
56
|
+
- `card_pin_sha256` is the hash an approval pins the agent's Agent Card to.
|
|
57
|
+
- `project_specialist_ids` reads a project's list of opted-in agents.
|
|
58
|
+
|
|
59
|
+
## Other modules
|
|
60
|
+
|
|
61
|
+
| Module | Contents |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `clap` | `CLAPStep`, `CLAPRunRequest`, `CLAPExperimentConfig`: multi-step protocols sent to a cloud-lab node |
|
|
64
|
+
| `lab` | The cloud-lab node registry record and its Capability Sets (`python -m geppetto_models.lab validate lab.json`) |
|
|
65
|
+
| `pinocchio` | Orchestrator configuration: hypotheses, adaptive parameters, success criteria |
|
|
66
|
+
| `events` | EventBridge event payloads |
|
|
67
|
+
| `experiment` | Campaign state and per-iteration results |
|
|
68
|
+
| `pinocchio_outputs` | `AnalysisResult` / `LearnResult`: the typed per-iteration analysis and learning documents |
|
|
69
|
+
| `drs` | Diagnostic Reasoning Subsystem results |
|
|
70
|
+
| `testing.spectramax` | Builders for SpectraMax plate-reader exports, for tests |
|
|
71
|
+
|
|
72
|
+
## Licence
|
|
73
|
+
|
|
74
|
+
Apache-2.0. See `LICENSE` and `NOTICE`.
|
|
75
|
+
|
|
76
|
+
## Acknowledgement
|
|
77
|
+
|
|
78
|
+
This material is based upon work supported by the U.S. National Science
|
|
79
|
+
Foundation under the PCL Test Bed Cooperative Agreement No. 2607521.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# geppetto-models
|
|
2
|
+
|
|
3
|
+
Shared data contracts for the Geppetto autonomous-lab ecosystem: the
|
|
4
|
+
Design-Build-Test-Learn platform behind COAST, a node of the NSF Programmable
|
|
5
|
+
Cloud Laboratories (PCL) Test Bed. The package contains Pydantic models only.
|
|
6
|
+
Its only dependencies are `pydantic` and `jsonschema`.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install geppetto-models
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## PCL Agent Interoperability Profile
|
|
13
|
+
|
|
14
|
+
`geppetto_models.agent_profile` defines the messages an orchestrator exchanges
|
|
15
|
+
with a **specialist agent** that another lab runs. It is profile version
|
|
16
|
+
`pcl-agent-profile/v0.1` (`PROFILE_VERSION`), carried over A2A (Agent2Agent).
|
|
17
|
+
|
|
18
|
+
| Role | Receives | Returns |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| Advisor: asked about an experiment's adaptive parameters before the next design | `ConsultRequest` | `Advisory` |
|
|
21
|
+
| Analyst: handed one iteration's raw instrument files for one technique (NMR, DSC, ...) | `AnalysisTask` (data passed by `DataRef`: a presigned URL plus a SHA-256) | `Analysis` |
|
|
22
|
+
|
|
23
|
+
The orchestrator records each reply with the fields it is the authority on.
|
|
24
|
+
These are the agent id from its registry, timestamps, input hashes and cost.
|
|
25
|
+
The recorded forms are `DomainAdvisory`, `DelegatedAnalysis` and `Provenance`.
|
|
26
|
+
|
|
27
|
+
`json_schemas()` returns the JSON Schema of each wire message, for agents
|
|
28
|
+
written in languages other than Python.
|
|
29
|
+
|
|
30
|
+
`geppetto_models.agent_registry` defines the agent registry record:
|
|
31
|
+
- `AgentDefinition` is what a lab submits, and `AgentRecord` is the stored entry with its approval state.
|
|
32
|
+
- `card_pin_sha256` is the hash an approval pins the agent's Agent Card to.
|
|
33
|
+
- `project_specialist_ids` reads a project's list of opted-in agents.
|
|
34
|
+
|
|
35
|
+
## Other modules
|
|
36
|
+
|
|
37
|
+
| Module | Contents |
|
|
38
|
+
|---|---|
|
|
39
|
+
| `clap` | `CLAPStep`, `CLAPRunRequest`, `CLAPExperimentConfig`: multi-step protocols sent to a cloud-lab node |
|
|
40
|
+
| `lab` | The cloud-lab node registry record and its Capability Sets (`python -m geppetto_models.lab validate lab.json`) |
|
|
41
|
+
| `pinocchio` | Orchestrator configuration: hypotheses, adaptive parameters, success criteria |
|
|
42
|
+
| `events` | EventBridge event payloads |
|
|
43
|
+
| `experiment` | Campaign state and per-iteration results |
|
|
44
|
+
| `pinocchio_outputs` | `AnalysisResult` / `LearnResult`: the typed per-iteration analysis and learning documents |
|
|
45
|
+
| `drs` | Diagnostic Reasoning Subsystem results |
|
|
46
|
+
| `testing.spectramax` | Builders for SpectraMax plate-reader exports, for tests |
|
|
47
|
+
|
|
48
|
+
## Licence
|
|
49
|
+
|
|
50
|
+
Apache-2.0. See `LICENSE` and `NOTICE`.
|
|
51
|
+
|
|
52
|
+
## Acknowledgement
|
|
53
|
+
|
|
54
|
+
This material is based upon work supported by the U.S. National Science
|
|
55
|
+
Foundation under the PCL Test Bed Cooperative Agreement No. 2607521.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from geppetto_models.clap import CLAPStep, CLAPRunRequest, CLAPNodeSelection, CLAPExperimentConfig
|
|
2
|
+
from geppetto_models.pinocchio import (
|
|
3
|
+
SuccessCriteria, Hypothesis, PinocchioMode, AdaptationMethod,
|
|
4
|
+
AdaptiveParameter, PinocchioConfig,
|
|
5
|
+
)
|
|
6
|
+
from geppetto_models.events import (
|
|
7
|
+
ProjectContext, ExperimentSubmittedDetail, CLAPRunStatusDetail,
|
|
8
|
+
PinocchioCycleCompletedDetail, FeedbackSubmittedDetail,
|
|
9
|
+
)
|
|
10
|
+
from geppetto_models.experiment import ExperimentStatus, IterationResult, ExperimentState
|
|
11
|
+
from geppetto_models.drs import (
|
|
12
|
+
ConstraintViolation, ProtocolAnalysisResult, DRSHypothesis,
|
|
13
|
+
DRSCritique, DRSTournamentResult, DRSRemedy, DRSResult,
|
|
14
|
+
)
|
|
15
|
+
from geppetto_models.pinocchio_outputs import (
|
|
16
|
+
AnalysisResult, LearnResult, ModelPerformance, QualityAssessment,
|
|
17
|
+
SuccessCriterionCheck, format_validation_error,
|
|
18
|
+
)
|
|
19
|
+
from geppetto_models.agent_profile import (
|
|
20
|
+
PROFILE_VERSION, Bounds, ConsultRequest, Advisory, DomainAdvisory,
|
|
21
|
+
DataRef, AnalysisTask, AgentProvenance, Provenance, Analysis,
|
|
22
|
+
DelegatedAnalysis, json_schemas,
|
|
23
|
+
)
|
|
24
|
+
from geppetto_models.agent_registry import (
|
|
25
|
+
AgentStatus, AgentDefinition, AgentCheck, AgentRecord, is_admitted,
|
|
26
|
+
project_specialist_ids, card_pin_sha256, PROJECT_SPECIALISTS_KEY,
|
|
27
|
+
)
|
|
28
|
+
# geppetto_models.lab (the clap-registry record) is imported from its module,
|
|
29
|
+
# not re-exported here, so `python -m geppetto_models.lab` runs cleanly.
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"""The PCL Agent Interoperability Profile: what crosses the wire between an
|
|
2
|
+
orchestrator (Pinocchio) and a specialist agent another lab runs.
|
|
3
|
+
|
|
4
|
+
There are two specialist roles (``specs/AGENT_INTEROP_PLAN.md`` and
|
|
5
|
+
``specs/AGENT_REGISTRY_HANDOFF.md`` in ``geppetto-ecosystem``):
|
|
6
|
+
|
|
7
|
+
- An **advisor** is asked a question about the experiment's adaptive
|
|
8
|
+
parameters before the next design: it receives a :class:`ConsultRequest` and
|
|
9
|
+
replies with an :class:`Advisory`.
|
|
10
|
+
- An **analyst** is handed one iteration's raw instrument files for one
|
|
11
|
+
measurement technique (NMR, DSC, SAXS, ...) instead of the orchestrator
|
|
12
|
+
parsing them: it receives an :class:`AnalysisTask` and replies with an
|
|
13
|
+
:class:`Analysis`.
|
|
14
|
+
|
|
15
|
+
Each reply has a caller-side counterpart that adds what the orchestrator, not
|
|
16
|
+
the agent, is the authority on: :class:`DomainAdvisory` and
|
|
17
|
+
:class:`DelegatedAnalysis` add the ``agent_id`` (from the registry, never the
|
|
18
|
+
agent's self-report), and :class:`Provenance` completes the agent's
|
|
19
|
+
:class:`AgentProvenance` with timestamps, input hashes, the task id and cost.
|
|
20
|
+
|
|
21
|
+
Rules:
|
|
22
|
+
|
|
23
|
+
- **Data is referenced, never copied.** :class:`DataRef` carries a URI (a
|
|
24
|
+
presigned, expiring, read-only S3 URL in production; ``file://`` offline)
|
|
25
|
+
plus a checksum, so an agent at another institution fetches the bytes itself
|
|
26
|
+
without anyone sharing bucket credentials.
|
|
27
|
+
- **Every delegated result carries provenance**, which is what makes it
|
|
28
|
+
reproducible and auditable after the fact.
|
|
29
|
+
- **Replies are validated before any model sees them.** A reply that fails
|
|
30
|
+
validation is a dropped specialist, never a failed cycle.
|
|
31
|
+
- **Unknown keys are ignored** (pydantic's default), so an agent built against a
|
|
32
|
+
later minor profile can still be read.
|
|
33
|
+
|
|
34
|
+
The profile is versioned separately from this package (:data:`PROFILE_VERSION`)
|
|
35
|
+
because it is drafted jointly with other PCL nodes and changes on its own
|
|
36
|
+
schedule. Labs not writing Python implement against :func:`json_schemas`.
|
|
37
|
+
Helpers that do I/O (fetching a :class:`DataRef`, serving an agent) live in
|
|
38
|
+
``specialist_kit``, not here.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
from __future__ import annotations
|
|
42
|
+
|
|
43
|
+
from typing import Any, Literal
|
|
44
|
+
|
|
45
|
+
from pydantic import BaseModel, Field
|
|
46
|
+
|
|
47
|
+
# Shared with pinocchio_outputs (which imports it from here, so this module
|
|
48
|
+
# does not depend on that one).
|
|
49
|
+
Confidence = Literal["low", "medium", "high"]
|
|
50
|
+
CONFIDENCE_LEVELS: tuple[str, ...] = ("low", "medium", "high")
|
|
51
|
+
|
|
52
|
+
# Matches the month-3 milestone in AGENT_INTEROP_PLAN.md ("Profile v0.1
|
|
53
|
+
# drafted jointly"). Reported on every task and every provenance record.
|
|
54
|
+
PROFILE_VERSION = "pcl-agent-profile/v0.1"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# ---------------------------------------------------------------------------
|
|
58
|
+
# Advisor role
|
|
59
|
+
# ---------------------------------------------------------------------------
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class Bounds(BaseModel):
|
|
63
|
+
"""One adaptive parameter's current value and the range it may move in."""
|
|
64
|
+
|
|
65
|
+
current: float | None = None
|
|
66
|
+
min: float | None = None
|
|
67
|
+
max: float | None = None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class ConsultRequest(BaseModel):
|
|
71
|
+
"""What an advisor is asked: a question plus the parameter context.
|
|
72
|
+
|
|
73
|
+
``parameters`` carries every adaptive parameter in the experiment, not only
|
|
74
|
+
the ones the question names, so an advisor can reason about the whole
|
|
75
|
+
picture. ``recommended_parameters`` is what the Learn phase proposed, which
|
|
76
|
+
is what the advisor is being asked to sanity-check.
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
question: str = ""
|
|
80
|
+
parameters: dict[str, Bounds] = Field(default_factory=dict)
|
|
81
|
+
recommended_parameters: dict[str, float] = Field(default_factory=dict)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class Advisory(BaseModel):
|
|
85
|
+
"""What an advisor returns.
|
|
86
|
+
|
|
87
|
+
``constraints`` are hard bounds the design must respect
|
|
88
|
+
(``{"temperature_C": {"max": 65}}``); ``recommendations`` are softer
|
|
89
|
+
suggested values. ``rationale`` is required because an advisory with no
|
|
90
|
+
reasoning is not actionable: it is what a scientist reads to decide whether
|
|
91
|
+
to believe the constraint. ``confidence`` is the agent's own, separate from
|
|
92
|
+
the registry's ``trust`` rating of the agent.
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
constraints: dict[str, dict[str, float]] = Field(default_factory=dict)
|
|
96
|
+
recommendations: dict[str, float] = Field(default_factory=dict)
|
|
97
|
+
rationale: str
|
|
98
|
+
confidence: Confidence = "medium"
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class DomainAdvisory(Advisory):
|
|
102
|
+
"""An :class:`Advisory` as the orchestrator records it
|
|
103
|
+
(``advisory_iter{N}.json``): ``agent_id`` is stamped from the registry."""
|
|
104
|
+
|
|
105
|
+
agent_id: str
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
# ---------------------------------------------------------------------------
|
|
109
|
+
# Analyst role
|
|
110
|
+
# ---------------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class DataRef(BaseModel):
|
|
114
|
+
"""One raw data file, passed by reference.
|
|
115
|
+
|
|
116
|
+
``sha256`` lets the agent verify it fetched the bytes the orchestrator
|
|
117
|
+
meant, and is the same value that goes into :attr:`Provenance.input_hashes`,
|
|
118
|
+
which ties a result to its exact input after the fact.
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
name: str = Field(description="The file's path relative to the iteration's working directory.")
|
|
122
|
+
uri: str = Field(description="Where the agent fetches it (presigned https, or file://).")
|
|
123
|
+
media_type: str = Field(default="application/octet-stream")
|
|
124
|
+
sha256: str = Field(default="", description="Checksum of the referenced bytes.")
|
|
125
|
+
size_bytes: int = Field(default=0, ge=0)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class AnalysisTask(BaseModel):
|
|
129
|
+
"""What an analyst is asked to do.
|
|
130
|
+
|
|
131
|
+
``technique`` is the measurement technique the registry matched on, and is
|
|
132
|
+
the deterministic basis for selection: no model chooses it.
|
|
133
|
+
``protocol_context`` carries the parameters an analysis needs but cannot
|
|
134
|
+
infer from the raw file (NMR integration regions, an internal standard's
|
|
135
|
+
concentration). ``requested_outputs`` names what the caller wants back.
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
profile_version: str = Field(default=PROFILE_VERSION)
|
|
139
|
+
task_id: str = Field(description="Unique per delegated call; echoed in the provenance record.")
|
|
140
|
+
technique: str = Field(description="The measurement technique, e.g. nmr, dsc, saxs.")
|
|
141
|
+
iteration: int = Field(ge=0)
|
|
142
|
+
data: list[DataRef] = Field(default_factory=list)
|
|
143
|
+
protocol_context: dict[str, Any] = Field(
|
|
144
|
+
default_factory=dict,
|
|
145
|
+
description="Analysis parameters from the protocol (e.g. NMR integration_regions).",
|
|
146
|
+
)
|
|
147
|
+
requested_outputs: list[str] = Field(default_factory=list)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class AgentProvenance(BaseModel):
|
|
151
|
+
"""The part of the provenance record only the agent knows. An agent may
|
|
152
|
+
set any of these or omit the record entirely."""
|
|
153
|
+
|
|
154
|
+
agent_version: str = Field(default="")
|
|
155
|
+
model_version: str = Field(default="", description="The model the agent used, if any.")
|
|
156
|
+
parameters: dict[str, Any] = Field(default_factory=dict, description="Parameters the analysis ran with.")
|
|
157
|
+
confidence: Confidence = "medium"
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class Provenance(AgentProvenance):
|
|
161
|
+
"""The full provenance record on a delegated result.
|
|
162
|
+
|
|
163
|
+
The orchestrator fills every field it is the authority on: ``agent_id``
|
|
164
|
+
from the registry, the timestamps, the task id, the input hashes, and
|
|
165
|
+
``cost_usd`` from the registry's declared ``max_cost_usd`` (never from what
|
|
166
|
+
the agent says about itself).
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
agent_id: str = Field(
|
|
170
|
+
default="",
|
|
171
|
+
description="Stamped from the registry, not taken from the agent's self-report.",
|
|
172
|
+
)
|
|
173
|
+
profile_version: str = Field(default=PROFILE_VERSION)
|
|
174
|
+
task_id: str = Field(default="")
|
|
175
|
+
input_hashes: dict[str, str] = Field(
|
|
176
|
+
default_factory=dict, description="Mapping of each input file name to its sha256."
|
|
177
|
+
)
|
|
178
|
+
requested_at: str = Field(default="", description="ISO-8601, set by the orchestrator.")
|
|
179
|
+
completed_at: str = Field(default="", description="ISO-8601, set by the orchestrator.")
|
|
180
|
+
cost_usd: float = Field(default=0.0, ge=0.0)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class Analysis(BaseModel):
|
|
184
|
+
"""What an analyst returns.
|
|
185
|
+
|
|
186
|
+
``results`` is an open dict because the agent knows its technique's outputs
|
|
187
|
+
better than the orchestrator does (an NMR agent returns conversion and
|
|
188
|
+
composition, a DSC agent Tg / Tm / crystallinity). ``units`` keeps those
|
|
189
|
+
numbers interpretable, and ``warnings`` lets an agent flag a partial or
|
|
190
|
+
low-quality analysis without failing the call.
|
|
191
|
+
"""
|
|
192
|
+
|
|
193
|
+
results: dict[str, Any] = Field(default_factory=dict, description="The technique's outputs.")
|
|
194
|
+
units: dict[str, str] = Field(default_factory=dict)
|
|
195
|
+
summary: str = Field(default="", description="One or two sentences for the Test phase to read.")
|
|
196
|
+
warnings: list[str] = Field(default_factory=list)
|
|
197
|
+
provenance: AgentProvenance | None = None
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class DelegatedAnalysis(Analysis):
|
|
201
|
+
"""An :class:`Analysis` as the orchestrator records it
|
|
202
|
+
(``delegations/iter{N}/{agent_id}.json``, and
|
|
203
|
+
``AnalysisResult.delegated_analyses``)."""
|
|
204
|
+
|
|
205
|
+
agent_id: str
|
|
206
|
+
technique: str
|
|
207
|
+
provenance: Provenance | None = None
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
# ---------------------------------------------------------------------------
|
|
211
|
+
# JSON Schema, for agents not written in Python
|
|
212
|
+
# ---------------------------------------------------------------------------
|
|
213
|
+
|
|
214
|
+
#: The models an agent implements against, by schema file name.
|
|
215
|
+
WIRE_MODELS: dict[str, type[BaseModel]] = {
|
|
216
|
+
"consult_request.schema.json": ConsultRequest,
|
|
217
|
+
"advisory.schema.json": Advisory,
|
|
218
|
+
"analysis_task.schema.json": AnalysisTask,
|
|
219
|
+
"analysis.schema.json": Analysis,
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def json_schemas() -> dict[str, dict[str, Any]]:
|
|
224
|
+
"""The JSON Schema of every wire model, keyed by its schema file name."""
|
|
225
|
+
return {filename: model.model_json_schema() for filename, model in WIRE_MODELS.items()}
|