# Team runtime interface Each task runs three trusted services next to the agent: the team service (Stanford's episode code and the evaluated seat's public interface), an isolated worker for submitted code, and the task-local model gateway `model-compat`. The gateway forwards requests to the configured provider, adding only explicitly configured `CI_MODEL_BODY` provider options. It drops Google's unsupported top-level `store` field, pins the evaluated model and rejects provider-side tools and remote content. Staged Pi extensions preserve provider-issued opaque signatures. The evaluated credential is provided by Legion; partner, judge and Qwen3-14B settings reach only the team service, and the worker has neither credentials nor private evidence. `python -m collab_harbor.service --config /private/task.json` starts a public listener on port 8000, a private listener on loopback port 8001, and one owned upstream episode subprocess. The unchanged harness calls the external evaluated seat through its existing `HARNESS_OPENAI_COMPAT` route. Partner and judge model names retain their configured assignments. The agent can call: ```sh team read --wait 30 team say --request-id ID --file message.txt team answer --request-id ID --reasoning 'Reason for the answer' 'ANSWER' team tool --request-id ID read_file --arguments-json '{"path":"solution.py"}' ``` `say` and `answer` also accept text on stdin or as a positional argument. An answer is wrapped in the upstream answer/reasoning JSON format. File and stdin text retain their newlines. The client uses `TEAM_URL`, normally `http://team:8000`, and needs only the Python standard library. ## Public HTTP API `GET /read?wait=SECONDS` accepts a wait from 0 to 30 and returns `{"state": STATE, "request": REQUEST_OR_NULL}`. Reads do not consume a request. The request contains `request_id`, `kind`, `system`, `messages`, `tools`, and `max_tokens`. Its messages and function schemas are the actual OpenAI-compatible wire representation of the evaluated seat's upstream observation. No other seat's private prompt, checker rubric, or answer key is exposed. `POST /reply` accepts `request_id`, `kind`, and `text` for a `message` or `final_answer` request. A `tool` reply accepts `name` and an `arguments` object; a batch reply can provide a neutral `tool_calls` array with `id`, `name`, and `input` for each call. Tool names must belong to the pending request's tools. One accepted reply returns `{"accepted": true, "request_id": ID}`. An identical retry returns the same acknowledgement; conflicting, stale, and out-of-phase replies fail. Request bodies are bounded to 2 MiB. `GET /health` establishes listener readiness. It does not assert that a model provider is available. All other public routes return 404, including the private provider and finalization paths. ## Lifecycle and trusted export States are `starting`, `waiting_for_message`, `waiting_for_final_answer`, `waiting_for_tool`, `processing`, `finished`, `abandoned`, and `infrastructure_error`. Pending observations, accepted actions, and lifecycle transitions are persisted atomically in the service's private evidence directory. Only the loopback listener serves `POST /v1/chat/completions` and `POST /finalize`. Harbor's collection command runs the exporter inside the team service. Finalization allows already accepted work to settle. A normal agent exit with an unanswered request is abandonment, worth zero. An explicitly configured wrapper request or episode timeout remains unscored and cannot supply a failed solo gate. An owned worker crash, API exception, invalid worker evidence, or processing deadline becomes infrastructure failure, which must remain unscored. Finalization checks worker failure before attributing an unanswered request to the agent. Cancellation terminates the owned worker's process group, with bounded escalation from TERM to KILL. The envelope retains the complete upstream transcript after completion and partial observations/actions after interruption. It also records identity, configuration, lifecycle, and terminal reason. Runtime model configuration is written before the episode starts, so abandonment and completed runs retain the same configuration for aggregation. Per-trial loopback transport ports are normalized in that configuration; the full transcript retains the actual harness route. ## Configuration With `--taking-over-reader`, generated Taking-over manipulation tasks bake a required `taking_over_reader_gate` policy into both team and verifier metadata. The private worker runs the released Stanford Opus5.5/high/32000 reader and original application rule before publishing a terminal result. A rejected scripted stop resumes from the original native prefix through `continue_from` and publishes the next request to the same still-live Pi session. Reader rationale is never inserted into the public observation. Label-changing or unsupported continuations remain held. A finished required-reader task cannot fall back to the automatic checker when its reader gate is missing, deferred or malformed. Fresh grading retains the automatic checker and separately validates the full original reader chain. Aggregation changes only the effective test pass bit and preserves the native refusal/judge-failure flags. Normal abandonment can still be zero; host wrapper cuts and unresolved reader applications remain unavailable. The released API reader is not claimed to be the paper's identical judge execution. The stock scorer requires the matching Legion `run.json` for each verifier result. It keeps host-cut conversations unscored. A completed native result survives later host cleanup failure only when trusted lifecycle/timestamp evidence, balanced accepted requests, fresh checker and any required reader gate establish completion before the host cutoff. Raw host/error/verifier files are unchanged. Required task configuration fields are `scenario_path`, `version`, `seed`, `partner_models`, and the generator's `identity` object. Additional fields: | Field | Meaning | | --- | --- | | `request_timeout_sec` | Optional unanswered-seat watchdog; disabled by default. This is a wrapper setting, not a Stanford turn limit. | | `initial_request_timeout_sec` | Optional first-request watchdog; disabled by default, or inherits an explicitly supplied request deadline. | | `episode_timeout_sec` | Optional whole-service watchdog; disabled by default. | | `finalize_timeout_sec` | Optional settling watchdog; disabled by default so final teammate/judge requests can finish. | | `agent_configuration` | Real evaluated scaffold endpoint/settings metadata. | | `execution_url` | Required isolated pytest worker URL for coding episodes. | `CI_EVALUATED_MODEL` records the actual evaluated model name. `CI_AGENT_CONFIGURATION` can supply the agent metadata as a JSON object. Keep credentials out of both configuration fields. `ANTHROPIC_BASE_URL` and `OPENAI_BASE_URL` are honored by their SDKs and recorded as provider endpoints; compatible-route overrides use upstream's `HARNESS_OPENAI_COMPAT` environment. When `ANTHROPIC_WORKSPACE_ID` is set, live upstream Anthropic clients attach its workspace header without changing model names or judge prompts. The workspace identifier and generated dependency-lock hash are retained in configuration. Coding episodes retain upstream file-tool ownership and history in the episode process. Live pytest execution uses `RemotePytestRunner`; the service requires an isolated execution URL. Arbitrary submitted code must never execute in the credential-bearing team service. The service executable supports `--public-host`, `--public-port`, `--internal-port`, and `--evidence-dir`. The private listener always binds to loopback.