---
title: SiriScenario
framework: Siri Evaluations
role: symbol
role_heading: Structure
platforms: [iOS 27.3+, iPadOS 27.3+, macOS 27.3+, visionOS 27.3+]
path: sirievaluations/siriscenario
---

# SiriScenario

An ordered, multiturn interaction run in one Siri session.

## Declaration

```swift
struct SiriScenario
```

## Overview

Overview A scenario is a conversation made of a sequence of turns. Each turn is something a person says, and Siri handles the turns in one session in the order you write them. A turn carries its own expectations about what Siri does, and the scenario carries expectations about the whole conversation. A turn’s expectations apply only to that turn. A scenario’s expectations apply to all of its turns together. Put an expectation on the scenario when it spans turns, such as an intent that finishes only after the person answers a question. Using a Calls structure’s expectation on the scenario with Calls.Ordering.disallowed fails if the call runs in any turn, or if Siri asks the person to confirm it in any turn. Use Calls.Ordering.unordered when each call happens in at least one turn, in any order. A scenario conforms to Codable, so you can encode a set of scenarios as JSON to review alongside your project. The following example shows a two-turn scenario with expectations that apply to the whole conversation: let quizExampleIntents = IntentDefinitions(bundleIdentifier: "com.example.QuizExample") let startQuizIntent = quizExampleIntents.intents["StartQuizIntent"] let createQuizReminderIntent = quizExampleIntents.intents["CreateQuizReminderIntent"]

let scenario = SiriScenario {     // In turn one, the person names the app but not the topic, so Siri     // asks for one.     UserTurn("Start a quiz in QuizExample")

// The second turn answers with a topic.     UserTurn("Science") } expectation: {     Calls {         // The topic label comes from the parameter on the intent.         startQuizIntent             .expect(topic: .equals("Science"))     }

// Fails if Siri runs or asks the person to confirm the intent in any turn.     Calls(.disallowed) {         createQuizReminderIntent     } } To run a scenario through Siri, pass it to a SiriScenarioLoader to make it part of the dataset for an evaluation that runs with SiriService.

## Topics

### Creating a scenario

- [init(_:)](sirievaluations/siriscenario/init(_:).md)
- [SiriScenarioBuilder](sirievaluations/siriscenariobuilder.md)

### Creating a scenario with expectations

- [init(_:expectation:)](sirievaluations/siriscenario/init(_:expectation:).md)
- [SiriScenarioExpectationBuilder](sirievaluations/siriscenarioexpectationbuilder.md)

### Inspecting a scenario

- [turns](sirievaluations/siriscenario/turns.md)
- [input](sirievaluations/siriscenario/input.md)
- [expected](sirievaluations/siriscenario/expected.md)

### Encoding a scenario

- [encode(to:)](sirievaluations/siriscenario/encode(to:).md)

## Relationships

### Conforms To

- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [SampleProtocol](evaluations/sampleprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Scenarios

- [SiriScenarioLoader](sirievaluations/siriscenarioloader.md)
- [UserTurn](sirievaluations/userturn.md)
