synth-containers 0.1.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.
- synth_containers-0.1.0/PKG-INFO +291 -0
- synth_containers-0.1.0/README.md +271 -0
- synth_containers-0.1.0/pyproject.toml +50 -0
- synth_containers-0.1.0/setup.cfg +4 -0
- synth_containers-0.1.0/src/synth_containers/__init__.py +235 -0
- synth_containers-0.1.0/src/synth_containers/adapters.py +221 -0
- synth_containers-0.1.0/src/synth_containers/capabilities.py +270 -0
- synth_containers-0.1.0/src/synth_containers/compat/__init__.py +51 -0
- synth_containers-0.1.0/src/synth_containers/compat/archipelago.py +332 -0
- synth_containers-0.1.0/src/synth_containers/compat/base.py +447 -0
- synth_containers-0.1.0/src/synth_containers/compat/harbor.py +101 -0
- synth_containers-0.1.0/src/synth_containers/compat/openenv.py +141 -0
- synth_containers-0.1.0/src/synth_containers/compat/service_http.py +179 -0
- synth_containers-0.1.0/src/synth_containers/compatibility.py +422 -0
- synth_containers-0.1.0/src/synth_containers/contracts.py +234 -0
- synth_containers-0.1.0/src/synth_containers/formats.py +241 -0
- synth_containers-0.1.0/src/synth_containers/http_adapter.py +298 -0
- synth_containers-0.1.0/src/synth_containers/http_client.py +191 -0
- synth_containers-0.1.0/src/synth_containers/http_models.py +85 -0
- synth_containers-0.1.0/src/synth_containers/nouns.py +408 -0
- synth_containers-0.1.0/src/synth_containers/ontology.py +152 -0
- synth_containers-0.1.0/src/synth_containers/profiles.py +172 -0
- synth_containers-0.1.0/src/synth_containers/protocols.py +127 -0
- synth_containers-0.1.0/src/synth_containers/proxying.py +177 -0
- synth_containers-0.1.0/src/synth_containers/recovery.py +183 -0
- synth_containers-0.1.0/src/synth_containers/reference_runtime.py +849 -0
- synth_containers-0.1.0/src/synth_containers/resources.py +75 -0
- synth_containers-0.1.0/src/synth_containers/rewards.py +186 -0
- synth_containers-0.1.0/src/synth_containers/runtime_requests.py +128 -0
- synth_containers-0.1.0/src/synth_containers/serde.py +54 -0
- synth_containers-0.1.0/src/synth_containers/tasks.py +154 -0
- synth_containers-0.1.0/src/synth_containers/tool_runtime.py +154 -0
- synth_containers-0.1.0/src/synth_containers/wire.py +125 -0
- synth_containers-0.1.0/src/synth_containers.egg-info/PKG-INFO +291 -0
- synth_containers-0.1.0/src/synth_containers.egg-info/SOURCES.txt +36 -0
- synth_containers-0.1.0/src/synth_containers.egg-info/dependency_links.txt +1 -0
- synth_containers-0.1.0/src/synth_containers.egg-info/requires.txt +9 -0
- synth_containers-0.1.0/src/synth_containers.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: synth-containers
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Shared Synth container and environment runtime substrate
|
|
5
|
+
Author-email: Synth Laboratories <josh@usesynth.ai>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/synth-laboratories/synth-cookbooks-public/tree/main/packages/synth-containers
|
|
8
|
+
Project-URL: Repository, https://github.com/synth-laboratories/synth-cookbooks-public
|
|
9
|
+
Project-URL: Issues, https://github.com/synth-laboratories/synth-cookbooks-public/issues
|
|
10
|
+
Requires-Python: >=3.11
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: pydantic>=2.0.0
|
|
13
|
+
Requires-Dist: fastapi>=0.110.0
|
|
14
|
+
Requires-Dist: httpx>=0.27.0
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: build>=1.2.1; extra == "dev"
|
|
17
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
18
|
+
Requires-Dist: ruff>=0.6.0; extra == "dev"
|
|
19
|
+
Requires-Dist: ty>=0.0.32; extra == "dev"
|
|
20
|
+
|
|
21
|
+
# Synth Containers
|
|
22
|
+
|
|
23
|
+
Shared Synth container and environment runtime substrate.
|
|
24
|
+
|
|
25
|
+
This package is the semver-friendly home for the shared ontology, protocols,
|
|
26
|
+
profiles, capability vocabulary, reference HTTP transport, and adapter
|
|
27
|
+
comparison surface needed to make real container consumers interoperate across:
|
|
28
|
+
|
|
29
|
+
- Go-Explore / `go_ex`
|
|
30
|
+
- MIPROv2
|
|
31
|
+
- standard eval harnesses
|
|
32
|
+
- pipeline RL without token traces
|
|
33
|
+
- pipeline RL with token ids / logprobs / logits
|
|
34
|
+
- Harbor / OpenEnv / Archipelago proxy adapters
|
|
35
|
+
|
|
36
|
+
## Design stance
|
|
37
|
+
|
|
38
|
+
The package stays layered on purpose:
|
|
39
|
+
|
|
40
|
+
1. semantics first
|
|
41
|
+
2. protocols second
|
|
42
|
+
3. transport third
|
|
43
|
+
|
|
44
|
+
The goal is not one flat API that erases every runtime’s meaning. The goal is a
|
|
45
|
+
shared substrate with explicit fidelity, checkpoint semantics, reward semantics,
|
|
46
|
+
and runtime/tool/proxy declarations.
|
|
47
|
+
|
|
48
|
+
## Implemented package surface
|
|
49
|
+
|
|
50
|
+
`src/synth_containers/` now includes:
|
|
51
|
+
|
|
52
|
+
- `ontology.py`
|
|
53
|
+
- contract version
|
|
54
|
+
- core nouns
|
|
55
|
+
- primitive protocols
|
|
56
|
+
- composed profiles
|
|
57
|
+
- checkpoint / resume / reward vocabulary
|
|
58
|
+
- `nouns.py`
|
|
59
|
+
- task, actor, action, observation, state, checkpoint, artifact, trace,
|
|
60
|
+
verifier, outcome, trajectory, execution records
|
|
61
|
+
- `resources.py`
|
|
62
|
+
- neutral resource references for data, code, runtime, state, evaluation,
|
|
63
|
+
tooling, secrets, config, artifacts, and other heavy task inputs
|
|
64
|
+
- `protocols.py`
|
|
65
|
+
- runtime-checkable protocol definitions for the primitive behaviors
|
|
66
|
+
- `profiles.py`
|
|
67
|
+
- profile specs, profile inference, and missing-protocol reporting
|
|
68
|
+
- `capabilities.py`
|
|
69
|
+
- canonical capability surface, route hints, token emission support, task info,
|
|
70
|
+
task catalog, runtime metadata
|
|
71
|
+
- `tool_runtime.py`
|
|
72
|
+
- tool-runtime / schema / output-mode compatibility surface
|
|
73
|
+
- `proxying.py`
|
|
74
|
+
- inference target and proxy/runtime routing declarations
|
|
75
|
+
- `contracts.py`
|
|
76
|
+
- Go-Explore / long-horizon shared contracts and stable artifact path surface
|
|
77
|
+
- `recovery.py`
|
|
78
|
+
- recovery projection for resumable / replayable / restartable runs
|
|
79
|
+
- `formats.py`
|
|
80
|
+
- canonical HTTP payload formatting for metadata, task info, rollout, and
|
|
81
|
+
execution state
|
|
82
|
+
- `wire.py`
|
|
83
|
+
- rollout lifecycle and submission-mode helpers for stable async semantics
|
|
84
|
+
- `http_adapter.py`
|
|
85
|
+
- reference FastAPI adapter over the normalized runtime surface
|
|
86
|
+
- `http_client.py`
|
|
87
|
+
- async client with retry/backoff and optional-route handling for the
|
|
88
|
+
reference HTTP contract
|
|
89
|
+
- `reference_runtime.py`
|
|
90
|
+
- concrete counter runtime + async queued executor + managed runtime adapter
|
|
91
|
+
- `ReferenceManagedRuntime.counter_default()` for a one-call reference runtime
|
|
92
|
+
- `compatibility.py`
|
|
93
|
+
- canonical consumer-target compatibility reporting and assertions
|
|
94
|
+
- `tasks.py`
|
|
95
|
+
- task/catalog convenience layer designed to stay evolvable toward persistent
|
|
96
|
+
catalogs
|
|
97
|
+
- `compat/`
|
|
98
|
+
- thin Harbor, OpenEnv, and Archipelago adapters that translate caller-owned
|
|
99
|
+
runtimes and services into the shared container contract
|
|
100
|
+
- `adapters.py`
|
|
101
|
+
- framework fidelity descriptors for `Environments-old`, `OpenEnv`,
|
|
102
|
+
`Archipelago`, and `Harbor`
|
|
103
|
+
- `rewards.py`
|
|
104
|
+
- reusable reward helpers, including the NLE Scout discovered-tile reward for
|
|
105
|
+
NetHack / NLE rollouts
|
|
106
|
+
|
|
107
|
+
## Core ontology
|
|
108
|
+
|
|
109
|
+
The deepest shared nouns are:
|
|
110
|
+
|
|
111
|
+
- `Runtime`
|
|
112
|
+
- `Actor`
|
|
113
|
+
- `Action`
|
|
114
|
+
- `Observation`
|
|
115
|
+
- `State`
|
|
116
|
+
- `Execution`
|
|
117
|
+
- `Outcome`
|
|
118
|
+
- `TaskInstance`
|
|
119
|
+
|
|
120
|
+
First-class surrounding nouns include:
|
|
121
|
+
|
|
122
|
+
- `Task`
|
|
123
|
+
- `TaskCatalog`
|
|
124
|
+
- `Artifact`
|
|
125
|
+
- `Trace`
|
|
126
|
+
- `Checkpoint`
|
|
127
|
+
- `Trajectory`
|
|
128
|
+
- `Tool`
|
|
129
|
+
- `VerifierResult`
|
|
130
|
+
- `AgentSession`
|
|
131
|
+
|
|
132
|
+
## Primitive protocols
|
|
133
|
+
|
|
134
|
+
The package defines and types the shared protocol vocabulary for:
|
|
135
|
+
|
|
136
|
+
- catalog-backed
|
|
137
|
+
- resettable
|
|
138
|
+
- steppable
|
|
139
|
+
- observable
|
|
140
|
+
- state-readable
|
|
141
|
+
- checkpointable
|
|
142
|
+
- restorable
|
|
143
|
+
- forkable
|
|
144
|
+
- rollout-runnable
|
|
145
|
+
- async-rollout-runnable
|
|
146
|
+
- trace-emitting
|
|
147
|
+
- reward-emitting
|
|
148
|
+
- verifier-backed
|
|
149
|
+
- tool-callable
|
|
150
|
+
- token-trace-emitting
|
|
151
|
+
- multi-actor
|
|
152
|
+
- proxied-inference-backed
|
|
153
|
+
|
|
154
|
+
## Composed profiles
|
|
155
|
+
|
|
156
|
+
Implemented profiles:
|
|
157
|
+
|
|
158
|
+
- stateless evaluator
|
|
159
|
+
- gym-style environment
|
|
160
|
+
- checkpointable stateful environment
|
|
161
|
+
- checkpointable long-horizon environment
|
|
162
|
+
- multi-agent long-horizon environment
|
|
163
|
+
- sandboxed MCP world
|
|
164
|
+
- RL trajectory emitter
|
|
165
|
+
- token-level RL environment
|
|
166
|
+
- harness-managed benchmark environment
|
|
167
|
+
|
|
168
|
+
Profiles can be inferred from declared protocol fidelity, and missing protocol
|
|
169
|
+
requirements can be reported explicitly.
|
|
170
|
+
|
|
171
|
+
## Canonical capability surface
|
|
172
|
+
|
|
173
|
+
The normalized capability surface includes:
|
|
174
|
+
|
|
175
|
+
- contract version
|
|
176
|
+
- runtime kind
|
|
177
|
+
- rollout modes
|
|
178
|
+
- statefulness tier
|
|
179
|
+
- noun / protocol / profile fidelity
|
|
180
|
+
- checkpoint semantics
|
|
181
|
+
- restore / resume semantics
|
|
182
|
+
- branching support
|
|
183
|
+
- true-environment-snapshot support
|
|
184
|
+
- artifact / trace / reward / verifier support
|
|
185
|
+
- tool runtime declarations
|
|
186
|
+
- token / logprob / logits support
|
|
187
|
+
- route hints for discovery and control operations
|
|
188
|
+
|
|
189
|
+
Task definitions, task instances, task info, and task catalogs can also carry
|
|
190
|
+
`resource_refs`. These references are intentionally neutral: framework-specific
|
|
191
|
+
detail belongs in `subtype` and `metadata`, while the umbrella `kind` remains
|
|
192
|
+
small and stable.
|
|
193
|
+
|
|
194
|
+
## Reference HTTP surface
|
|
195
|
+
|
|
196
|
+
The reference FastAPI adapter implements:
|
|
197
|
+
|
|
198
|
+
- `GET /`
|
|
199
|
+
- `GET /health`
|
|
200
|
+
- `GET /metadata`
|
|
201
|
+
- `GET /info`
|
|
202
|
+
- `GET /task_info`
|
|
203
|
+
- `GET /task_catalog`
|
|
204
|
+
- `GET /compatibility`
|
|
205
|
+
- `POST /rollout`
|
|
206
|
+
- `POST /rollouts`
|
|
207
|
+
- `GET /rollouts/{rollout_id}`
|
|
208
|
+
- `GET /rollouts/{rollout_id}/state`
|
|
209
|
+
- `GET /rollouts/{rollout_id}/summary`
|
|
210
|
+
- `GET /rollouts/{rollout_id}/usage`
|
|
211
|
+
- `GET /rollouts/{rollout_id}/artifacts`
|
|
212
|
+
- `GET /rollouts/{rollout_id}/events`
|
|
213
|
+
- `GET /rollouts/{rollout_id}/trace`
|
|
214
|
+
- `POST /rollouts/{rollout_id}/pause`
|
|
215
|
+
- `POST /rollouts/{rollout_id}/terminate`
|
|
216
|
+
- `GET /rollouts/{rollout_id}/checkpoints`
|
|
217
|
+
- `POST /rollouts/{rollout_id}/checkpoints`
|
|
218
|
+
- `GET /rollouts/{rollout_id}/checkpoints/{checkpoint_id}`
|
|
219
|
+
- `GET /checkpoints`
|
|
220
|
+
- `GET /checkpoints/{checkpoint_id}`
|
|
221
|
+
- `POST /checkpoints/{checkpoint_id}/labels`
|
|
222
|
+
- `POST /rollouts/{rollout_id}/resume`
|
|
223
|
+
|
|
224
|
+
`GET /task_info` may receive selector query params. If a runtime implements
|
|
225
|
+
`task_info_for_request(query)`, the reference adapter delegates to it; otherwise
|
|
226
|
+
it returns the runtime's default task info.
|
|
227
|
+
|
|
228
|
+
The rollout formatter is intentionally trainer-friendly:
|
|
229
|
+
|
|
230
|
+
- `artifacts[].turns`
|
|
231
|
+
- `trace.event_history`
|
|
232
|
+
- `trace.inference.turns`
|
|
233
|
+
- `reward_info.outcome_reward`
|
|
234
|
+
- per-turn `event_rewards`
|
|
235
|
+
- optional token-id / logprob / top-logprob data
|
|
236
|
+
|
|
237
|
+
## Validation coverage
|
|
238
|
+
|
|
239
|
+
The package surfaces are structured to be directly verifiable for:
|
|
240
|
+
|
|
241
|
+
- profile inference and capability validation
|
|
242
|
+
- Go-Explore contract/recovery projection
|
|
243
|
+
- MIPROv2 evaluator compatibility
|
|
244
|
+
- RL payloads with and without token-level traces
|
|
245
|
+
- HTTP lifecycle operations including pause/checkpoint/resume/terminate
|
|
246
|
+
- framework compatibility for `Environments-old`, `OpenEnv`, `Archipelago`,
|
|
247
|
+
and `Harbor`
|
|
248
|
+
|
|
249
|
+
## NLE Scout Reward
|
|
250
|
+
|
|
251
|
+
`NLEScoutRewardTracker` implements the Scout metric used by NLE: reward is the
|
|
252
|
+
increase in observed glyph tiles on the current `(dungeon_num, dungeon_level)`.
|
|
253
|
+
NLE represents unseen tiles with `nethack.GLYPH_CMAP_OFF`, so cookbook code can
|
|
254
|
+
construct the tracker from the NLE module and use the per-step update as the
|
|
255
|
+
PipelineRL reward:
|
|
256
|
+
|
|
257
|
+
```python
|
|
258
|
+
from nle import nethack
|
|
259
|
+
from synth_containers import NLEScoutRewardTracker
|
|
260
|
+
|
|
261
|
+
reward_tracker = NLEScoutRewardTracker.from_nethack_module(nethack)
|
|
262
|
+
|
|
263
|
+
previous_observation = None
|
|
264
|
+
for observation in rollout_observations:
|
|
265
|
+
scout_update = reward_tracker.update_from_observation(
|
|
266
|
+
observation,
|
|
267
|
+
previous_observation=previous_observation,
|
|
268
|
+
)
|
|
269
|
+
reward = scout_update.reward
|
|
270
|
+
previous_observation = observation
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
The default is the pure Scout discovered-tile delta. If a cookbook needs the
|
|
274
|
+
time-penalty behavior from the upstream NLE task, pass `penalty_mode` and
|
|
275
|
+
`penalty_step` when constructing the tracker.
|
|
276
|
+
|
|
277
|
+
## References informing the design
|
|
278
|
+
|
|
279
|
+
- old Synth environments / Horizons legacy
|
|
280
|
+
- current Synth container contracts in `synth-lab`
|
|
281
|
+
- current eval long-horizon wrapper surface
|
|
282
|
+
- NanoLong long-horizon RL container requirements
|
|
283
|
+
- Harbor
|
|
284
|
+
- OpenEnv
|
|
285
|
+
- Archipelago
|
|
286
|
+
|
|
287
|
+
See also:
|
|
288
|
+
|
|
289
|
+
- [Ontology Draft](docs/ontology.md)
|
|
290
|
+
- [Framework Comparison](docs/framework_comparison.md)
|
|
291
|
+
- [Algorithm Support Targets](docs/algorithm_support.md)
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# Synth Containers
|
|
2
|
+
|
|
3
|
+
Shared Synth container and environment runtime substrate.
|
|
4
|
+
|
|
5
|
+
This package is the semver-friendly home for the shared ontology, protocols,
|
|
6
|
+
profiles, capability vocabulary, reference HTTP transport, and adapter
|
|
7
|
+
comparison surface needed to make real container consumers interoperate across:
|
|
8
|
+
|
|
9
|
+
- Go-Explore / `go_ex`
|
|
10
|
+
- MIPROv2
|
|
11
|
+
- standard eval harnesses
|
|
12
|
+
- pipeline RL without token traces
|
|
13
|
+
- pipeline RL with token ids / logprobs / logits
|
|
14
|
+
- Harbor / OpenEnv / Archipelago proxy adapters
|
|
15
|
+
|
|
16
|
+
## Design stance
|
|
17
|
+
|
|
18
|
+
The package stays layered on purpose:
|
|
19
|
+
|
|
20
|
+
1. semantics first
|
|
21
|
+
2. protocols second
|
|
22
|
+
3. transport third
|
|
23
|
+
|
|
24
|
+
The goal is not one flat API that erases every runtime’s meaning. The goal is a
|
|
25
|
+
shared substrate with explicit fidelity, checkpoint semantics, reward semantics,
|
|
26
|
+
and runtime/tool/proxy declarations.
|
|
27
|
+
|
|
28
|
+
## Implemented package surface
|
|
29
|
+
|
|
30
|
+
`src/synth_containers/` now includes:
|
|
31
|
+
|
|
32
|
+
- `ontology.py`
|
|
33
|
+
- contract version
|
|
34
|
+
- core nouns
|
|
35
|
+
- primitive protocols
|
|
36
|
+
- composed profiles
|
|
37
|
+
- checkpoint / resume / reward vocabulary
|
|
38
|
+
- `nouns.py`
|
|
39
|
+
- task, actor, action, observation, state, checkpoint, artifact, trace,
|
|
40
|
+
verifier, outcome, trajectory, execution records
|
|
41
|
+
- `resources.py`
|
|
42
|
+
- neutral resource references for data, code, runtime, state, evaluation,
|
|
43
|
+
tooling, secrets, config, artifacts, and other heavy task inputs
|
|
44
|
+
- `protocols.py`
|
|
45
|
+
- runtime-checkable protocol definitions for the primitive behaviors
|
|
46
|
+
- `profiles.py`
|
|
47
|
+
- profile specs, profile inference, and missing-protocol reporting
|
|
48
|
+
- `capabilities.py`
|
|
49
|
+
- canonical capability surface, route hints, token emission support, task info,
|
|
50
|
+
task catalog, runtime metadata
|
|
51
|
+
- `tool_runtime.py`
|
|
52
|
+
- tool-runtime / schema / output-mode compatibility surface
|
|
53
|
+
- `proxying.py`
|
|
54
|
+
- inference target and proxy/runtime routing declarations
|
|
55
|
+
- `contracts.py`
|
|
56
|
+
- Go-Explore / long-horizon shared contracts and stable artifact path surface
|
|
57
|
+
- `recovery.py`
|
|
58
|
+
- recovery projection for resumable / replayable / restartable runs
|
|
59
|
+
- `formats.py`
|
|
60
|
+
- canonical HTTP payload formatting for metadata, task info, rollout, and
|
|
61
|
+
execution state
|
|
62
|
+
- `wire.py`
|
|
63
|
+
- rollout lifecycle and submission-mode helpers for stable async semantics
|
|
64
|
+
- `http_adapter.py`
|
|
65
|
+
- reference FastAPI adapter over the normalized runtime surface
|
|
66
|
+
- `http_client.py`
|
|
67
|
+
- async client with retry/backoff and optional-route handling for the
|
|
68
|
+
reference HTTP contract
|
|
69
|
+
- `reference_runtime.py`
|
|
70
|
+
- concrete counter runtime + async queued executor + managed runtime adapter
|
|
71
|
+
- `ReferenceManagedRuntime.counter_default()` for a one-call reference runtime
|
|
72
|
+
- `compatibility.py`
|
|
73
|
+
- canonical consumer-target compatibility reporting and assertions
|
|
74
|
+
- `tasks.py`
|
|
75
|
+
- task/catalog convenience layer designed to stay evolvable toward persistent
|
|
76
|
+
catalogs
|
|
77
|
+
- `compat/`
|
|
78
|
+
- thin Harbor, OpenEnv, and Archipelago adapters that translate caller-owned
|
|
79
|
+
runtimes and services into the shared container contract
|
|
80
|
+
- `adapters.py`
|
|
81
|
+
- framework fidelity descriptors for `Environments-old`, `OpenEnv`,
|
|
82
|
+
`Archipelago`, and `Harbor`
|
|
83
|
+
- `rewards.py`
|
|
84
|
+
- reusable reward helpers, including the NLE Scout discovered-tile reward for
|
|
85
|
+
NetHack / NLE rollouts
|
|
86
|
+
|
|
87
|
+
## Core ontology
|
|
88
|
+
|
|
89
|
+
The deepest shared nouns are:
|
|
90
|
+
|
|
91
|
+
- `Runtime`
|
|
92
|
+
- `Actor`
|
|
93
|
+
- `Action`
|
|
94
|
+
- `Observation`
|
|
95
|
+
- `State`
|
|
96
|
+
- `Execution`
|
|
97
|
+
- `Outcome`
|
|
98
|
+
- `TaskInstance`
|
|
99
|
+
|
|
100
|
+
First-class surrounding nouns include:
|
|
101
|
+
|
|
102
|
+
- `Task`
|
|
103
|
+
- `TaskCatalog`
|
|
104
|
+
- `Artifact`
|
|
105
|
+
- `Trace`
|
|
106
|
+
- `Checkpoint`
|
|
107
|
+
- `Trajectory`
|
|
108
|
+
- `Tool`
|
|
109
|
+
- `VerifierResult`
|
|
110
|
+
- `AgentSession`
|
|
111
|
+
|
|
112
|
+
## Primitive protocols
|
|
113
|
+
|
|
114
|
+
The package defines and types the shared protocol vocabulary for:
|
|
115
|
+
|
|
116
|
+
- catalog-backed
|
|
117
|
+
- resettable
|
|
118
|
+
- steppable
|
|
119
|
+
- observable
|
|
120
|
+
- state-readable
|
|
121
|
+
- checkpointable
|
|
122
|
+
- restorable
|
|
123
|
+
- forkable
|
|
124
|
+
- rollout-runnable
|
|
125
|
+
- async-rollout-runnable
|
|
126
|
+
- trace-emitting
|
|
127
|
+
- reward-emitting
|
|
128
|
+
- verifier-backed
|
|
129
|
+
- tool-callable
|
|
130
|
+
- token-trace-emitting
|
|
131
|
+
- multi-actor
|
|
132
|
+
- proxied-inference-backed
|
|
133
|
+
|
|
134
|
+
## Composed profiles
|
|
135
|
+
|
|
136
|
+
Implemented profiles:
|
|
137
|
+
|
|
138
|
+
- stateless evaluator
|
|
139
|
+
- gym-style environment
|
|
140
|
+
- checkpointable stateful environment
|
|
141
|
+
- checkpointable long-horizon environment
|
|
142
|
+
- multi-agent long-horizon environment
|
|
143
|
+
- sandboxed MCP world
|
|
144
|
+
- RL trajectory emitter
|
|
145
|
+
- token-level RL environment
|
|
146
|
+
- harness-managed benchmark environment
|
|
147
|
+
|
|
148
|
+
Profiles can be inferred from declared protocol fidelity, and missing protocol
|
|
149
|
+
requirements can be reported explicitly.
|
|
150
|
+
|
|
151
|
+
## Canonical capability surface
|
|
152
|
+
|
|
153
|
+
The normalized capability surface includes:
|
|
154
|
+
|
|
155
|
+
- contract version
|
|
156
|
+
- runtime kind
|
|
157
|
+
- rollout modes
|
|
158
|
+
- statefulness tier
|
|
159
|
+
- noun / protocol / profile fidelity
|
|
160
|
+
- checkpoint semantics
|
|
161
|
+
- restore / resume semantics
|
|
162
|
+
- branching support
|
|
163
|
+
- true-environment-snapshot support
|
|
164
|
+
- artifact / trace / reward / verifier support
|
|
165
|
+
- tool runtime declarations
|
|
166
|
+
- token / logprob / logits support
|
|
167
|
+
- route hints for discovery and control operations
|
|
168
|
+
|
|
169
|
+
Task definitions, task instances, task info, and task catalogs can also carry
|
|
170
|
+
`resource_refs`. These references are intentionally neutral: framework-specific
|
|
171
|
+
detail belongs in `subtype` and `metadata`, while the umbrella `kind` remains
|
|
172
|
+
small and stable.
|
|
173
|
+
|
|
174
|
+
## Reference HTTP surface
|
|
175
|
+
|
|
176
|
+
The reference FastAPI adapter implements:
|
|
177
|
+
|
|
178
|
+
- `GET /`
|
|
179
|
+
- `GET /health`
|
|
180
|
+
- `GET /metadata`
|
|
181
|
+
- `GET /info`
|
|
182
|
+
- `GET /task_info`
|
|
183
|
+
- `GET /task_catalog`
|
|
184
|
+
- `GET /compatibility`
|
|
185
|
+
- `POST /rollout`
|
|
186
|
+
- `POST /rollouts`
|
|
187
|
+
- `GET /rollouts/{rollout_id}`
|
|
188
|
+
- `GET /rollouts/{rollout_id}/state`
|
|
189
|
+
- `GET /rollouts/{rollout_id}/summary`
|
|
190
|
+
- `GET /rollouts/{rollout_id}/usage`
|
|
191
|
+
- `GET /rollouts/{rollout_id}/artifacts`
|
|
192
|
+
- `GET /rollouts/{rollout_id}/events`
|
|
193
|
+
- `GET /rollouts/{rollout_id}/trace`
|
|
194
|
+
- `POST /rollouts/{rollout_id}/pause`
|
|
195
|
+
- `POST /rollouts/{rollout_id}/terminate`
|
|
196
|
+
- `GET /rollouts/{rollout_id}/checkpoints`
|
|
197
|
+
- `POST /rollouts/{rollout_id}/checkpoints`
|
|
198
|
+
- `GET /rollouts/{rollout_id}/checkpoints/{checkpoint_id}`
|
|
199
|
+
- `GET /checkpoints`
|
|
200
|
+
- `GET /checkpoints/{checkpoint_id}`
|
|
201
|
+
- `POST /checkpoints/{checkpoint_id}/labels`
|
|
202
|
+
- `POST /rollouts/{rollout_id}/resume`
|
|
203
|
+
|
|
204
|
+
`GET /task_info` may receive selector query params. If a runtime implements
|
|
205
|
+
`task_info_for_request(query)`, the reference adapter delegates to it; otherwise
|
|
206
|
+
it returns the runtime's default task info.
|
|
207
|
+
|
|
208
|
+
The rollout formatter is intentionally trainer-friendly:
|
|
209
|
+
|
|
210
|
+
- `artifacts[].turns`
|
|
211
|
+
- `trace.event_history`
|
|
212
|
+
- `trace.inference.turns`
|
|
213
|
+
- `reward_info.outcome_reward`
|
|
214
|
+
- per-turn `event_rewards`
|
|
215
|
+
- optional token-id / logprob / top-logprob data
|
|
216
|
+
|
|
217
|
+
## Validation coverage
|
|
218
|
+
|
|
219
|
+
The package surfaces are structured to be directly verifiable for:
|
|
220
|
+
|
|
221
|
+
- profile inference and capability validation
|
|
222
|
+
- Go-Explore contract/recovery projection
|
|
223
|
+
- MIPROv2 evaluator compatibility
|
|
224
|
+
- RL payloads with and without token-level traces
|
|
225
|
+
- HTTP lifecycle operations including pause/checkpoint/resume/terminate
|
|
226
|
+
- framework compatibility for `Environments-old`, `OpenEnv`, `Archipelago`,
|
|
227
|
+
and `Harbor`
|
|
228
|
+
|
|
229
|
+
## NLE Scout Reward
|
|
230
|
+
|
|
231
|
+
`NLEScoutRewardTracker` implements the Scout metric used by NLE: reward is the
|
|
232
|
+
increase in observed glyph tiles on the current `(dungeon_num, dungeon_level)`.
|
|
233
|
+
NLE represents unseen tiles with `nethack.GLYPH_CMAP_OFF`, so cookbook code can
|
|
234
|
+
construct the tracker from the NLE module and use the per-step update as the
|
|
235
|
+
PipelineRL reward:
|
|
236
|
+
|
|
237
|
+
```python
|
|
238
|
+
from nle import nethack
|
|
239
|
+
from synth_containers import NLEScoutRewardTracker
|
|
240
|
+
|
|
241
|
+
reward_tracker = NLEScoutRewardTracker.from_nethack_module(nethack)
|
|
242
|
+
|
|
243
|
+
previous_observation = None
|
|
244
|
+
for observation in rollout_observations:
|
|
245
|
+
scout_update = reward_tracker.update_from_observation(
|
|
246
|
+
observation,
|
|
247
|
+
previous_observation=previous_observation,
|
|
248
|
+
)
|
|
249
|
+
reward = scout_update.reward
|
|
250
|
+
previous_observation = observation
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
The default is the pure Scout discovered-tile delta. If a cookbook needs the
|
|
254
|
+
time-penalty behavior from the upstream NLE task, pass `penalty_mode` and
|
|
255
|
+
`penalty_step` when constructing the tracker.
|
|
256
|
+
|
|
257
|
+
## References informing the design
|
|
258
|
+
|
|
259
|
+
- old Synth environments / Horizons legacy
|
|
260
|
+
- current Synth container contracts in `synth-lab`
|
|
261
|
+
- current eval long-horizon wrapper surface
|
|
262
|
+
- NanoLong long-horizon RL container requirements
|
|
263
|
+
- Harbor
|
|
264
|
+
- OpenEnv
|
|
265
|
+
- Archipelago
|
|
266
|
+
|
|
267
|
+
See also:
|
|
268
|
+
|
|
269
|
+
- [Ontology Draft](docs/ontology.md)
|
|
270
|
+
- [Framework Comparison](docs/framework_comparison.md)
|
|
271
|
+
- [Algorithm Support Targets](docs/algorithm_support.md)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "synth-containers"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Shared Synth container and environment runtime substrate"
|
|
5
|
+
authors = [{name = "Synth Laboratories", email = "josh@usesynth.ai"}]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
requires-python = ">=3.11"
|
|
8
|
+
license = "MIT"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"pydantic>=2.0.0",
|
|
11
|
+
"fastapi>=0.110.0",
|
|
12
|
+
"httpx>=0.27.0",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[project.optional-dependencies]
|
|
16
|
+
dev = [
|
|
17
|
+
"build>=1.2.1",
|
|
18
|
+
"twine>=5.0.0",
|
|
19
|
+
"ruff>=0.6.0",
|
|
20
|
+
"ty>=0.0.32",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[dependency-groups]
|
|
24
|
+
dev = [
|
|
25
|
+
"build>=1.2.1",
|
|
26
|
+
"twine>=5.0.0",
|
|
27
|
+
"ruff>=0.6.0",
|
|
28
|
+
"ty>=0.0.32",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/synth-laboratories/synth-cookbooks-public/tree/main/packages/synth-containers"
|
|
33
|
+
Repository = "https://github.com/synth-laboratories/synth-cookbooks-public"
|
|
34
|
+
Issues = "https://github.com/synth-laboratories/synth-cookbooks-public/issues"
|
|
35
|
+
|
|
36
|
+
[build-system]
|
|
37
|
+
requires = ["setuptools>=69", "wheel"]
|
|
38
|
+
build-backend = "setuptools.build_meta"
|
|
39
|
+
|
|
40
|
+
[tool.uv]
|
|
41
|
+
package = true
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.packages.find]
|
|
44
|
+
where = ["src"]
|
|
45
|
+
include = ["synth_containers", "synth_containers.*"]
|
|
46
|
+
|
|
47
|
+
[tool.ruff]
|
|
48
|
+
line-length = 100
|
|
49
|
+
target-version = "py311"
|
|
50
|
+
src = ["src"]
|