Trajectory SDK
Generated Python client for the Trajectory API, with high-level workflows for uploading trajectories, telemetry, and runtime-backed benchmarks.
Install
pip install trajectory-sdk
Install the optional agent and Harbor integrations used by the full CLI with:
pip install "trajectory-sdk[cli]"
Quick start
Set TRAJECTORY_API_KEY, then create a client:
from trajectory import Client
client = Client()
benchmarks = client.benchmarks.list(limit=10)
The generated resource methods map directly to the public HTTP API. Higher-level operations that
coordinate multiple API calls are available from trajectory.lib:
from trajectory import Client
from trajectory.lib import ingest_events
client = Client()
result = ingest_events(
client,
[
{
"event_type": "agent.completed",
"session_id": "session-123",
"timestamp": "2026-08-28T00:00:00+00:00",
"properties": {"model": "example-model"},
}
],
)
print(result.ingested, result.skipped)
LiteLLM harnesses
Starting with SDK 0.6.6, an existing LiteLLM harness can use this import for policy calls:
from trajectory.lib.litellm import completion
response = completion(model=model, messages=messages, temperature=1.0)
This always uses the injected Trajectory endpoint and credentials. Messages and tools are unchanged.
Keep user/judge calls on native LiteLLM and retain the original loop and grader, then report their
result with the existing
client.trajectories.log_reward(...) and client.trajectories.complete(...) methods.
Command line
The package installs a handwritten trajectory command that delegates API operations to the same
generated client and high-level workflows:
export TRAJECTORY_API_KEY="tj_key_..."
trajectory trajectories upload trajectories.json --dataset my-dataset
trajectory telemetry ingest events.json
trajectory traces upload trajectories.json --events events.json --dataset my-dataset
trajectory secrets set OPENAI_API_KEY
trajectory secrets list
API-backed commands use a 30-minute timeout by default. Override it with --timeout SECONDS.
The existing repository and benchmark tools remain available from the new CLI package:
trajectory bench validate ./benchmark
trajectory bench push ./benchmark --build-images
trajectory extract harness
Development
uv run pytest
uv run ruff check .
uv run ruff format --check .
The generated client lives in src/trajectory/. Handwritten workflows live in
src/trajectory/lib/, the handwritten CLI lives in cmd/trajectory/cli/trajectory_cli/, and tests live in
tests/.
License
Release files for trajectory-sdk 0.6.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| trajectory_sdk-0.6.12.tar.gz | 113.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trajectory_sdk-0.6.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 301.3 kB
Release files / trajectory_sdk-0.6.12.tar.gz
| Download URL | trajectory_sdk-0.6.12.tar.gz |
|---|---|
| Size | 113.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae990dee1df13babecb88ca9a936327ead9a50a85f494dbb657f91c56e4b51b9
|
|
BLAKE2b-256 checksum How to use checksums |
bebf785cb2b5482062d3aad152377e07dfd115c97b485130aea64903a6ce6a9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / trajectory_sdk-0.6.12-py3-none-any.whl
| Download URL | trajectory_sdk-0.6.12-py3-none-any.whl |
|---|---|
| Size | 187.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23e80178ec134687c3a8e8f38dc023d071836b63fe8e37fcd44c7b6201f9e470
|
|
BLAKE2b-256 checksum How to use checksums |
5a62e8a1dd2376a79f8f323d155b633723143ce4a75e69b4b296bdcdb60a3fee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency log