tracereplay 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tracereplay-0.1.0/.gitattributes +10 -0
- tracereplay-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +90 -0
- tracereplay-0.1.0/.github/ISSUE_TEMPLATE/config.yml +10 -0
- tracereplay-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +34 -0
- tracereplay-0.1.0/.github/README1.md +33 -0
- tracereplay-0.1.0/.github/dependabot.yml +20 -0
- tracereplay-0.1.0/.github/workflows/ci.yml +91 -0
- tracereplay-0.1.0/.gitignore +44 -0
- tracereplay-0.1.0/CHANGELOG.md +65 -0
- tracereplay-0.1.0/CODE_OF_CONDUCT.md +40 -0
- tracereplay-0.1.0/CONTRIBUTING.md +81 -0
- tracereplay-0.1.0/Docs/TraceRelay BluPrint.txt +1032 -0
- tracereplay-0.1.0/Docs/TraceReplay_Implementation_Plan.md +501 -0
- tracereplay-0.1.0/LICENSE +21 -0
- tracereplay-0.1.0/PKG-INFO +442 -0
- tracereplay-0.1.0/README.md +398 -0
- tracereplay-0.1.0/SECURITY.md +50 -0
- tracereplay-0.1.0/SUPPORT.md +27 -0
- tracereplay-0.1.0/examples/01_quickstart_openai.py +148 -0
- tracereplay-0.1.0/examples/02_pytest_workflow/test_weather_bot.py +91 -0
- tracereplay-0.1.0/examples/03_autonomous_agent_tools.py +199 -0
- tracereplay-0.1.0/examples/04_multi_provider.py +96 -0
- tracereplay-0.1.0/examples/05_quickstart_groq.py +162 -0
- tracereplay-0.1.0/examples/06_token_cost_guardrails.py +179 -0
- tracereplay-0.1.0/examples/07_semantic_drift_detection.py +163 -0
- tracereplay-0.1.0/examples/08_deterministic_clock_freeze_time.py +125 -0
- tracereplay-0.1.0/examples/README.md +117 -0
- tracereplay-0.1.0/image-1.png +0 -0
- tracereplay-0.1.0/image.png +0 -0
- tracereplay-0.1.0/pyproject.toml +145 -0
- tracereplay-0.1.0/requirements-dev.txt +6 -0
- tracereplay-0.1.0/requirements.txt +3 -0
- tracereplay-0.1.0/src/tracereplay/__init__.py +240 -0
- tracereplay-0.1.0/src/tracereplay/__main__.py +8 -0
- tracereplay-0.1.0/src/tracereplay/agent/__init__.py +13 -0
- tracereplay-0.1.0/src/tracereplay/agent/tool_recorder.py +213 -0
- tracereplay-0.1.0/src/tracereplay/agent/tracker.py +192 -0
- tracereplay-0.1.0/src/tracereplay/chaos/__init__.py +193 -0
- tracereplay-0.1.0/src/tracereplay/chaos/engine.py +450 -0
- tracereplay-0.1.0/src/tracereplay/chaos/models.py +89 -0
- tracereplay-0.1.0/src/tracereplay/chaos/native.py +136 -0
- tracereplay-0.1.0/src/tracereplay/cli.py +196 -0
- tracereplay-0.1.0/src/tracereplay/clock/__init__.py +18 -0
- tracereplay-0.1.0/src/tracereplay/clock/engine.py +264 -0
- tracereplay-0.1.0/src/tracereplay/clock/models.py +86 -0
- tracereplay-0.1.0/src/tracereplay/config.py +144 -0
- tracereplay-0.1.0/src/tracereplay/core/__init__.py +13 -0
- tracereplay-0.1.0/src/tracereplay/core/recorder.py +84 -0
- tracereplay-0.1.0/src/tracereplay/core/replayer.py +287 -0
- tracereplay-0.1.0/src/tracereplay/core/session.py +451 -0
- tracereplay-0.1.0/src/tracereplay/exceptions.py +348 -0
- tracereplay-0.1.0/src/tracereplay/guardrails/__init__.py +78 -0
- tracereplay-0.1.0/src/tracereplay/guardrails/engine.py +345 -0
- tracereplay-0.1.0/src/tracereplay/guardrails/models.py +137 -0
- tracereplay-0.1.0/src/tracereplay/guardrails/pricing.py +121 -0
- tracereplay-0.1.0/src/tracereplay/matcher/__init__.py +14 -0
- tracereplay-0.1.0/src/tracereplay/matcher/diff.py +29 -0
- tracereplay-0.1.0/src/tracereplay/matcher/normalizer.py +106 -0
- tracereplay-0.1.0/src/tracereplay/matcher/rules.py +181 -0
- tracereplay-0.1.0/src/tracereplay/models.py +207 -0
- tracereplay-0.1.0/src/tracereplay/providers/__init__.py +74 -0
- tracereplay-0.1.0/src/tracereplay/providers/anthropic.py +221 -0
- tracereplay-0.1.0/src/tracereplay/providers/base.py +34 -0
- tracereplay-0.1.0/src/tracereplay/providers/gemini.py +241 -0
- tracereplay-0.1.0/src/tracereplay/providers/generic.py +70 -0
- tracereplay-0.1.0/src/tracereplay/providers/groq.py +23 -0
- tracereplay-0.1.0/src/tracereplay/providers/mistral.py +211 -0
- tracereplay-0.1.0/src/tracereplay/providers/openai.py +240 -0
- tracereplay-0.1.0/src/tracereplay/providers/patcher.py +353 -0
- tracereplay-0.1.0/src/tracereplay/py.typed +0 -0
- tracereplay-0.1.0/src/tracereplay/pytest_plugin.py +252 -0
- tracereplay-0.1.0/src/tracereplay/sanitizer.py +82 -0
- tracereplay-0.1.0/src/tracereplay/semantic/__init__.py +47 -0
- tracereplay-0.1.0/src/tracereplay/semantic/diff.py +91 -0
- tracereplay-0.1.0/src/tracereplay/semantic/engine.py +249 -0
- tracereplay-0.1.0/src/tracereplay/semantic/models.py +161 -0
- tracereplay-0.1.0/src/tracereplay/semantic/similarity.py +132 -0
- tracereplay-0.1.0/src/tracereplay/storage/__init__.py +12 -0
- tracereplay-0.1.0/src/tracereplay/storage/json_storage.py +130 -0
- tracereplay-0.1.0/src/tracereplay/storage/resolver.py +60 -0
- tracereplay-0.1.0/tests/__init__.py +1 -0
- tracereplay-0.1.0/tests/conftest.py +11 -0
- tracereplay-0.1.0/tests/integration/__init__.py +1 -0
- tracereplay-0.1.0/tests/integration/test_provider_switching.py +149 -0
- tracereplay-0.1.0/tests/unit/__init__.py +1 -0
- tracereplay-0.1.0/tests/unit/test_agent.py +362 -0
- tracereplay-0.1.0/tests/unit/test_chaos.py +497 -0
- tracereplay-0.1.0/tests/unit/test_cli.py +145 -0
- tracereplay-0.1.0/tests/unit/test_clock.py +276 -0
- tracereplay-0.1.0/tests/unit/test_config.py +75 -0
- tracereplay-0.1.0/tests/unit/test_core_engines.py +117 -0
- tracereplay-0.1.0/tests/unit/test_exceptions.py +80 -0
- tracereplay-0.1.0/tests/unit/test_forking.py +580 -0
- tracereplay-0.1.0/tests/unit/test_guardrails.py +571 -0
- tracereplay-0.1.0/tests/unit/test_matcher.py +231 -0
- tracereplay-0.1.0/tests/unit/test_models.py +159 -0
- tracereplay-0.1.0/tests/unit/test_phase9_providers.py +367 -0
- tracereplay-0.1.0/tests/unit/test_providers.py +376 -0
- tracereplay-0.1.0/tests/unit/test_pytest_plugin.py +366 -0
- tracereplay-0.1.0/tests/unit/test_sanitizer.py +85 -0
- tracereplay-0.1.0/tests/unit/test_semantic.py +552 -0
- tracereplay-0.1.0/tests/unit/test_storage.py +114 -0
- tracereplay-0.1.0/tests/unit/test_version.py +27 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Report a bug or unexpected behaviour in TraceReplay.
|
|
3
|
+
title: "[BUG] "
|
|
4
|
+
labels:
|
|
5
|
+
- bug
|
|
6
|
+
body:
|
|
7
|
+
- type: markdown
|
|
8
|
+
attributes:
|
|
9
|
+
value: |
|
|
10
|
+
Thanks for reporting a bug. Please remove API keys, tokens,
|
|
11
|
+
passwords, and private prompts from all information you share.
|
|
12
|
+
|
|
13
|
+
- type: input
|
|
14
|
+
id: version
|
|
15
|
+
attributes:
|
|
16
|
+
label: TraceReplay version
|
|
17
|
+
placeholder: "0.1.0 or commit hash"
|
|
18
|
+
validations:
|
|
19
|
+
required: true
|
|
20
|
+
|
|
21
|
+
- type: input
|
|
22
|
+
id: python-version
|
|
23
|
+
attributes:
|
|
24
|
+
label: Python version
|
|
25
|
+
placeholder: "Python 3.12"
|
|
26
|
+
validations:
|
|
27
|
+
required: true
|
|
28
|
+
|
|
29
|
+
- type: dropdown
|
|
30
|
+
id: component
|
|
31
|
+
attributes:
|
|
32
|
+
label: Affected component
|
|
33
|
+
options:
|
|
34
|
+
- Recording
|
|
35
|
+
- Replay engine
|
|
36
|
+
- Request matching
|
|
37
|
+
- Tool calls
|
|
38
|
+
- Fixture storage
|
|
39
|
+
- pytest integration
|
|
40
|
+
- Provider integration
|
|
41
|
+
- Documentation
|
|
42
|
+
- Other
|
|
43
|
+
validations:
|
|
44
|
+
required: true
|
|
45
|
+
|
|
46
|
+
- type: textarea
|
|
47
|
+
id: description
|
|
48
|
+
attributes:
|
|
49
|
+
label: Bug description
|
|
50
|
+
description: Explain what happened.
|
|
51
|
+
validations:
|
|
52
|
+
required: true
|
|
53
|
+
|
|
54
|
+
- type: textarea
|
|
55
|
+
id: reproduction
|
|
56
|
+
attributes:
|
|
57
|
+
label: Steps to reproduce
|
|
58
|
+
placeholder: |
|
|
59
|
+
1. Configure TraceReplay...
|
|
60
|
+
2. Record an interaction...
|
|
61
|
+
3. Run replay...
|
|
62
|
+
validations:
|
|
63
|
+
required: true
|
|
64
|
+
|
|
65
|
+
- type: textarea
|
|
66
|
+
id: expected
|
|
67
|
+
attributes:
|
|
68
|
+
label: Expected behaviour
|
|
69
|
+
validations:
|
|
70
|
+
required: true
|
|
71
|
+
|
|
72
|
+
- type: textarea
|
|
73
|
+
id: actual
|
|
74
|
+
attributes:
|
|
75
|
+
label: Actual behaviour
|
|
76
|
+
validations:
|
|
77
|
+
required: true
|
|
78
|
+
|
|
79
|
+
- type: textarea
|
|
80
|
+
id: logs
|
|
81
|
+
attributes:
|
|
82
|
+
label: Error messages or logs
|
|
83
|
+
description: Remove all secrets and sensitive data before posting.
|
|
84
|
+
render: shell
|
|
85
|
+
|
|
86
|
+
- type: textarea
|
|
87
|
+
id: environment
|
|
88
|
+
attributes:
|
|
89
|
+
label: Additional environment information
|
|
90
|
+
placeholder: Operating system, provider, configuration, etc.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
blank_issues_enabled: false
|
|
2
|
+
|
|
3
|
+
contact_links:
|
|
4
|
+
- name: Security vulnerability
|
|
5
|
+
url: https://github.com/rakshithkumar608/TraceReplay/security/advisories/new
|
|
6
|
+
about: Report security vulnerabilities privately.
|
|
7
|
+
|
|
8
|
+
- name: Questions and discussions
|
|
9
|
+
url: https://github.com/rakshithkumar608/TraceReplay/discussions
|
|
10
|
+
about: Ask questions or discuss ideas with the community.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
Describe what this pull request changes.
|
|
4
|
+
|
|
5
|
+
## Related issue
|
|
6
|
+
|
|
7
|
+
Closes #
|
|
8
|
+
|
|
9
|
+
## Changes made
|
|
10
|
+
|
|
11
|
+
-
|
|
12
|
+
-
|
|
13
|
+
-
|
|
14
|
+
|
|
15
|
+
## Type of change
|
|
16
|
+
|
|
17
|
+
- [ ] Bug fix
|
|
18
|
+
- [ ] New feature
|
|
19
|
+
- [ ] Breaking change
|
|
20
|
+
- [ ] Documentation update
|
|
21
|
+
- [ ] Refactoring
|
|
22
|
+
- [ ] Performance improvement
|
|
23
|
+
- [ ] Tests
|
|
24
|
+
|
|
25
|
+
## Testing
|
|
26
|
+
|
|
27
|
+
- [ ] Existing tests pass.
|
|
28
|
+
- [ ] New tests have been added where needed.
|
|
29
|
+
- [ ] I tested the changes locally.
|
|
30
|
+
|
|
31
|
+
Commands used:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Add test commands here
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# GitHub Repository Configuration
|
|
2
|
+
|
|
3
|
+
This directory contains GitHub repository automation and contribution templates.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- `ISSUE_TEMPLATE/bug_report.yml`
|
|
8
|
+
- Standardized bug reports.
|
|
9
|
+
|
|
10
|
+
- `ISSUE_TEMPLATE/feature_request.yml`
|
|
11
|
+
- Standardized feature requests.
|
|
12
|
+
|
|
13
|
+
- `ISSUE_TEMPLATE/config.yml`
|
|
14
|
+
- Issue configuration and community links.
|
|
15
|
+
|
|
16
|
+
- `PULL_REQUEST_TEMPLATE.md`
|
|
17
|
+
- Pull request checklist.
|
|
18
|
+
|
|
19
|
+
- `dependabot.yml`
|
|
20
|
+
- Automated dependency update configuration.
|
|
21
|
+
|
|
22
|
+
## Dependency updates
|
|
23
|
+
|
|
24
|
+
Dependabot checks Python dependencies and GitHub Actions weekly.
|
|
25
|
+
|
|
26
|
+
Python dependency updates will become useful once the project package
|
|
27
|
+
configuration is added.
|
|
28
|
+
|
|
29
|
+
## Continuous integration
|
|
30
|
+
|
|
31
|
+
GitHub Actions CI will be configured after the initial Python SDK
|
|
32
|
+
structure and `pyproject.toml` are created. This ensures CI runs
|
|
33
|
+
actual project tests and checks.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
version: 2
|
|
4
|
+
|
|
5
|
+
updates:
|
|
6
|
+
- package-ecosystem: pip
|
|
7
|
+
directory: /
|
|
8
|
+
schedule:
|
|
9
|
+
interval: weekly
|
|
10
|
+
labels:
|
|
11
|
+
- dependencies
|
|
12
|
+
- python
|
|
13
|
+
|
|
14
|
+
- package-ecosystem: github-actions
|
|
15
|
+
directory: /
|
|
16
|
+
schedule:
|
|
17
|
+
interval: weekly
|
|
18
|
+
labels:
|
|
19
|
+
- dependencies
|
|
20
|
+
- ci
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
lint-and-typecheck:
|
|
15
|
+
name: Lint & Typecheck
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout code
|
|
19
|
+
uses: actions/checkout@v7
|
|
20
|
+
|
|
21
|
+
- name: Set up Python 3.12
|
|
22
|
+
uses: actions/setup-python@v7
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.12"
|
|
25
|
+
cache: "pip"
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: |
|
|
29
|
+
python -m pip install --upgrade pip
|
|
30
|
+
pip install -e ".[dev]"
|
|
31
|
+
|
|
32
|
+
- name: Run Ruff Lint
|
|
33
|
+
run: ruff check .
|
|
34
|
+
|
|
35
|
+
- name: Run Ruff Format Check
|
|
36
|
+
run: ruff format --check .
|
|
37
|
+
|
|
38
|
+
- name: Run Mypy Typecheck
|
|
39
|
+
run: mypy src tests
|
|
40
|
+
|
|
41
|
+
test:
|
|
42
|
+
name: Test (Python ${{ matrix.python-version }} on ${{ matrix.os }})
|
|
43
|
+
needs: lint-and-typecheck
|
|
44
|
+
runs-on: ${{ matrix.os }}
|
|
45
|
+
strategy:
|
|
46
|
+
fail-fast: false
|
|
47
|
+
matrix:
|
|
48
|
+
os: [ubuntu-latest, windows-latest]
|
|
49
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
50
|
+
|
|
51
|
+
steps:
|
|
52
|
+
- name: Checkout code
|
|
53
|
+
uses: actions/checkout@v7
|
|
54
|
+
|
|
55
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
56
|
+
uses: actions/setup-python@v7
|
|
57
|
+
with:
|
|
58
|
+
python-version: ${{ matrix.python-version }}
|
|
59
|
+
cache: "pip"
|
|
60
|
+
|
|
61
|
+
- name: Install package & test dependencies
|
|
62
|
+
run: |
|
|
63
|
+
python -m pip install --upgrade pip
|
|
64
|
+
pip install -e ".[dev]"
|
|
65
|
+
|
|
66
|
+
- name: Run Pytest
|
|
67
|
+
run: pytest -v --strict-markers
|
|
68
|
+
|
|
69
|
+
build-check:
|
|
70
|
+
name: Build & Package Check
|
|
71
|
+
needs: lint-and-typecheck
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
steps:
|
|
74
|
+
- name: Checkout code
|
|
75
|
+
uses: actions/checkout@v7
|
|
76
|
+
|
|
77
|
+
- name: Set up Python 3.12
|
|
78
|
+
uses: actions/setup-python@v7
|
|
79
|
+
with:
|
|
80
|
+
python-version: "3.12"
|
|
81
|
+
|
|
82
|
+
- name: Install build tools
|
|
83
|
+
run: |
|
|
84
|
+
python -m pip install --upgrade pip
|
|
85
|
+
pip install build twine
|
|
86
|
+
|
|
87
|
+
- name: Build package distributions
|
|
88
|
+
run: python -m build
|
|
89
|
+
|
|
90
|
+
- name: Check package metadata with twine
|
|
91
|
+
run: twine check dist/*
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Distribution / packaging
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
|
|
11
|
+
# Virtual Environments
|
|
12
|
+
.venv/
|
|
13
|
+
venv/
|
|
14
|
+
env/
|
|
15
|
+
ENV/
|
|
16
|
+
|
|
17
|
+
# Testing, Linting & Type Checking caches
|
|
18
|
+
.pytest_cache/
|
|
19
|
+
.mypy_cache/
|
|
20
|
+
.ruff_cache/
|
|
21
|
+
.coverage
|
|
22
|
+
htmlcov/
|
|
23
|
+
|
|
24
|
+
# Staging & Scratch Directories (Protected staging area for phases)
|
|
25
|
+
staging/
|
|
26
|
+
staging_phase1/
|
|
27
|
+
.staging/
|
|
28
|
+
|
|
29
|
+
# Local Environment Variables & Secrets
|
|
30
|
+
.env
|
|
31
|
+
.env.local
|
|
32
|
+
*.local
|
|
33
|
+
|
|
34
|
+
# IDE & Editor files
|
|
35
|
+
.vscode/
|
|
36
|
+
.idea/
|
|
37
|
+
*.swp
|
|
38
|
+
*.swo
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# Local Assets & Scratch Directories
|
|
42
|
+
assets/
|
|
43
|
+
scratch/
|
|
44
|
+
.tracereplay/
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to TraceReplay will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-11-05
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
#### Milestone 1: Core Foundation & Deterministic Replay Engine
|
|
15
|
+
- **Core Domain Models:** High-performance immutable models (`SessionRecord`, `Interaction`, `RequestPayload`, `ResponsePayload`, `TokenUsage`, `ToolCallRecord`).
|
|
16
|
+
- **Atomic JSON Storage Engine:** ACID-safe atomic JSON writes, schema validation, and path traversal protection.
|
|
17
|
+
- **Deterministic Request Normalizer & Matcher:** Semantic whitespace normalizer, dictionary key sorting, parameter filtering, and unified diff output.
|
|
18
|
+
- **Strict Zero-Live-Fallback Guarantee:** Replay mode strictly halts with `RequestMismatchError` or `LiveFallbackProhibitedError` on any discrepancy—guaranteeing zero silent cloud API bills.
|
|
19
|
+
- **Automated PII & Secret Sanitizer:** Automatic redaction of sensitive credentials (`sk-...`, `gsk_...`, bearer tokens, authorization headers) before persisting fixtures.
|
|
20
|
+
- **Universal Provider Interceptors:** Out-of-the-box adapters for OpenAI (`openai.OpenAI`), Groq (`groq.Groq`), Anthropic Claude (`anthropic.Anthropic`), Google Gemini (`google.genai`), DeepSeek, and local Ollama.
|
|
21
|
+
- **Native Pytest Plugin:**
|
|
22
|
+
- Registered under Pytest `pytest11` entrypoint (`pytest_plugin.py`).
|
|
23
|
+
- `@pytest.mark.trace_replay` marker with custom fixture naming and parameterization support.
|
|
24
|
+
- Auto-injected fixtures: `tracereplay_session` and `tracereplay_patch`.
|
|
25
|
+
- Autonomous `AUTO` mode: Records missing fixtures on first run; deterministically replays on all subsequent runs.
|
|
26
|
+
|
|
27
|
+
#### Milestone 2: Multi-Turn Agent & Complex Tool-Call Recording (Phase 8)
|
|
28
|
+
- **`AgentTracker` Execution Graph:** Models complex agent workflows as stateful decision graphs (`User Input -> LLM Decision -> Tool Execution -> Tool Result -> Next Decision -> Final Answer`).
|
|
29
|
+
- **Visual Graph Generator:** `AgentTracker.visualize_flow()` producing human-readable ASCII decision trees for debugging agent reasoning.
|
|
30
|
+
- **`@record_tool` Interception Decorator:**
|
|
31
|
+
- Wraps synchronous and asynchronous local Python functions.
|
|
32
|
+
- Captures argument signatures and execution durations.
|
|
33
|
+
- **Replay Bypass:** In `REPLAY` mode, completely bypasses the real Python function and returns recorded fixture data deterministically.
|
|
34
|
+
- **Sequential Tool Call Verification:** Strict index-based tool matching preventing out-of-order execution during agent reasoning loops.
|
|
35
|
+
|
|
36
|
+
#### Milestone 2: Multi-Provider Expansion & Universal Model Switching (Phase 9)
|
|
37
|
+
- **Official Mistral AI Adapter (`MistralAdapter`):**
|
|
38
|
+
- Dedicated adapter for modern `mistralai>=1.0.0` SDK (`Mistral` client).
|
|
39
|
+
- Intercepts synchronous `client.chat.complete` and asynchronous `client.chat.complete_async`.
|
|
40
|
+
- Normalizes Mistral messages, tool calls, and token usage statistics.
|
|
41
|
+
- Reconstructs native-compatible `MistralChatCompletionResponse` during deterministic replay.
|
|
42
|
+
- **Generic OpenAI-Compatible Adapter (`GenericOpenAIAdapter`):**
|
|
43
|
+
- Universal adapter for self-hosted and local inference engines: Ollama (`:11434`), vLLM (`:8000`), LM Studio (`:1234`), and LocalAI (`:8080`).
|
|
44
|
+
- Ephemeral parameter sanitization stripping server-specific flags (`num_ctx`, `keep_alive`, `options`, `repetition_penalty`, `top_k`) ensuring environment-agnostic deterministic fixture hashing.
|
|
45
|
+
- **Enhanced Anthropic Claude Adapter:**
|
|
46
|
+
- Full tool use roundtrip support (`tools`, `tool_choice`, `tool_use`, and `tool_result` content blocks).
|
|
47
|
+
- Reconstructs `AnthropicMessageResponse` populated with `AnthropicToolUseBlock` instances and `stop_reason="tool_use"`.
|
|
48
|
+
- **Enhanced Google Gemini Adapter:**
|
|
49
|
+
- Function calling and tool definition extraction (`function_declarations`).
|
|
50
|
+
- Reconstructs `GeminiFunctionCall` within candidate parts and provides ergonomic `.function_calls` property.
|
|
51
|
+
- **Universal Dynamic Provider Auto-Patcher:**
|
|
52
|
+
- Dynamic resolution for Mistral, Generic, Anthropic, Gemini, Groq, DeepSeek, and Ollama based on client types, base URL ports, and explicit hints.
|
|
53
|
+
- **Cross-Provider Model Switching Suite:**
|
|
54
|
+
- Unit and integration tests demonstrating seamless runtime swapping across 5 distinct LLM providers with identical assertions and zero live fallback.
|
|
55
|
+
|
|
56
|
+
#### Open-Source SDK Polish (Option A)
|
|
57
|
+
- **GitHub Actions CI Matrix:** Multi-OS (Ubuntu, Windows) automated testing across Python `3.10`, `3.11`, `3.12`, and `3.13` with strict `ruff` linting, `mypy` strict type-checking, and `twine` packaging checks.
|
|
58
|
+
- **Interactive Runnable Examples (`examples/`):**
|
|
59
|
+
- `01_quickstart_openai.py`: Hybrid real/simulated OpenAI recording and sub-5ms replay.
|
|
60
|
+
- `02_pytest_workflow/test_weather_bot.py`: Complete Pytest test suite.
|
|
61
|
+
- `03_autonomous_agent_tools.py`: Multi-turn autonomous agent with frozen local tool functions.
|
|
62
|
+
- `04_multi_provider.py`: Normalized cross-provider pipeline.
|
|
63
|
+
- `05_quickstart_groq.py`: Verified live Groq LPU inference recording and playback.
|
|
64
|
+
- `examples/README.md`: Quickstart cheat-sheet for running all examples.
|
|
65
|
+
- **Production-Grade Documentation:** High-impact landing page in `README.md` with badges, value proposition, quickstarts, and security guidelines.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our commitment
|
|
4
|
+
|
|
5
|
+
TraceReplay aims to provide a welcoming and respectful environment for everyone who participates in the project.
|
|
6
|
+
|
|
7
|
+
We are committed to making participation free from harassment and discrimination, regardless of experience level, background, identity, or personal characteristics.
|
|
8
|
+
|
|
9
|
+
## Expected behavior
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment include:
|
|
12
|
+
|
|
13
|
+
- Being respectful and considerate.
|
|
14
|
+
- Giving and receiving constructive feedback.
|
|
15
|
+
- Explaining disagreements without personal attacks.
|
|
16
|
+
- Respecting different viewpoints and experience levels.
|
|
17
|
+
- Focusing criticism on ideas, code, and technical decisions.
|
|
18
|
+
- Helping keep discussions clear and welcoming.
|
|
19
|
+
|
|
20
|
+
## Unacceptable behavior
|
|
21
|
+
|
|
22
|
+
Unacceptable behavior includes harassment, insults, intimidation, discriminatory language, deliberate disruption, personal attacks, and publishing another person's private information without permission.
|
|
23
|
+
|
|
24
|
+
## Scope
|
|
25
|
+
|
|
26
|
+
This code applies in project spaces, including Issues, Pull Requests, Discussions, and other project-related communication.
|
|
27
|
+
|
|
28
|
+
## Reporting
|
|
29
|
+
|
|
30
|
+
Report conduct that violates this policy to the project maintainers through the contact method listed in the repository profile. Please include relevant context and links where possible.
|
|
31
|
+
|
|
32
|
+
Maintainers will review reports fairly and take appropriate action. Reports will be handled as privately as practical.
|
|
33
|
+
|
|
34
|
+
## Enforcement
|
|
35
|
+
|
|
36
|
+
Project maintainers may edit or remove inappropriate content, close discussions, or restrict participation when necessary. Maintainers are expected to apply these standards consistently.
|
|
37
|
+
|
|
38
|
+
## Attribution
|
|
39
|
+
|
|
40
|
+
This document is adapted from the Contributor Covenant framework. The project may adopt a specific Contributor Covenant version as its community grows.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Contributing to TraceReplay
|
|
2
|
+
|
|
3
|
+
Thank you for considering a contribution to TraceReplay.
|
|
4
|
+
|
|
5
|
+
TraceReplay is an early-stage open-source project. The goal is to make testing LLM-powered applications more repeatable through recording, fixture storage, and replay.
|
|
6
|
+
|
|
7
|
+
## Before you start
|
|
8
|
+
|
|
9
|
+
1. Read the project [README](README.md).
|
|
10
|
+
2. Check existing Issues and Pull Requests to avoid duplicate work.
|
|
11
|
+
3. For a significant feature or architectural change, open an Issue first and discuss the proposed approach.
|
|
12
|
+
4. Keep contributions focused. A small, well-tested change is easier to review.
|
|
13
|
+
|
|
14
|
+
## Contribution areas
|
|
15
|
+
|
|
16
|
+
Potential contribution areas include:
|
|
17
|
+
|
|
18
|
+
- Core interaction models and configuration.
|
|
19
|
+
- Fixture serialization, loading, and validation.
|
|
20
|
+
- Recording and replay behavior.
|
|
21
|
+
- Request matching.
|
|
22
|
+
- Provider adapters.
|
|
23
|
+
- Tool-call capture and replay.
|
|
24
|
+
- pytest integration.
|
|
25
|
+
- Documentation and examples.
|
|
26
|
+
- Dashboard and platform work, when those components are opened for contribution.
|
|
27
|
+
|
|
28
|
+
Do not claim support for a provider or API operation unless it has been implemented and tested.
|
|
29
|
+
|
|
30
|
+
## Development principles
|
|
31
|
+
|
|
32
|
+
- Local SDK use must not require a hosted TraceReplay account.
|
|
33
|
+
- Replay mode must not silently call a live provider when a fixture is missing.
|
|
34
|
+
- Errors should explain what failed and provide useful debugging context.
|
|
35
|
+
- Avoid storing API keys, authorization headers, or other secrets.
|
|
36
|
+
- Preserve provider-specific data when normalization would otherwise discard meaningful information.
|
|
37
|
+
- Add tests for behavior changes and regression fixes.
|
|
38
|
+
- Keep public APIs and documentation aligned.
|
|
39
|
+
|
|
40
|
+
## Pull request process
|
|
41
|
+
|
|
42
|
+
1. Create a branch for your change.
|
|
43
|
+
2. Make the smallest coherent change that solves the issue.
|
|
44
|
+
3. Add or update tests.
|
|
45
|
+
4. Run the relevant test, lint, formatting, and type-check commands documented by the project.
|
|
46
|
+
5. Update documentation when behavior or public APIs change.
|
|
47
|
+
6. Open a Pull Request describing the problem, solution, and tests performed.
|
|
48
|
+
7. Link the related Issue when applicable.
|
|
49
|
+
|
|
50
|
+
Do not mark checks as passing unless you have run them successfully.
|
|
51
|
+
|
|
52
|
+
## Commit messages
|
|
53
|
+
|
|
54
|
+
Use clear, descriptive commit messages. A conventional format is recommended:
|
|
55
|
+
|
|
56
|
+
- `feat: add fixture validation`
|
|
57
|
+
- `fix: prevent live fallback during replay`
|
|
58
|
+
- `docs: clarify provider setup`
|
|
59
|
+
- `test: cover request matching`
|
|
60
|
+
- `refactor: simplify interaction model`
|
|
61
|
+
|
|
62
|
+
## Issues
|
|
63
|
+
|
|
64
|
+
When opening a bug report, include:
|
|
65
|
+
|
|
66
|
+
- TraceReplay version or commit.
|
|
67
|
+
- Python version and operating system.
|
|
68
|
+
- Minimal reproduction steps.
|
|
69
|
+
- Expected behavior.
|
|
70
|
+
- Actual behavior.
|
|
71
|
+
- Relevant error output, with secrets and private data removed.
|
|
72
|
+
|
|
73
|
+
For feature requests, explain the use case and the behavior you expect.
|
|
74
|
+
|
|
75
|
+
## Security
|
|
76
|
+
|
|
77
|
+
Never include API keys, tokens, customer data, private prompts, or unredacted production recordings in Issues, Pull Requests, or test fixtures. For vulnerabilities, follow [SECURITY.md](SECURITY.md).
|
|
78
|
+
|
|
79
|
+
## Code of conduct
|
|
80
|
+
|
|
81
|
+
By participating, you agree to follow the expectations in [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
|