Metadata-Version: 2.4
Name: conereplay
Version: 0.1.0
Summary: Pre-deploy regression harness for multi-agent AI: cone-bounded divergent replay with counterfactual oracle. Patent pending (US Provisional CDRA-PROV-2026-001).
Author: Naveen Singh Dhillon, Rajvir Singh Dhillon
License: Proprietary
Project-URL: Homepage, https://conereplay.com
Project-URL: Repository, https://github.com/gitdhillonai/conereplay
Keywords: llm,multi-agent,replay,counterfactual,observability,langgraph
Classifier: Development Status :: 4 - Beta
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: networkx>=3.2
Requires-Dist: pydantic>=2.6
Requires-Dist: pydantic-settings>=2.0
Provides-Extra: langgraph
Requires-Dist: langgraph>=0.2; extra == "langgraph"
Requires-Dist: langchain-core>=0.3; extra == "langgraph"
Provides-Extra: providers
Requires-Dist: anthropic>=0.40; extra == "providers"
Requires-Dist: openai>=1.50; extra == "providers"
Provides-Extra: server
Requires-Dist: fastapi>=0.110; extra == "server"
Requires-Dist: uvicorn[standard]>=0.30; extra == "server"
Requires-Dist: sqlalchemy>=2.0; extra == "server"
Requires-Dist: psycopg2-binary>=2.9; extra == "server"
Requires-Dist: redis>=5.0; extra == "server"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: mypy>=1.10; extra == "dev"
Requires-Dist: pip-audit>=2.7; extra == "dev"
Requires-Dist: pre-commit>=3.7; extra == "dev"
Requires-Dist: httpx>=0.27; extra == "dev"
Requires-Dist: fastapi>=0.110; extra == "dev"
Requires-Dist: sqlalchemy>=2.0; extra == "dev"
Requires-Dist: langgraph>=0.2; extra == "dev"
Requires-Dist: langchain-core>=0.3; extra == "dev"
Requires-Dist: anthropic>=0.40; extra == "dev"
Requires-Dist: openai>=1.50; extra == "dev"
Requires-Dist: tiktoken>=0.7; extra == "dev"
Requires-Dist: opentelemetry-api>=1.20; extra == "dev"
Requires-Dist: opentelemetry-sdk>=1.20; extra == "dev"
Provides-Extra: otel
Requires-Dist: opentelemetry-api>=1.20; extra == "otel"
Requires-Dist: opentelemetry-sdk>=1.20; extra == "otel"
Provides-Extra: demo
Requires-Dist: langgraph>=0.2; extra == "demo"
Requires-Dist: langchain-core>=0.3; extra == "demo"
Dynamic: license-file

# ConeReplay

Pre-deploy regression testing for multi-agent AI. Record traces from your
production agent app, propose a change (new prompt, new tool response, new
model), and replay only the events causally affected — everything else is
served byte-identically from the recording.

Patent pending (U.S. Provisional Application **64/043,722**). See
[VERSIONING.md](VERSIONING.md) for SemVer commitments and
[docs/trace-format.md](docs/trace-format.md) for the on-disk contract.

## Install

```bash
pip install conereplay                   # core + CLI
pip install conereplay[server]           # hosted trace-store server
pip install conereplay[langgraph]        # LangGraph recording adapter
pip install conereplay[providers]        # anthropic / openai oracle backends
pip install conereplay[dev]              # dev tooling (pytest, ruff, mypy, pip-audit)
```

Requires Python 3.11+. Core has only two runtime deps (`networkx`,
`pydantic`, `pydantic-settings`).

## CLI quickstart

```bash
# Single-trace replay → Markdown report
conereplay replay \
  --trace examples/trace.json \
  --modify examples/modify.json \
  --report report.md

# Corpus-mode regression harness → aggregate report (Markdown or HTML)
conereplay corpus \
  --traces examples/traces \
  --modify examples/corpus-modify.json \
  --report corpus.html \
  --format html

# Emit a Mermaid or Graphviz diagram of a trace's causal DAG
conereplay diagram \
  --trace examples/trace.json \
  --modify examples/modify.json \
  --format mermaid --out cone.mmd
```

See [docs/cli.md](docs/cli.md) for the full reference.

## Library quickstart

```python
from conereplay import (
    load_trace, ModificationSpec, selective_replay, compute_divergence,
    render_markdown_report,
)

trace = load_trace("trace.json")
mod = ModificationSpec(target_event_id="e3", substituted_output=b"POLICY: 5 days")
divergent = selective_replay(trace, mod)
report = compute_divergence(trace, divergent)
print(render_markdown_report(trace, divergent, mod, report))
```

## Architecture

Four layers. See [ARCHITECTURE.md](ARCHITECTURE.md) for the full picture.

| Layer | Purpose | Modules |
|---|---|---|
| Core algorithms | Deterministic, pure-stdlib | `core/clock.py`, `core/cone.py`, `core/replay.py`, `core/diff.py` |
| SDK | Recording + provenance | `sdk/recorder.py`, `sdk/provenance.py`, `sdk/langgraph.py` |
| Presentation | Reports + diagrams | `core/report.py`, `core/corpus_report.py`, `core/corpus_html.py`, `core/diagram.py` |
| Server | Hosted trace store | `server/app.py`, `server/models.py` |

Supporting infrastructure:

- `config.py` — validated runtime config (pydantic-settings, `CONEREPLAY_*` env)
- `flags.py` — feature flags (`CONEREPLAY_FLAGS_*` env)
- `logging_setup.py` — structured text/JSON logging
- `audit.py` — append-only JSONL audit trail for compliance
- `core/schemas.py` — pydantic contract models for trace + modification JSON

## Configuration

All configuration is env-driven with the `CONEREPLAY_` prefix. Defaults
are safe for local use. Sample overrides:

```bash
export CONEREPLAY_LOG_LEVEL=debug
export CONEREPLAY_LOG_FORMAT=json
export CONEREPLAY_DATA_DIR=/var/lib/conereplay
export CONEREPLAY_AUDIT_LOG_PATH=/var/log/conereplay/audit.jsonl
export CONEREPLAY_ENABLE_AUDIT=true
export CONEREPLAY_SERVER_DATABASE_URL=postgresql://...
```

See [docs/configuration.md](docs/configuration.md) (stub — coming soon) or
`conereplay/config.py` for the full list.

## Testing

```bash
make install-dev    # install runtime + dev deps (pytest, ruff, mypy)
make test           # run full pytest suite
make test-fast      # fail-fast + failed-first
make test-cov       # with coverage report (htmlcov/)
make lint           # ruff
make typecheck      # mypy
```

CI (see [.github/workflows/](.github/workflows/)) runs tests + lint +
typecheck on every push and PR against `main`. Integration tests that
hit real LLM providers are gated behind `CONEREPLAY_INTEGRATION=1`.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).

## Security

See [SECURITY.md](SECURITY.md) for supply-chain posture and vulnerability
disclosure. Patent-pending proprietary code; see [LICENSE](LICENSE).

## Runbooks

Operational procedures live in [runbooks/](runbooks/):

- [deployment.md](runbooks/deployment.md) — releases + migrations
- [on-call.md](runbooks/on-call.md) — incident triage
- [disaster-recovery.md](runbooks/disaster-recovery.md) — backups + restore

## Documentation
<!-- generated-by: workspace-admin/doc-standardize -->
- [Handoff](docs/HANDOFF.md)
- [Backlog](docs/BACKLOG.md)
- [Architecture](docs/ARCHITECTURE.md)
- [Local Development](docs/LOCAL_DEVELOPMENT.md)
- [Testing](docs/TESTING.md)
- [Infrastructure](docs/INFRASTRUCTURE.md)
- [Roadmap](docs/ROADMAP.md)
- [Architecture Decisions](docs/decisions/)


## Evidence and sample

- [Sanitized end-to-end migration sample](examples/sanitized_migration/README.md)
- [Reproducible attribution configuration](examples/sanitized_migration/bisect.json)
- [Replay benchmark methodology](docs/BENCHMARKS.md)

The sample is synthetic and labels fixture measurements separately from live-provider evidence.
