# Research notes

Investigation date: 2026-11-28.

## Sources pinned

| source | reference |
|---|---|
| Code | https://github.com/AntiQuality/agentabstain @ `cfc3faf7ab1cfd4892cde1158d6e43b2f312ddc3` ("update NeurIPS", 2026-09-28), MIT |
| Dataset | https://huggingface.co/datasets/antiquality/agentabstain @ `842228426c2a703347396501af61c7890972c7ee` (2026-07-17), CC BY 4.0, 7.8 MB in repo / 29 MB on disk |
| Paper | https://arxiv.org/abs/2607.10059 (cited from the README; the paper PDF itself was not read for this report) |

## Claims verified against data and code

| claim | how verified | result |
|---|---|---|
| 263 paired tasks | `tasks.jsonl`: 526 rows, 263 `pair_id`s, all with both variants | confirmed |
| 42 MCP sandbox environments | 42 dirs under `environments/`, 42 in `ENVIRONMENT_REGISTRY`, 42 referenced by tasks | confirmed |
| 541 tools | instantiated every registry class, summed `get_tool_schemas()` | confirmed (246 lookup, 176 commit, 119 verify) |
| 8 scenarios | `category` values | confirmed: S1 39, S2 30, S3 32, S4 31, S5 34, S6 34, S7 30, S8 33 |
| pre-execution vs runtime | `phase` field | 5 pre-execution (S1-S5), 3 runtime (S6 critical_tool_failure, S7 conflicting_evidence, S8 emergent_risk_discovery) |
| 131 operational / 132 informational | `action_type` | confirmed; both variants of each pair agree |
| 17 models, best paired 59.5% | README leaderboard table | stated by the authors; not reproducible here (needs paid model APIs and the LLM judge) |
| "no always-act or always-refuse policy can exceed 50%" | follows from the `combined` metric definition; under the commit check alone, see FEASIBILITY_REPORT | holds for `combined` by construction; measured for commit_check |

Perturbation dimensions (abstain side): `instruction` 132, `data` 63,
`tool_behavior` 34 (broken tools, S6), `tool` 34 (hidden tools, S5).

## Upstream architecture (as implemented)

* `src/runtime/task_mcp_server.py`: per-task FastMCP server over stdio.
  Loads `tasks/<cat>/<id>/<type>/task.yaml` + `initial_states/*.json`, builds
  a `MultiEnvironment` (tools namespaced `<env>.<tool>`), applies
  `tool_overrides.broken_tools` (tool raises, logged `success: false`) and
  `available_tools` (others hidden), registers hidden
  `__runtime_export_snapshot` returning `{state, execution_log}`.
* `abstention_factory/runtime/base.py`: `BaseEnvironment`; tools append to
  `execution_log` with `{tool, params, result, success, error}`.
* `src/runtime/{openaisdk,claudesdk,googleadk,openclaw}.py`: the four
  harnesses. Each spawns the server, connects its SDK's MCP client, runs the
  model, calls the export tool, writes `run_result.json`.
* `eval/evaluators/commit_check.py`: deterministic, tool-name level.
* `eval/evaluators/response_llm_judge.py`: OpenAI judge with per-scenario
  guidance; verdict `judged_abstention`.
* `eval/statistics/analysis.py`: `combined` metric and aggregation.

Notable facts found in the code (not in the README):

* The commit check never reads environment state; it uses the execution log.
* The official harness set is closed: `PROVIDER_REGISTRY` in
  `src/scripts/run_inference.py` and `SUPPORTED_PROVIDERS` in
  `src/runtime/config.py` accept only the four shipped providers. A custom
  agent needs edits to both, plus an `agent/<name>/agent.py` and a runtime
  module (the OpenAI one is 178 lines).
* `src/runtime/__init__.py` eagerly imports the OpenAI Agents SDK, so even
  starting a bare environment server requires `openai-agents` installed.
  Reproduced: `ModuleNotFoundError: No module named 'agents'`.
* `eval/evaluators` imports `anthropic` and `openai` at import time.
* MCP protocol negotiated with `mcp` 2.3.0 / FastMCP 4.2.6: `2025-11-25`.
* Cold start of one server: about 5-7 s on the test machine, dominated by
  Python imports.

## Ecosystem

Data from crates.io and GitHub APIs on 2026-11-28. "Searched" = GitHub code
search in the repo for `abstain` and `rmcp`.

| project | version / activity | what it is | relevant to AgentAbstain? | license |
|---|---|---|---|---|
| `rmcp` (modelcontextprotocol/rust-sdk) | 3.12.0, 2026-11-26, MSRV 1.88 | official Rust MCP SDK, client + server, child-process transport | the transport AAS-RS uses | Apache-2.0 (crate metadata) |
| `rust-mcp-sdk` | 2.0.0, 2026-08-27 | alternative MCP SDK | not used: rmcp is official and more active | MIT |
| `rig-core` (0xPlaygrounds/rig) | 0.47.1, 2026-11-25, MSRV 1.97.1 | LLM app/agent framework | ships `rig-rmcp`: Rig agents can use MCP tools via rmcp. No `abstain` hits. | MIT |
| `rig-evals` (pingedbrain/rig-contrib) | 0.47.3, 2026-11-27, 32 downloads | evals for Rig agents: datasets, built-in + LLM-judge evaluators, pass-rate thresholds, JSON/JUnit/Markdown | generic eval runner; no abstain hits; no AgentAbstain support | MIT |
| `swink-agent-eval` (SuperSwinkAI/Swink-Agent) | 0.14.4, 2026-11-25, MSRV 1.95 | trajectory tracing, golden-path verification, cost governance for swink-agent | framework-specific; no abstain, no rmcp hits | MIT |
| `deepeval-rs` (charathram) | 0.1.2-alpha, 2026-09-10 | port of Python deepeval (LLM-judge metrics) | judge metrics; no MCP execution | Apache-2.0 |
| `langchain-rust` | 8.0.0, 2026-11-03 | LangChain port | no abstain, no rmcp hits | MIT |
| `agents` (leostera/agents) | 0.3.0, 2026-03-19 | facade for typed Rust agents | no abstain, no rmcp hits; GitHub reports license NOASSERTION, crate says Apache-2.0 | Apache-2.0 (crate) |
| HarshDubey23/abhed | TypeScript, 2026-11-14 | runs AgentAbstain's 131 operational pairs through a rule-based gate with a worst-case agent | the only third-party AgentAbstain integration found, not Rust | not checked |

GitHub search for `agentabstain` found no Rust code. Other hits are paper
notes and Python experiments.

## Rig integration notes (rig-core 0.47.1)

Read from the crate source, not from older examples:
- Rig 0.47 splits into a provider-agnostic core (`rig-core`: models, wires,
  transports, messages, tool definitions) and separate agent runtimes
  (`rig-agent`). The old `client.agent(...).tool(...)` examples do not apply.
- AAS-RS uses `rig-core` only. It builds a `DynModel<Completion>` from
  `OpenAIConfig::new(key).with_base_url(url).client().chat(model)` (features
  `reqwest`, `rustls`), and runs its own tool loop with
  `CompletionRequest::new(..).preamble(..).messages(..).tools(..)`.
- AAS-RS does not use `rig-rmcp` or `rig-agent`. Every tool call must go
  through the AAS-RS `ToolBox` (recording, budget, export-tool hiding), so
  Rig must not open its own MCP connection to the environment.
- Rig sends message content as text-part arrays (valid Chat Completions
  format). Older OpenAI-compatible servers may need checking.

## Confirmed gaps

* No Rust crate runs AgentAbstain environments or implements its scoring.
* Rust MCP clients exist (rmcp, rig-rmcp), so connecting is possible without
  AAS-RS. What does not exist: the launch contract, export-tool handling,
  commit check, run-error rules, pair aggregation, baselines, and
  official-layout output. AAS-RS supplies those.
* The official harness cannot evaluate a custom agent without forking it.

## Unverified

* Paper-only claims (annotator agreement 94-98%, leaderboard values).
* Behaviour on native Windows: the Python environment and AAS-RS were run
  under WSL2 Linux only.
* MSRV of AAS-RS: built with rustc 1.100.1 only; rmcp needs >= 1.88; edition 2024 needs >= 1.85.
