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 and install dev dependencies
git clone https://github.com/trajectly/trajectly.git
cd trajectly
pip install -e ".[dev]"

# Set your OpenAI key (the example calls gpt-4o-mini)
export OPENAI_API_KEY="sk-..."

# 1. Record the baseline
cd examples
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.0rc1.tar.gz (59.4 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.0rc1-py3-none-any.whl (76.5 kB view details)

Uploaded Python 3

File details

Details for the file trajectly-0.3.0rc1.tar.gz.

File metadata

  • Download URL: trajectly-0.3.0rc1.tar.gz
  • Upload date:
  • Size: 59.4 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.0rc1.tar.gz
Algorithm Hash digest
SHA256 1127b86fe7a0b67a3b90dfd818f1791e141e059c973265fa304dc73586899e98
MD5 442570f39db5c3f54dc611e78f6224f7
BLAKE2b-256 07d1e7e4e3bf99360f09ad2e2c94494f47686754242fc21c81d33cb05bf965ed

See more details on using hashes here.

File details

Details for the file trajectly-0.3.0rc1-py3-none-any.whl.

File metadata

  • Download URL: trajectly-0.3.0rc1-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.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 7cc6f0bcedfa1c2a6703ebe93a961d6359ac876c48e0431bdca2ac142f3ffdf4
MD5 c4715e82eb24ff2e8c7b2b5c907b4c28
BLAKE2b-256 540842869be9c862e5597ba95eb787374fd8d1164de0bc5220c91efe2f0e5611

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