Skip to main content

Python SDK for ARQERA -- AI governance as an API

Project description

arqera

Govern any AI action with one API call.

The official Python SDK for ARQERA -- AI governance as an API. Evaluate actions against governance policies, query trust scores, and maintain a tamper-evident audit trail, all from Python.

Installation

pip install arqera

Requirements: Python 3.9+. Zero required dependencies (uses only the standard library).

Quick start

from arqera import Arqera

client = Arqera(api_key="ak_live_...")

# Evaluate an action against governance policies
result = client.governance.evaluate(
    action="email.send",
    description="Send welcome email to new user",
)

print(result.verdict)     # "proceed", "review", or "deny"
print(result.confidence)  # 0.95
print(result.approved)    # True

Governance evaluation

Every AI action -- sending an email, deleting data, deploying a model -- can be evaluated against ARQERA's governance laws before execution:

from arqera import Arqera, ArqeraError

client = Arqera(api_key="ak_live_...")

# Simple evaluation
result = client.governance.evaluate(action="data.export")

# With full context
result = client.governance.evaluate(
    action="model.deploy",
    description="Deploy sentiment model to production",
    context={
        "model_id": "sentiment-v3",
        "environment": "production",
        "user_role": "ml-engineer",
    },
)

if result.approved:
    deploy_model()
else:
    print(f"Blocked: {result.reasons}")

Verdict object

The evaluate() method returns a Verdict with these fields:

Field Type Description
verdict str "proceed", "review", or "deny"
action str The action that was evaluated
confidence float Confidence score (0.0 -- 1.0)
reasons list[str] Reasons supporting the decision
laws_evaluated list[str] Which governance laws were checked
approved bool Shorthand for verdict == "proceed"

Trust scores

Query the trust score for your account:

trust = client.governance.trust_score()
print(f"Overall: {trust.overall}")
print(f"Components: {trust.components}")

Evidence trail

Search and export the tamper-evident audit trail:

# Search recent evidence
artifacts = client.governance.search_evidence(
    artifact_type="governance_evaluation",
    start_date="2026-01-01",
    page_size=20,
)
for artifact in artifacts:
    print(f"{artifact.artifact_type}: {artifact.created_at}")

# Verify chain integrity
result = client.governance.verify_evidence(artifact_id=42)

# Export for compliance audit
export = client.governance.export_evidence(
    export_format="json",
    artifact_types=["governance_evaluation"],
)

Error handling

from arqera import Arqera, ArqeraError, RateLimitError, AuthenticationError

client = Arqera(api_key="ak_live_...")

try:
    result = client.governance.evaluate(action="email.send")
except AuthenticationError:
    print("Invalid API key")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except ArqeraError as e:
    print(f"API error ({e.status_code}): {e.message}")

Exception hierarchy

Exception HTTP Status When
AuthenticationError 401 Invalid or missing API key
AuthorizationError 403 Key lacks required permissions
NotFoundError 404 Resource does not exist
ValidationError 422 Invalid request payload
RateLimitError 429 Rate limit exceeded
ServerError 5xx ARQERA server error
NetworkError -- DNS, timeout, connection refused
ArqeraError any Base class for all SDK errors

Configuration

client = Arqera(
    api_key="ak_live_...",                         # or set ARQERA_API_KEY env var
    base_url="https://api.arqera.com/api/v1",      # default
    timeout=30,                                     # seconds
    max_retries=2,                                  # retries on 429/5xx
)

The api_key parameter can be omitted if the ARQERA_API_KEY environment variable is set:

export ARQERA_API_KEY="ak_live_..."
client = Arqera()  # picks up ARQERA_API_KEY from env

Links

License

Apache 2.0. See LICENSE for details.

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

arqera-0.3.0.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

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

arqera-0.3.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file arqera-0.3.0.tar.gz.

File metadata

  • Download URL: arqera-0.3.0.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for arqera-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b080bd79e470e9c4e1a43192b862451c52b9a8ebe7571cb836929d70506e403f
MD5 1c55f1ffd3b276cf87614429340fdb87
BLAKE2b-256 ff7ebb3965f63e57d895f4f6c72200faced7502acfe31e1e424283d677620599

See more details on using hashes here.

File details

Details for the file arqera-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: arqera-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for arqera-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25019a4646c02d44f8cdd2ae221bbc80f0932b11193408e1558f58d7609c246c
MD5 a3000d971b7d6141d67a164522ef458f
BLAKE2b-256 ee8eeb3f175d48e2b586beb1e24b337ff23abaf15e191750053529812f3f5dff

See more details on using hashes here.

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