You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add slime attribution to NOTICE (Apache-2.0) for the files adapted into the
rollout gateway, and document the upstream baseline commit + re-sync workflow in
AGENTS.md so future lifts can diff against the right slime revision.
|`SamplingBackend`|`sampling_backends/`| The one per-engine seam: `token_ids -> token_ids + logprobs` as a `TurnRecord`. Impls: `VllmHttpBackend`, `SglangHttpBackend`, `TinkerSdkBackend`. |
| Adapters |`adapters/`| Wire-protocol translation: `OpenAIAdapter` (`/v1/chat/completions`), `AnthropicAdapter` (`/v1/messages`). An agent drives the gateway in its *native* protocol unmodified (just point `base_url` at it); both normalize to one canonical message form and share one `TrajectoryManager`. |
266
266
|`RolloutGateway`|`gateway.py`| Assembles tokenizer + renderer + backend + adapters onto one aiohttp app sharing one `TrajectoryManager`. Session identity rides in the api-key / Bearer slot; `base_url` is a fixed gateway address (no per-session URLs). |
267
267
268
268
**Session model.** A session id (in the Bearer slot) keys one trajectory tree.
269
269
`gateway.create_session(sid)` → agent turns are captured → `gateway.finish_session(sid)`
270
270
drains the tree into `list[TraceRecord]`.
271
271
272
+
**Multi-API & sub-agents.**
273
+
-*Multi-API* (works today): OpenAI- and Anthropic-protocol turns for the same session id
274
+
fold into the same trajectory tree, so one training run can capture agents that speak
275
+
different wire protocols.
276
+
-*Dynamic sub-agents as in-session forks* (works today): when a harness spawns a sub-agent
277
+
(e.g. Claude Code's Task tool) whose LLM calls reuse the **same** session id, its distinct
278
+
system prompt doesn't match the parent's branch, so `TrajectoryManager`**forks** a new leaf
279
+
automatically (`_find_mount_point` matches by role + message equality). `get_trajectory`
280
+
walks *all* leaves, so the parent trajectory and each sub-agent trajectory are all captured
281
+
and correlated under one tree — the common self-spawning-sub-agent case needs no extra
282
+
wiring. (Verifying this end-to-end against a real Claude Code harness is a to-do; the design
283
+
is in place, but only synthetic/single-agent flows have been exercised so far.)
284
+
-*Sub-agents that run under a **distinct** session id* (grouping pending): if the harness
285
+
gives a sub-agent its own session id (its own Bearer key), it becomes a separate tree. Tying
286
+
those separate trees into one episode requires stamping a shared `rollout_id` across their
287
+
`TraceRecord`s — that stamping lives in the (not-yet-landed) dispatch layer, so this
288
+
cross-session case is not wired in this package yet.
289
+
272
290
**Dependencies.** The gateway is trainer-side and lives behind extras — the base install
0 commit comments