Skip to main content
Grade the last completed traced run without a manual JSON export. An agent runs, records a pointer to its trace, and one command grades it.

Quick Start

1

Run a traced agent

Run your agent, then record a pointer to the trace file it produced.
2

Grade it

One command grades the last run and exits with a CI-friendly code.

How It Works

The CLI reads the pointer file, loads the trace it points at, maps tool events to the harness evaluator, and grades. The subcommand counts one tool call per tool_start event so repeated calls are preserved; it falls back to tool_end only when a trace emits ends without starts.

CLI Reference

praisonai eval last-trace grades your last run. One command, three exit codes.

Options

Exit codes

JSON output

The three keys come from result.passed, result.score, and result.tool_call_count.

Trace formats

Both JSONL (one JSON event per line) and a JSON array (detected when the first non-whitespace character is [) work transparently. Each event is a dict:

Python API Reference

Three stdlib-only helpers on praisonaiagents.trace persist and read the pointer.

record_completed_run

Persist a pointer to the trace file of the just-completed run.
str | Path
required
Path to the trace artifact (JSON or JSONL). Resolved to absolute inside the pointer.
Optional[Dict[str, Any]]
default:"None"
Optional run metadata (agent name, status, etc.). Shallow-copied.
Path
The pointer file path (same as last_run_pointer_path()). Writes atomically; the parent directory is created if missing.

load_last_run_pointer

Load the pointer, or None if none has been recorded or it is unreadable.
Optional[Dict[str, Any]]
The pointer dict, or None (never raises) when the file is missing, unreadable, not valid JSON, not a dict, or has no path key.

last_run_pointer_path

Absolute path to the pointer file.
Path
Absolute path to last_trace.json.

Pointer File

The pointer lives at ~/.praison/last_trace.json by default, written with JSON Schema version 1.0.
Set PRAISON_HOME to redirect the pointer to $PRAISON_HOME/last_trace.json β€” the escape hatch for sandboxes, tests, and CI runners that cannot write to $HOME.

CI Usage

Exit code 1 propagates naturally, so a failing grade fails the build.

Common Pitfalls

The SDK does not auto-call record_completed_run(). Your trace sink or your own code must call it after the run so the pointer exists.
2 means β€œno run to grade” β€” a missing or stale pointer (an operator problem). 1 means the run failed grading or the trace was malformed (a test failure).
~/.praison/last_trace.json by default, or $PRAISON_HOME/last_trace.json when PRAISON_HOME is set.

Evaluation Loop

Iterative improvement β€” the long-running cousin.

Judge

Standalone LLM-as-judge scoring.

CLI Eval

The broader praisonai eval … surface.

Custom Tracing

How traces get produced in the first place.