---
title: TrajectoryExpectation
framework: evaluations
role: symbol
role_heading: Structure
path: evaluations/trajectoryexpectation
---

# TrajectoryExpectation

The expected pattern of tool calls for an evaluation.

## Declaration

```swift
struct TrajectoryExpectation
```

## Mentioned in

Evaluating tool-calling behavior Evaluating language model responses

## Overview

Overview TrajectoryExpectation(ordered: [     ToolExpectation("authenticate"),     ToolExpectation("processResults"), ]) TrajectoryExpectation specifies expected tool-calling behavior across three axes: Ordered: Tool calls that must occur in a specific sequence. Use ToolExpectation for single sequential steps, or anyOrder(_:) when multiple tools must all be called at a given position but their relative order doesn’t matter. Unordered: Tool calls that must occur at some point, regardless of when. Disallowed: Tool calls that must NOT occur. TrajectoryExpectation(ordered: [     ToolExpectation("authenticate"),     ToolExpectation("processResults"), ]) TrajectoryExpectation(ordered: [     ToolExpectation("authenticate"),     .anyOrder([         ToolExpectation("fetchData"),         ToolExpectation("fetchMetadata"),     ]),     ToolExpectation("processResults"), ], allowsAdditionalToolCalls: false) TrajectoryExpectation(     ordered: [         ToolExpectation("findActivities"),         ToolExpectation("estimateTravelTime"),     ],     unordered: [ToolExpectation("getWeather")],     disallowed: [ToolExpectation("deleteData")] ) TrajectoryExpectation(expected: "getWeather", arguments: [     .exact(argumentName: "location", value: "Paris, France") ])

## Topics

### Creating a single-tool expectation

- [init(expected:arguments:)](evaluations/trajectoryexpectation/init(expected:arguments:).md)
- [ToolExpectation](evaluations/toolexpectation.md)

### Creating multi-tool expectations

- [init(ordered:unordered:allowsAdditionalToolCalls:)](evaluations/trajectoryexpectation/init(ordered:unordered:allowsadditionaltoolcalls:).md)
- [init(ordered:unordered:disallowed:)](evaluations/trajectoryexpectation/init(ordered:unordered:disallowed:).md)
- [init(unordered:)](evaluations/trajectoryexpectation/init(unordered:).md)

### Combining expectations

- [ordered](evaluations/trajectoryexpectation/ordered.md)
- [unordered](evaluations/trajectoryexpectation/unordered.md)
- [disallowed](evaluations/trajectoryexpectation/disallowed.md)
- [allowsAdditionalCalls](evaluations/trajectoryexpectation/allowsadditionalcalls.md)

## Relationships

### Conforms To

- [ConvertibleFromGeneratedContent](foundationmodels/convertiblefromgeneratedcontent.md)
- [ConvertibleToGeneratedContent](foundationmodels/convertibletogeneratedcontent.md)
- [Copyable](swift/copyable.md)
- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [Escapable](swift/escapable.md)
- [Generable](foundationmodels/generable.md)
- [InstructionsRepresentable](foundationmodels/instructionsrepresentable.md)
- [PromptRepresentable](foundationmodels/promptrepresentable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Tool-call evaluation

- [Evaluating tool-calling behavior](evaluations/evaluating-tool-calling-behavior.md)
- [ToolCallEvaluator](evaluations/toolcallevaluator.md)
- [ArgumentMatcher](evaluations/argumentmatcher.md)
