Skip to main content
Install trajectory-sdk and import Client from trajectory.

Configuration

Run tj login to save a credential for Client(). Saved credentials are bound to their API origin; changing a copied client to a different origin drops inherited credentials. See Authentication for profiles and unattended jobs.

Resources

trajectory.lib provides two forms of the same spec upload workflow: push() calls start_push() and waits with operation.result() internally. Both accept the same arguments. start_push() is a regular Python function; background processing happens on the server. See the spec guide. To edit tasks within an existing spec version, use client.benchmarks.tasks.append(...) followed by client.benchmarks.tasks.commit(...) with that version’s spec ID.

Training and evaluation

Both resources accept create(agent_name=..., benchmark_name=..., base_model_slug=..., options=...) to select the latest spec version under that agent. Pass bench_id instead of the name pair to select a specific version. Finish a baseline/checkpoint comparison before publishing another version under the same name. Use parent_checkpoint_id to resume training or evaluate a checkpoint. Request options dictionaries follow the shared RunOptionsParam type; run responses expose typed RunOptions values. Omitted, null, and empty options preserve defaults.

Discover models and options

Before uploading a spec, use client.training.list_models() or client.evals.list_models() to choose a supported model and estimate token costs. Each response’s items contains base_model_slug, model_name, and pricing.input / pricing.output in USD per million tokens. Training and evaluation can have different models and prices; use the catalog for the mode you plan to run. See pricing for training, grading, sandbox, and other charges.
Use client.training.list_options(...) or client.evals.list_options(...) to discover supported settings for that mode, optionally filtering by base_model_slug. The response’s models contains base_model_slug and an options map with types, bounds, descriptions, and fixed or computed defaults, without pricing. Training and evaluation may have different bounds for the same setting. list_options() also works before a spec exists: bench_id is deprecated and ignored. Training also accepts options={"load_weights_only": True} with parent_checkpoint_id, even though this option isn’t listed. This loads checkpoint weights with fresh training state; see resume from a checkpoint.

Run costs

Use client.billing.list_run_costs() to read run costs:
Costs are in USD cents for the last 30 UTC calendar days. Page with offset and a limit of 1–50 (default 20). Costs may take several minutes to appear after a run finishes and can change as usage is processed. Charges for deleted runs remain listed under the run ID until they fall outside the 30-day window.

Pagination

.items is the current page. Iterating the page fetches the rest.
.has_next_page() and .get_next_page() request the next page yourself.

Raw response