Skip to main content

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

  1. Record -- run your agent normally. Trajectly captures every tool call and LLM response as a trace.
  2. Replay -- re-run the agent. Trajectly replays recorded LLM responses from fixtures so results are deterministic.
  3. 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?
  4. 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

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trajectly-0.3.0rc2.tar.gz (59.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trajectly-0.3.0rc2-py3-none-any.whl (76.5 kB view details)

Uploaded Python 3

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

Hashes for trajectly-0.3.0rc2.tar.gz
Algorithm Hash digest
SHA256 bb397210f4bc677a9c00894bcc8c03da71e025246a02d58ba5afa1566a321ef0
MD5 abf163f85f87204ea8517f97e7842472
BLAKE2b-256 77ea1ef9685f268f7cd800226be859412dc24e65498bc2304d2256309714240d

See more details on using hashes here.

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

Hashes for trajectly-0.3.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 1c3225153a0573fd320e3bf7d2a87361ebcb5037b302dab8ea973396d0da7e29
MD5 1bcbc0bc9ed89fc423eaf4d2e0930704
BLAKE2b-256 6fb46001fdb76f8bfd06d74d16afe0f77adad6074032652e29f4b83b3192c442

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page