Skip to main content

Valkyrie SDK

Async Python client for Valkyrie, Vals AI's platform for running AI agents on benchmarks. Start runs, follow their progress, read results, logs, and task details, and manage agents, projects, secrets, and benchmark services from your own code.

Documentation: docs.valkyrie.vals.ai · SDK reference: docs.valkyrie.vals.ai/reference/sdk

Install

The SDK needs Python 3.12 or later. With uv installed and a virtual environment activated:

uv pip install valkyrie-sdk

Sign in

The SDK uses the same login and Tracker as the Valkyrie CLI. Sign in once with valkyrie login, or set VALKYRIE_API_KEY to an access key. The SDK doesn't install the CLI.

To choose the Tracker or access key in code, pass a ValkyrieConfig:

from valkyrie.sdk import ValkyrieClient, ValkyrieConfig

config = ValkyrieConfig(url="https://tracker.example.com", api_key="ACCESS_KEY")
async with ValkyrieClient(config) as client:
    ...

List your runs

import asyncio

from valkyrie.sdk import ValkyrieClient


async def main() -> None:
    async with ValkyrieClient() as client:
        page = await client.runs.list()
        for run in page.benchmarks:
            print(run.id, run.name, run.status, run.final_score)


asyncio.run(main())

Start a run and wait for its score

import asyncio

from valkyrie.sdk import BenchmarkStatus, ValkyrieClient

FINAL_STATUSES = {BenchmarkStatus.FINISHED, BenchmarkStatus.ERROR, BenchmarkStatus.STOPPED}


async def main() -> None:
    async with ValkyrieClient() as client:
        run = await client.runs.start(
            agent="my-agent",
            benchmark="swebench",
            model="provider/model-name",
            concurrency=10,
            label="nightly-swebench",
        )
        print("Started", run.benchmark_id)

        while (await client.runs.fetch(run.benchmark_id)).details.status not in FINAL_STATUSES:
            async for update in client.runs.stream(run.benchmark_id):
                details = update.details
                print(f"{details.status.value}: {details.finished_tasks}/{details.total_tasks} tasks")

        results = await client.runs.results(run.benchmark_id)
        if results.status == BenchmarkStatus.FINISHED and results.final_evaluation:
            print("Score:", results.final_evaluation.final_score)


asyncio.run(main())

agent is the name of an agent you uploaded to your library. stream yields the run's state each time it changes. It ends when the run finishes or when the Tracker disconnects, so the loop reconnects until the run reaches a final status.

Download outputs

Extract the files your agents wrote into a new directory:

await client.runs.download_outputs(run_id, "./outputs", task_ids=["task-1"])

Leave out task_ids for the whole run.

Look into failed tasks

from valkyrie.sdk import FetchTasksRequest, TaskStatus

errors = FetchTasksRequest(status=[TaskStatus.ERROR])
async for task in client.benchmarks.iter_tasks(run_id, errors):
    print(task.task_id, task.error_message)

    for event in await client.logs.fetch_task(run_id, task.task_id, query="ERROR"):
        print(event.timestamp, event.message)

Stop, resume, and retry runs

await client.runs.stop(run_id)

await client.runs.resume(run_id, concurrency=20)

await client.runs.retry(run_id, task_ids=["task-1"])

See Manage a run for what each action reruns.

Handle errors

Every SDK exception inherits from ValkyrieSDKError. ValkyrieAPIError carries the HTTP status and the Tracker's error detail:

from valkyrie.sdk import ValkyrieAPIError, ValkyrieSDKError

try:
    run = await client.runs.fetch(run_id)
except ValkyrieAPIError as exc:
    print(exc.status_code, exc.detail)
except ValkyrieSDKError as exc:
    print(exc)

Learn more

Topic Guide
Set up the SDK sdk/quickstart
Start, follow, recover, and download runs sdk/runs
Tasks, logs, artifacts, agents, secrets, and services sdk/resources
Every client method, model, and field reference/sdk
Every SDK exception reference/sdk/errors
Tracker, login, and environment variables get-started/configuration

Complete example scripts are in docs/sdk/examples.

Metadata

Release files for valkyrie-sdk 0.36.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for valkyrie-sdk 0.36.0
File Size Uploaded Provenance Actions
valkyrie_sdk-0.36.0.tar.gz 68.8 kB With provenance Details for valkyrie_sdk-0.36.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for valkyrie-sdk 0.36.0
File Interpreter ABI Platform Actions
valkyrie_sdk-0.36.0-py3-none-any.whl Python 3 none any Details for valkyrie_sdk-0.36.0-py3-none-any.whl

Total release size: 164.8 kB

Release files / valkyrie_sdk-0.36.0.tar.gz

Download URL valkyrie_sdk-0.36.0.tar.gz
Size 68.8 kB
Tags Source
SHA-256 checksum
How to use checksums
498d583488358001d4077112df1f48f5967eb1311c03192dfc636aa4a90cf6a1
BLAKE2b-256 checksum
How to use checksums
3af3e17c3a5d5530be36b6de33a61eb5bde9dd5a71c425302eb96d3be452070b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Release files / valkyrie_sdk-0.36.0-py3-none-any.whl

Download URL valkyrie_sdk-0.36.0-py3-none-any.whl
Size 96.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3ad78d4bd22c3e18ccf10f918c9abe0fac4761c8a2cbf34207a9725f4327437
BLAKE2b-256 checksum
How to use checksums
fe53310ae0c880c8cea9da69408479d41b23a444a86d16ccfdb3597eed51a923
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Security for valkyrie-sdk 0.36.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for valkyrie_sdk-0.36.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page