Vira Python SDK
MIT-licensed client library. The Vira service, application, and backend remain proprietary and are governed separately.
Package name: tryvira-sdk.
Compound execution plans are persisted with save_compound_task_plan(plan, ...)
and read with list_compound_task_plans(...) or get_compound_task_plan(plan_id).
These methods use the authenticated scope; saving a plan does not execute it.
The source also includes get_ai_credit_wallet(), list_ai_credit_budgets(), and
list_ai_usage_receipts(), and get_ai_usage_summary() for organization billing readers. The server requires
an active organization Billing Admin membership or workspace owner role. Values
are integer microcredits; these methods are read-only. Usage receipts can be filtered
by consuming organization unit and bounded by a result limit. Monthly summaries keep provider cost in its source currency separate from customer microcredits. Managed execution callers can reserve an approved upper bound with reserve_ai_credits(...) before provider invocation and release unused holds with release_ai_credit_reservation(...); both require organization billing authority and server-side budget admission.
For a host-managed, rotating Vira customer API key, pass
api_credential_provider=lambda: key to the synchronous ViraClient. The
provider is called for each API request and sends the credential in
x-vira-api-key; Vira resolves the tenant from that persisted credential.
Supabase/Better Auth OAuth access tokens are identity tokens, not Vira API
credentials, and are rejected by this client. The deprecated
access_token_provider argument remains as a compatibility alias and has the
same Vira API-key requirement. When either provider is set, it takes precedence
over api_key.
Install
python -m pip install tryvira-sdk==0.1.77
For a repository checkout use python -m pip install ./sdks/python. The client is a thin
HTTP client of Vira's authority boundary; it does not execute tools locally.
The SDK sends requests to Vira's API. It does not execute tools locally or bypass Vira's
scope, policy, evaluation, and release checks. Runtime requests fail closed; observation
telemetry can be configured with failure_mode="open" when appropriate.
Pack lifecycle
Use a Pack when related Tasks, Points, Programs, Strategies, signals, and evaluation material must move together. The lifecycle is always explicit:
candidate = vira.import_pack({"manifest": manifest, "objects": objects}, idempotency_key="pack:import:1")
pack_id = candidate.body["pack"]["id"]
vira.install_pack(pack_id, {"brand_name": "Example Brand"})
evaluation = vira.evaluate_pack(pack_id, {"candidateExecutionRequired": True})
if evaluation.body.get("passed") is not True:
raise RuntimeError("candidate evaluation did not pass")
vira.approve_pack(pack_id)
vira.release_pack(pack_id)
Import and install create or materialize a candidate; they do not authorize runtime
execution. Do not submit a client-made passed, score, or fake receipt. Release
requires the server-side evaluation receipt bound to the exact Pack digest. See the
public Pack guide for
the manifest layout, JavaScript and MCP equivalents, upgrade preview, and troubleshooting.
import os
from vira import ViraClient
with ViraClient(
"http://127.0.0.1:4185",
api_key=os.environ.get("VIRA_API_KEY"),
allow_insecure_localhost=True,
) as vira:
connected = vira.connect_once(
"my-agent", "custom-agent",
{"organizationId": "org", "projectId": "project", "environmentId": "local"},
"custom-python", "1",
idempotency_key="connect-001",
)
system = connected.body["system"]
connection = connected.body["connection"]
vira.observe({
**scope,
"eventId": "evt-1", "eventType": "model.response",
"aiSystemId": system["id"], "connectionId": connection["id"],
"payload": {"message": "A model response was produced."},
}, idempotency_key="evt-1")
semantic = vira.resolve_semantic({"input": "answer a customer billing question"})
print(semantic.body)
Runtime execution requires a released revision, a valid scope and an idempotency key; semantic resolution is not authorization. See the public Vira documentation at https://github.com/hrpering/tryvira for the shared JS/Python lifecycle.
Pack evaluation requires the ID of a persisted server-side PASSED evaluation bound
to the exact pack digest. The SDK does not accept client-supplied passed or score
as release evidence.
TaskRun orchestration
TaskRun routing and admission are server-authorized. The normal integration submits only the user intent; Vira derives the actor, host capabilities, effect classes, released Task metadata and concrete execution mode. It cannot invent a Task, behavior, or release identity.
route = vira.resolve_task_run({"input": "Prepare the monthly customer report"})
if route.body.get("route", {}).get("route") != "ROUTED":
raise RuntimeError("Vira did not authorize this route")
run = vira.start_task_run_from_prompt({
"aiSystemId": "ais_support_agent",
"input": "Prepare the monthly customer report",
"budget": {"maxChildren": 4, "maxCalls": 6, "maxCostMicros": 50000},
}, idempotency_key="task-run:start:monthly-report-001")
state = vira.get_task_run("monthly-report-001")
events = vira.list_task_run_events("monthly-report-001")
if state.body.get("taskRun", {}).get("status") == "WAITING_USER":
vira.continue_task_run("monthly-report-001", state.body["taskRun"]["stateVersion"],
cursor="approved-by-user")
resolve_task_run is a proposal-only read. start_task_run is the admission
boundary. continue_task_run, retry_task_run and cancel_task_run require the
current state version and are idempotent; stale versions are rejected. Retry is
only valid for FAILED, BLOCKED or PARTIAL runs and reuses the immutable server
plan. A TaskRun does not replace the normal Pack evaluate → approve → release
gates.
Framework lifecycle bridges
The Python SDK also provides dependency-free lifecycle bridges for host frameworks. They do not replace the host agent loop or claim tool authority; they map model/tool/action callbacks into the Vira observation contract.
from integration import create_crewai_bridge
bridge = create_crewai_bridge(context, callback=record_event)
bridge.before_execution({"input": user_message})
bridge.before_tool("search")
bridge.after_tool("search")
bridge.after_execution(model_output)
Use assess_runtime_integration(..., mode="observe" | "strict", operation=...)
before enabling enforcement. Missing interception, trusted signals, or a
projection artifact is reported as partial/unsupported; the bridge never
silently upgrades it to enforced behavior.
The package metadata is intentionally dependency-free.
AI credit admission is available with reserve_ai_credits(...); unused reservations can be returned with release_ai_credit_reservation(...). The server checks the caller's organization billing authority, wallet balance, active budgets, project scope, and idempotency before a managed provider request.
Metadata
Release files for tryvira-sdk 0.1.78
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tryvira_sdk-0.1.78.tar.gz | 52.8 kB | Without provenance | Details for tryvira_sdk-0.1.78.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tryvira_sdk-0.1.78-py3-none-any.whl | Python 3 | none | any | Details for tryvira_sdk-0.1.78-py3-none-any.whl |
Total release size: 106.1 kB
Release files / tryvira_sdk-0.1.78.tar.gz
| Download URL | tryvira_sdk-0.1.78.tar.gz |
|---|---|
| Size | 52.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6210ee2b0e4873857ee15314c0d9e44777e4b12a441af7f25db90290c972934
|
|
BLAKE2b-256 checksum How to use checksums |
22e014d8138f954229457eac153aeca29246b8a86d18466b782548d4057302e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / tryvira_sdk-0.1.78-py3-none-any.whl
| Download URL | tryvira_sdk-0.1.78-py3-none-any.whl |
|---|---|
| Size | 53.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
343dcda35f257eedd48a18fafdb17ac0cc1156182ddfbc54c0ec987f22421be2
|
|
BLAKE2b-256 checksum How to use checksums |
5416f768d95e1f0ff2253df27fcbab0355524a56ce363ca8d8310ac8b50960aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Security for tryvira-sdk 0.1.78
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.