Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Distributed RL Rollout & Replay Infrastructure

Ray / process Actor workers → versioned trajectories → independent rewards → replay/debug → real policy updates. Includes a CPU-only REINFORCE demo and preserves the Agent Regression Debugger.

pip install -e .
agent-replay rollout demo --actors 3 --rounds 8

New in v0.4: DDP/GRPO, vLLM, async scheduling, storage, recovery and benchmark guide. A single-host four-RTX-4090 smoke test passed two policy updates with a two-GPU DDP learner on 2026-11-10. This is correctness validation only; training improvement, representative performance, multi-host execution and Kubernetes deployment remain unvalidated.

See rollout architecture, API, workers and scope. The Vercel site displays recorded/imported evidence; the controller and workers run on your infrastructure. This release uses one SQLite controller. Ray GPU reservations and a GRPO learner are implemented; the linked smoke test validates one four-GPU configuration. Controller high availability remains unvalidated.


Replay — Agent Regression Debugger

Live workspace · Implementation guide · Original implementation plan

Turn a production agent failure into a regression test.

Capture the input and model/tool boundaries, rerun trusted agent code with controlled observations, compare model/tool/code changes, and verify business assertions in CI. Python 3.10+, MIT, no runtime dependencies. Package version 0.4.0; the package has not been published to PyPI.

Hosted workspace: Chinese / English

Overview · Replay & regression · Benchmarks · Refund evaluation

The four pages share grouped navigation and a persistent language preference. Overview, Replay and Benchmarks translate product copy, controls, dialogs and known validation messages. Refund offers Chinese and English aggregate reports. Switching language preserves the active Replay view, selected captures, imported snapshots/reports, and open dialog drafts. Language preference is browser-local; imported evidence is not uploaded by the static viewer.

Raw JSON, code, trajectory names, identifiers, hardware/provider diagnostics and execution evidence remain literal. Unknown service errors have a translated explanation followed by unchanged diagnostic details. The legacy step debugger at /legacy.html retains its original interface and is outside the four-page bilingual workspace.

Refund live evaluation

The hosted report contains 12 synthetic task families, 24 executable scenarios and 72 evaluated records, split by related provenance groups. Validation and test each contain 2 scenarios. Qualified verifier evidence and complete model executions remain local.

Two pinned OpenAI models were evaluated with 3 repetitions per scenario, producing 24 real responses and no provider errors:

Model Validation successes / runs Test successes / runs
gpt-4.1-mini-2025-04-14 6/6 0/6
gpt-4o-mini-2024-07-18 0/6 0/6

Stable cross-model failure reproduction was 2/4 scenarios (50%). Eleven of the eighteen failed runs violated the plain-JSON protocol through Markdown code fences; JSON response mode and automatic fence stripping were not enabled. These results measure end-to-end behavior on four synthetic held-out scenarios, not production generalization, an intrinsic model ranking or RL training gains.

Only the static website and aggregate reports are publicly deployed. Source and full dataset ZIP files remain local, with no public download endpoints. No model API key or complete trajectory dataset is published with the website.

A working failure → fix → regression story

python -m pip install -e .
agent-replay demo --directory .replay/demo
agent-replay serve --project .replay/demo/agent-replay.json

Open http://127.0.0.1:8765. The demo actually runs an agent that refunds 299.00, a fixed agent that refunds 29.00, then the original bug again. Assertions require one refund, the correct order, completed execution, and at most 30.00. The results are fail → pass → fail. All payments and model responses in the demo are synthetic; there are no external calls.

The UI provides Failures, paired boundary comparison, Regression CI results, and setup. The hosted site works with imported JSON and exported reports; local execution needs the Python runner. The previous single-step debugger remains at /legacy.html.

Capture a production boundary

from agent_replay import capture, tool

@tool(boundary_id="orders.lookup", side_effect="read")
def lookup(order_id):
    return your_lookup(order_id)

with capture("refund-agent", input={"order_id": "1042"}, durability="sync") as run:
    result = your_agent(run)
    run.set_output(result)
    if result["amount_minor"] > 3000:
        run.fail("Refund exceeds approval", category="assertion")

A completed execution can still violate a business rule. v2 captures persist journals at boundaries; recover reads a valid prefix after interruption. v1 capture and the original replay_step/replay_agent SDK APIs remain compatible. New async_replay_agent is awaitable in an active event loop.

Run, compare, and test

Register a trusted agent(run) entrypoint in agent-replay.json; see the configuration guide.

agent-replay inspect failure.json
agent-replay doctor failure.json --project agent-replay.json --entrypoint refund
agent-replay run failure.json --project agent-replay.json --spec replay-spec.json
agent-replay compare failure.json candidate.json --output comparison.json
agent-replay case create failure.json --entrypoint refund --output tests/agent_cases/refund.case.json
# Add reviewed business assertions and explicit fixtures to the draft.
agent-replay test tests/agent_cases --project agent-replay.json --report-dir .replay/reports

Reports include JSON, JUnit XML, and standalone HTML. Default CI has no live model calls. A recorded single step cannot make a regression suite pass. Changed/ambiguous inputs stop instead of silently executing real tools. Baselines are accepted explicitly; the original failure is preserved.

Cross-model experiments support non-streaming OpenAI-compatible Chat Completions and native Anthropic text/tool Messages through registered providers. Tool replacements use registered local implementations. run --commit REF actually executes a separate detached worktree with a prepared environment. Live models remain nondeterministic and are opt-in; environment/coverage gaps stay visible.

Guarantees and limits

  • Explicit instrumented boundaries, not automatic capture of every library call.
  • From-start execution, not process checkpoint resume. Trusted project code still runs normally.
  • No real-tool fallback after a mismatch. Frozen outputs are not proofs of business correctness.
  • Checksummed data bundles, best-effort credential redaction, and user redactors. Not complete PII detection.
  • Same-origin loopback API with a session token, one worker, persisted jobs and cancellation.
  • Static hosted UI does not run Python, receive local traces automatically, or store API keys.
  • Provider unit tests use local mock servers. The hosted refund report also includes a small live-model evaluation; production workload overhead and broader provider integration still need environment-specific validation.

Failure-to-Experience: extraction and clustering

Phase A/B adds versioned sidecars, resumable local ingestion, deterministic failure-event clustering, reviewed merge/split controls, and JSON/HTML evidence reports. Existing replay and regression execution stays in place.

agent-replay experience ingest examples/experience/traces --output .replay/failures.json
agent-replay experience cluster .replay/failures.json --labels examples/experience/labels.json --quality-gate

The sample is synthetic; the optional accuracy gate measures supplied labels. See the contracts, interfaces, quality metrics and scope.

Install the Codex plugin from GitHub

Requires Codex and Python 3.10+ for local execution. Add this repository as a marketplace and install the bundled plugin:

codex plugin marketplace add j112929/agent-replay-mvp --ref main
codex plugin add agent-replay@agent-replay-marketplace

Start a new local task after installation. To update after a new release:

codex plugin marketplace upgrade agent-replay-marketplace
codex plugin add agent-replay@agent-replay-marketplace

This is a GitHub marketplace installation, separate from the official public plugin directory. Recorded and fixture replays run without model credentials; live model replay requires your own configured provider credentials.

Development and packaging

python -m pip install -e '.[dev]'
python -m unittest discover -s tests -v
node --test tests/*.test.mjs
python scripts/package_release.py
python scripts/package_release.py --check

dist/ is the canonical web source. Packaging synchronizes sdk/agent_replay/web, public schemas, and the self-contained plugin vendor. Do not edit generated copies. The deterministic source ZIP excludes user traces, credentials, environments, and recursive archives. GitHub workflows run SDK/web tests, the fail/pass/fail story, regression reports, and wheel/plugin smoke checks.

Vercel serves dist/ as a static site using vercel.json. Backend execution stays in the local runner.

Refund Failure-to-Experience acceptance (offline, synthetic):

agent-replay experience refund-demo --directory .replay/refund

This generates and qualifies eleven mutated refund scenarios and verifies the existing regression runner produces fail → pass → fail. See Phases A–F for interfaces and scope.

Evaluate and export the refund evidence with source and verifier qualification:

agent-replay experience evaluate .replay/refund/scenarios.json --report .replay/refund/report.json --directory .replay/refund
agent-replay experience export .replay/refund/scenarios.json --report .replay/refund/report.json --directory .replay/refund --destination .replay/refund-export
agent-replay experience verify-export .replay/refund-export

The export contains qualified evaluated experiences, binary rewards and portable source/witness evidence. Related refund scenarios stay in one split; the single synthetic family cannot establish held-out or RL training improvement.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages