Trajectory Refinement Testing (TRT) for deterministic agent CI
Project description
Trajectly
Deterministic regression testing for AI agents. Record a baseline, enforce contracts, catch regressions before they ship.
Install
pip install trajectly
30-Second Example
Trajectly works in three steps: record a known-good baseline, run against it later, and get a verdict.
# Clone the repo to get the examples
git clone https://github.com/trajectly/trajectly.git
cd trajectly
# Install trajectly with example dependencies (openai, gemini)
pip install -e ".[examples]"
# Set your OpenAI key (the example calls gpt-4o-mini)
export OPENAI_API_KEY="sk-..."
# 1. Record the baseline
cd examples
trajectly init
trajectly record specs/trt-support-triage-baseline.agent.yaml
# 2. Run the regression variant against it
trajectly run specs/trt-support-triage-regression.agent.yaml
# 3. See what broke
trajectly report
The report shows exactly which step failed, why (the regression calls unsafe_export, which is denied by policy), and gives you a deterministic repro command.
How It Works
- Record -- run your agent normally. Trajectly captures every tool call and LLM response as a trace.
- Replay -- re-run the agent. Trajectly replays recorded LLM responses from fixtures so results are deterministic.
- Compare -- Trajectly checks the new trace against the baseline:
- Contracts: are only allowed tools called? Are denied tools blocked?
- Refinement: does the new call sequence preserve the baseline sequence?
- Verdict -- PASS or FAIL with the exact failure step (witness index), violation code, and a copy-paste repro command.
Examples
| Example | Provider | Tools | What it tests |
|---|---|---|---|
| Ticket Classifier | OpenAI | fetch_ticket, store_triage |
Simple 2-tool agent with contract enforcement |
| Code Review Bot | Gemini | fetch_pr, lint_code, post_review |
Multi-tool sequence with policy guardrails |
Documentation
- Full documentation -- concepts, CLI reference, spec format, SDK reference
- Tutorial: Ticket Classifier -- step-by-step simple example
- Tutorial: Code Review Bot -- step-by-step medium example
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trajectly-0.3.0rc2.tar.gz.
File metadata
- Download URL: trajectly-0.3.0rc2.tar.gz
- Upload date:
- Size: 59.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb397210f4bc677a9c00894bcc8c03da71e025246a02d58ba5afa1566a321ef0
|
|
| MD5 |
abf163f85f87204ea8517f97e7842472
|
|
| BLAKE2b-256 |
77ea1ef9685f268f7cd800226be859412dc24e65498bc2304d2256309714240d
|
File details
Details for the file trajectly-0.3.0rc2-py3-none-any.whl.
File metadata
- Download URL: trajectly-0.3.0rc2-py3-none-any.whl
- Upload date:
- Size: 76.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c3225153a0573fd320e3bf7d2a87361ebcb5037b302dab8ea973396d0da7e29
|
|
| MD5 |
1bcbc0bc9ed89fc423eaf4d2e0930704
|
|
| BLAKE2b-256 |
6fb46001fdb76f8bfd06d74d16afe0f77adad6074032652e29f4b83b3192c442
|