Skip to content

feat(assertions): evaluate trajectory step execution status #10607

Description

@Asthenia0412

Problem

Promptfoo's normalized trajectory steps already preserve statusCode and statusMessage, but deterministic trajectory assertions can currently check tool names, arguments, order, and counts—not whether a matched tool/command/span succeeded or failed.

For agent reliability evaluation this makes an important case hard to express: a run may call the correct tool with the correct arguments, yet the tool may fail; conversely, a policy may require that a dangerous tool never returns an error or that a failed call is followed by a successful retry.

Proposal

Add a deterministic trajectory:step-status assertion that matches a trajectory step by name/pattern/type and status (success, error, or an exact numeric status code), with an optional status-message pattern. It should reuse the existing TrajectoryStep.statusCode and statusMessage fields and support the existing not- assertion convention.

Example:

- type: trajectory:step-status
  value:
    name: delete_file
    status: error

Scope of the first implementation

  • Add pure status-matching semantics and focused unit tests.
  • Add/register the assertion, schema, documentation, and failure reasons.
  • Add a local CLI fixture/E2E test for successful and failed tool spans.
  • Treat status code 0 or a missing status as unset; do not match it as success unless the design is revised with maintainer feedback.
  • Keep existing trajectory assertions backward compatible.

I plan to submit this as the first step in a small, test-first series that makes agent trajectory evaluation cover invocation, arguments, ordering, and execution outcome. The implementation will reference this issue and include unit tests before the CLI E2E validation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions