Skip to main content
Structured SDK responses use Pydantic models. Resource models such as Evaluation inherit from VijilModel, while generated API models such as RedteamStatusResponse inherit directly from BaseModel. SDK exceptions inherit from VijilError. Hand-curated models inherit from VijilModel, which ignores unknown response fields. Models generated from the Console schemas inherit directly from Pydantic’s BaseModel. When vijil.models exports a model, import it there. Treat vijil._generated as internal implementation detail.

Pagination

Page[T]

Generic paginated response returned by resource collection methods such as list() and client.evaluations.responses().
Page[T] normalizes the Console’s items or results collections and its total or count fields. Some methods intentionally return a plain list, such as client.rca_runs.list().

Core Models

Evaluation

Returned by client.evaluate() for behavioral evaluations. Trust Scores and Harness fields do not apply to Red Team evaluations.
The behavioral poller treats completed, succeeded, saved, failed, and cancelled as terminal statuses.

EvaluationResponse

Returned in the page.items list from client.evaluations.responses(). Each model represents one prompt and Agent response from a completed behavioral evaluation.
probe_score and status describe the parent Probe and repeat on each of its prompt rows. detector_results contains the raw per-Detector results for that prompt. This model does not apply to Red Team evaluations.

RedteamStatusResponse

Returned by client.evaluate(..., type="redteam") and client.evaluations.redteam_status(evaluation_id). This is a Red Team progress snapshot, not a Trust Score.
A Red Team run can report created, starting, or running before it reaches a terminal status: succeeded, failed, cancelled, or degraded. A degraded run has finished with some attackers lost, so inspect its error and wave details before relying on the report. Red Team does not use the behavioral completed or saved statuses.

Dimensions

The SDK builds dimensions from the Console’s pillar score fields or its scores dictionary.

EvaluationResponse

client.evaluations.responses() returns a Page[EvaluationResponse] containing individual behavioral Evaluation records.

Agent

The Console schema uses agent_name and agent_url as the public field names.
The client.agents resource removes API key values from Console responses before returning an Agent.

Job

Lifecycle methods return the terminal Job record even when its status is failed or cancelled. Inspect job.status and job.error after polling.

TrustScore

Use score.summarize(results=results, scale=100) to flatten full Evaluation results into summary, Harness, Scenario, and Probe rows. Get results with client.scores.results().

DomeConfig

Harness and Report

For a custom Harness, show() and create(wait=True) populate workflow with the generation status when available. Report.created_at can be a Unix timestamp or an ISO-formatted string.

Other Models

MonitorSummary and Detection models exist for forward compatibility, but their corresponding resource read methods currently raise NotImplementedError. See SDK Resources for supported telemetry operations.

Errors

Import SDK exceptions from vijil.exceptions:
All concrete SDK exceptions inherit from VijilError. The hierarchy supports two ways to classify a failure:

Source-Attributed Errors

Each concrete exception exposes a source and a remediation hint. Catch ConsoleRejected to handle every Console rejection together, or catch one of its status-specific subclasses.

HTTP Status Errors

Other non-success statuses, such as 409, raise ConsoleRejected directly.
SDKValidationFailed and VijilValidationError represent different failure locations. The first means local SDK validation stopped the request. The second means the Console rejected a request with HTTP 400 or 422.

Configuration and Job Errors

Error-Handling Pattern

Catch the narrowest actionable exception before its parent class.

Automatic Retries

The HTTP client makes at most three total attempts for a request:
  • For transport failures and 5xx responses, it waits one second before the second attempt and two seconds before the third.
  • For 429 responses, it uses a numeric Retry-After value. If the header is missing or invalid, it waits one second.
  • For a 401 response, it performs one refresh-and-retry when the credentials support token refresh.
After the final attempt, the SDK raises NetworkError, VijilRateLimitError, or VijilServerError, depending on the last failure. Individual operations can disable retries when repeating the request would be unsafe. Multipart uploads do not retry automatically.

Next Steps

SDK Resources

See which methods produce each model.

Lifecycle Methods

Use high-level workflows and inspect their return values.

SDK Setup

Configure authentication, gateways, and team defaults.

Run Evaluations

Start Evaluations and retrieve their results.
Last modified on October 20, 2026