Skip to main content

pyantra-eval

Trajectory evaluation, LLM judges, and a pytest plugin for Pyantra. Assert on how a workflow ran — not just whether it returned.

pip install pyantra-eval

Trajectory expectations

Judge a Run against expectations covering status, errors, node visits, ordering, and step count. evaluate runs several at once and returns an EvalReport.

from pyantra_eval import (
    evaluate,
    expect_completed,
    expect_ordered,
    expect_visited,
)

report = evaluate(
    run,
    expect_completed(),
    expect_visited("fetch"),
    expect_ordered("fetch", "parse", "store"),
)
assert report.passed

Available expectations:

  • expect_status(...) / expect_completed() / expect_failed(contains=..., pattern=...)
  • expect_visited(node, at_least=...) / expect_not_visited(node)
  • expect_ordered(*nodes)
  • expect_max_steps(limit)
  • expect_interrupt()
  • expect_that(check, message=..., name=...) — arbitrary predicates

LLM judges

Score output against a rubric with any pyantra.LLM provider. LLMJudge prompts the model, parses a numeric verdict (Score: 3 or Score: 7/10), clamps it to your scale, and records the rationale and usage.

from pyantra import MockLLM
from pyantra_eval import LLMJudge, expect_judged

judge = LLMJudge(MockLLM(responses=["Score: 8/10\nRationale: Accurate."]),
                 rubric="Factual accuracy", max_score=10.0)

verdict = judge.judge(answer)            # JudgeResult(score, rationale, usage)
report = evaluate(run, expect_judged(judge, threshold=6.0))

expect_judged extracts the text to score from the run (default: the final state) and passes the verdict through the report.

pytest plugin

Declare expectations inside a test via the pyantra_evals fixture; the test fails at teardown with a summary if any expectation did not hold.

def test_order_flow(pyantra_evals):
    run = app.run(state)
    pyantra_evals.expect(run, expect_completed(), expect_ordered("a", "b", "c"))

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyantra_eval-0.5.1.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyantra_eval-0.5.1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file pyantra_eval-0.5.1.tar.gz.

File metadata

  • Download URL: pyantra_eval-0.5.1.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyantra_eval-0.5.1.tar.gz
Algorithm Hash digest
SHA256 170407b52a76f551dd6975e7aa2af415a187334c19c03beb5631efe01a15e904
MD5 15009cf4a106dc78ba647a887a19c40c
BLAKE2b-256 8833a5515a6664ab14b95ec83890c7fcdc6991fdcce17c3eb2c2a0758b28da60

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyantra_eval-0.5.1.tar.gz:

Publisher: publish.yml on Eskaykaushik/pyantra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyantra_eval-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: pyantra_eval-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyantra_eval-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06d04e37b7ac94d5f4a6416f9fc74ff56971050692b25684a2e7f8529fb4b7ef
MD5 453a59f26b53a4f131a5b1692ceaf3e7
BLAKE2b-256 b64cb8feb140bfb7626ae7c45ede5bd43511155a518e955fac965f38a44fc606

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyantra_eval-0.5.1-py3-none-any.whl:

Publisher: publish.yml on Eskaykaushik/pyantra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page