Skip to main content
Pull session, event, and evaluation data (and trigger re-evaluations) straight from a script or coding agent, with clean JSON on stdout that pipes directly into jq. These recipes turn Failproof AI Observability’s data into something a terminal user or an AI coding agent (Claude Code, Cursor) can query and automate, without clicking through the dashboard. The patterns below are copy-paste ready for the Failproof AI Observability CLI (agenteye). For installation, authentication, and the full option list see CLI; run agenteye -h or agenteye <command> -h for the built-in help.

Golden rules

  1. Global options go before the command. agenteye --json sessions is correct; agenteye sessions --json is not. The globals are --json, --base-url, --org, --token, --insecure/--secure, --timeout, --quiet, --no-color.
  2. Pass --json whenever you parse output. Data goes to stdout as JSON; human status and errors go to stderr, so stdout stays clean to pipe into jq.
  3. Branch on the exit code, not on stderr text: 0 ok · 1 unexpected error · 2 bad arguments · 3 cannot reach the dashboard · 4 not logged in or expired · 5 missing permission · 6 resource not found.
  4. Discover with -h. Every command documents its filters, value formats, and JSON shape.

One-time setup

Confirm auth before doing work

whoami never errors on a missing or expired session; it reports logged_in:false instead, so an agent can probe auth state safely. (It can still exit non-zero if no base URL is set or the dashboard is unreachable.)

Find failing or low-scoring sessions

Score filtering lives on evals, not sessions. --score KEY:MIN..MAX is repeatable and AND-combined; either bound is optional (..0.5 means ≤ 0.5, 0.9.. means ≥ 0.9). You can pass up to 20 score filters per request; more returns HTTP 400. sessions shares the --env, --status, --agent-id, --session-id, and time-range filters with evals, but has no --score.

Read one session end-to-end

There is no single session show command. Combine the event trail with the session’s evaluation:
Note: By default, events reads a fast, payload-free feed. Each event carries a server-computed one-line summary plus flags like is_error and token counts, but payload comes back as {}. To pull the raw payload, add --full (or --fields payload). The full feed is slower at scale, so keep it bounded: pair --full with a single --session-id.

Fetch everything (pagination)

Results are newest-first and cursor-paginated.

Slim the output with —fields

Restrict the keys (in both the table and --json) to reduce what an agent must read.
Unknown field names are rejected (exit 2) with the valid list, a cheap way to discover field names.

Discover valid filter values

Pick your org (multi-tenant)

If you belong to more than one org, choose the active tenant at login (it’s saved):
A multi-org login without --org exits non-zero and prints the orgs to choose from.

Provision an API key for the SDK/collector

Run a saved or ad-hoc query

Triage an incident non-interactively

Note: Mutations auto-skip their confirmation prompt under --json or when stdin isn’t a TTY, so agents never hang; pass --yes/-y to skip it explicitly elsewhere.

Exit-code handling in a script

JSON output shapes

  • Each event item (events): id, session_id, agent_id, event_type, ts, payload, environment, summary, is_error, error_type, output_tokens, context_window, context_fill. Note that payload is {} unless you request the full feed with --full (or --fields payload).
  • Each evaluation item (evals): id, session_id, agent_id, environment, status, scores, reasoning, summary, error, attempt_count, duration_ms, completed_at, created_at.
  • Each session item (sessions): session_id, agent_id, environment, status, scores, event_count, started_at, last_event_at, first_event_id, last_event_id, latest_evaluation.
Each command’s --fields accepts exactly its own item’s field names. The set differs between sessions and evals, so a name valid for one may be rejected by the other.

Next steps

  • CLI: installation, authentication, and the full option reference for every command.
  • CLI agent skill: package these recipes as a skill your coding agent can load.
  • API keys: create and scope the keys the CLI, SDK, and collector authenticate with.
  • Python SDK: send events into Failproof AI Observability so there is data for these recipes to query.