Skip to main content

EvalGate Python SDK — CI for AI behavior. Traces, evaluations, assertions, and regression gates for LLM apps.

Project description

evalgate-sdk

PyPI Python License: MIT Typed

evalgate-sdk brings EvalGate's evaluation control plane to Python.

Use it to run assertions, trace agent workflows, inspect platform runs, orchestrate judges, and participate in the same closed-loop evaluation workflow as the TypeScript SDK and the web app.

Install

pip install evalgate-sdk

Optional extras:

pip install "evalgate-sdk[openai]"
pip install "evalgate-sdk[anthropic]"
pip install "evalgate-sdk[langchain]"
pip install "evalgate-sdk[all]"

Quick Start

Local Assertions

from evalgate_sdk import expect

result = expect("The capital of France is Paris.").to_contain("Paris")
print(result.passed)

Platform Client

from evalgate_sdk import AIEvalClient
from evalgate_sdk.types import CreateTraceParams

client = AIEvalClient(api_key="sk-...")

trace = await client.traces.create(
    CreateTraceParams(
        name="support-run",
        input="Cancel my subscription",
        output="I've canceled your plan effective today.",
    )
)

print(trace.id)

Closed-Loop Workflow

The Python package participates in the same EvalGate loop:

trace -> cluster -> synthesize -> gate -> review -> auto -> ship

Representative CLI commands:

evalgate gate
evalgate cluster --run .evalgate/runs/latest.json
evalgate synthesize --dataset .evalgate/golden/labeled.jsonl
evalgate judge registry
evalgate judge presets

Web App Sync

The Python CLI uses the same sync contracts as the TypeScript SDK. Local labeled JSONL can be pushed into the web app, web-labeled cases can be merged back into the same file, and prompt files can round-trip with stale active-version protection.

# Push local labels into the web app and pull web labels back into JSONL
evalgate sync \
  --project-key support-agent \
  --labeled-dataset .evalgate/golden/labeled.jsonl \
  --pull-labels

# Pull the active web prompt into a local file
evalgate sync \
  --project-key support-agent \
  --prompt-id prompt_support \
  --target-path prompts/support.md \
  --pull-prompt

# Push an edited local prompt as a new web prompt version
evalgate sync \
  --project-key support-agent \
  --prompt-id prompt_support \
  --target-path prompts/support.md \
  --push-prompt

Judge Orchestration

The Python SDK supports the same core judge model as the platform:

  • registry-backed judge selection
  • saved judge configs
  • multi-judge aggregation
  • per-run and per-case judge inspection
  • structured reasoning and signal breakdowns

CLI

evalgate judge registry
evalgate judge presets

evalgate judge test \
  --provider openai \
  --model gpt-5.2-chat-latest \
  --judge openai:gpt-5.2-chat-latest \
  --judge anthropic:claude-sonnet-4-20250514 \
  --aggregation weighted \
  --prompt-template "Return strict JSON with score, passed, reasoning, and signals." \
  --input "Cancel my subscription" \
  --output "I've canceled your plan effective today."

Client

from evalgate_sdk.types import TestLLMJudgeConfigParams

registry = await client.llm_judge.list_registry()
presets = await client.llm_judge.list_presets()

result = await client.llm_judge.test_config(
    TestLLMJudgeConfigParams(
        provider="openai",
        model="gpt-5.2-chat-latest",
        prompt_template="Return strict JSON with score, passed, reasoning, and signals.",
        judges=[
            {
                "id": "primary",
                "type": "llm",
                "provider": "openai",
                "model": "gpt-5.2-chat-latest",
                "weight": 0.6,
            },
            {
                "id": "backup",
                "type": "llm",
                "provider": "anthropic",
                "model": "claude-sonnet-4-20250514",
                "weight": 0.4,
            },
        ],
        aggregation="weighted",
        input="Cancel my subscription",
        output="I've canceled your plan effective today.",
        behavior="tool_use",
        task_type="support",
    )
)

print(result.result.score, result.result.reasoning)

Enterprise Controls

The Python SDK respects the same platform guardrails:

  • provider allowlists
  • pre-send PII checks for outbound judge/provider calls
  • org-scoped policy
  • shared config precedence with the API and web app

Surface Parity

The Python SDK now covers the primary EvalGate workflows used in the product:

  • traces and runs
  • clustering and synthesis
  • gate/check/review loops
  • judge registry, presets, configs, results, and comparisons
  • workflow and control-plane inspection commands

TypeScript still has a few extra convenience wrappers, but the core control-plane model is shared.

For broader product context, see:

Project details


Download files

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

Source Distribution

evalgate_sdk-3.6.0.tar.gz (228.1 kB view details)

Uploaded Source

Built Distribution

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

evalgate_sdk-3.6.0-py3-none-any.whl (210.4 kB view details)

Uploaded Python 3

File details

Details for the file evalgate_sdk-3.6.0.tar.gz.

File metadata

  • Download URL: evalgate_sdk-3.6.0.tar.gz
  • Upload date:
  • Size: 228.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for evalgate_sdk-3.6.0.tar.gz
Algorithm Hash digest
SHA256 5c26d9a5551fb63f182425f5c5b2efef294ac9b31d3f101281261d4da4de081f
MD5 2f57f98b20144296e16c1363280982f1
BLAKE2b-256 16f2384a4cd6c71230d189f0a2bf94ab9b2830d3ac2c067ab280e90a4d13ddfd

See more details on using hashes here.

Provenance

The following attestation bundles were made for evalgate_sdk-3.6.0.tar.gz:

Publisher: publish-pypi.yml on evalgate/ai-evaluation-platform

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

File details

Details for the file evalgate_sdk-3.6.0-py3-none-any.whl.

File metadata

  • Download URL: evalgate_sdk-3.6.0-py3-none-any.whl
  • Upload date:
  • Size: 210.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for evalgate_sdk-3.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5900806d2beea9387f5670fcc960d16e43ccd3055cd9e7cd5f3157f9930ffb5f
MD5 818665bfa5ec099542c99a9f337e833e
BLAKE2b-256 22592f13ff4406e074a4067eedf5b94f5fc581118a348a3c3b19251f9fbca633

See more details on using hashes here.

Provenance

The following attestation bundles were made for evalgate_sdk-3.6.0-py3-none-any.whl:

Publisher: publish-pypi.yml on evalgate/ai-evaluation-platform

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 Pingdom Monitoring Sentry Error logging StatusPage Status page