Tally

Getting Started

Installation and basic setup for Trajectories.

Installation

pnpm add @tally-evals/trajectories

Peer Dependencies

Trajectories requires the AI SDK and a language model to act as the "user".

pnpm add ai @ai-sdk/google # or another provider

Basic Setup

To run a trajectory, you need three things:

  1. An Agent: Your LLM agent wrapped in a Trajectories wrapper.
  2. A User Model: An AI SDK LanguageModel that will play the role of the user.
  3. A Trajectory Definition: A goal, a persona, and optionally a step graph.

Wrapping your Agent

Trajectories provides built-in wrappers for common frameworks:

import { withAISdkAgent, withMastraAgent } from '@tally-evals/trajectories';

// For AI SDK
const agent = withAISdkAgent(aiSdkAgent);

// For Mastra
const agent = withMastraAgent(mastraAgent);

Running the Trajectory

The runTrajectory function handles the loop between the user model and your agent.

const result = await runTrajectory(trajectory, {
  generateLogs: true, // See the conversation in the console
});

On this page