AribotDevelopers Sign in

Aribot Python SDK

The official Python client for Aribot by Ayurak: threat modeling, security gates for pull requests, code review against the threat model, pipeline security, compliance and AI agent governance, from your own scripts, services and CI jobs.

pip install aribot
bash
pip install aribot

Python 3.9 or later. The only dependency is requests. Install aribot[keyring] to use the sign-in stored by aribot login.

What you can do with it

Sign in

Create an API key in Aribot under Company Admin > Developer & API. The SDK looks for a credential in this order:

  1. The api_key you pass to Aribot(...).
  2. The ARIBOT_API_KEY environment variable (use this in CI).
  3. The OS keychain entry written by aribot login from the aribot-cli package. This needs pip install "aribot[keyring]".
  4. The ARIBOT_TOKEN environment variable (a JWT access token).
bash
export ARIBOT_API_KEY=...        # from Company Admin > Developer & API
python
from aribot import Aribot

client = Aribot()                # finds the credential as above
print(client.credential)         # kind and source only; the value is never shown
print(client.me())

Other settings: ARIBOT_API sets the server (default https://aribot.ayurak.com) and ARIBOT_CA_BUNDLE adds a private CA certificate.

Example: a gate decision for a pull request

python
from aribot import Aribot

client = Aribot()
decision = client.gates.decide(
    gate_config_id=12,
    gate="pull_request",
    head_sha="3f2c1e9",
    files=[{"path": "api/payments.py", "changed_lines": [[40, 72]]}],
)
print(decision)

Only file paths and changed line ranges leave your machine. File contents are never sent.

Example: the agent decision API

An agent asks before each tool call. This call uses the agent's own key (agk_..., created for the agent in Aribot), passed as agent_key= or set in ARIBOT_AGENT_KEY.

python
from aribot import Aribot, AribotError

client = Aribot()

def may_call(tool: str, resource: str, args: dict) -> bool:
    try:
        answer = client.gateway.decide(tool, resource=resource, args=args)
    except AribotError:
        return False             # fail closed: no decision means no action
    return bool(answer.get("allowed"))

if may_call("crm.read_contact", "contact:4711", {"fields": ["email"]}):
    ...

The server hashes args; keep them small. A decision request is sent once and never retried.

More examples

python
# Code review against the threat model
scan = client.code_review.create_scan(repository_id="...", diagram_id=42)
client.code_review.start_scan(scan["id"])
matrix = client.code_review.traceability(scan["id"])

# Pipeline scan of a pull request
run = client.pipeline.scan(project_id=7, pull_request_id=128)
gates = client.pipeline.get_gate_results(run["id"])

# Threat model from a diagram file
result = client.threat_modeling.analyze_diagram("architecture.png")
threats = client.threat_modeling.get_threats(result["id"])   # once analysis finishes

# A platform scan through the connector API, safe to retry with an idempotency key
job = client.connector.create_scan(account_id=3, idempotency_key="nightly-3-2026-11-23")

Errors

Every error is an AribotError with status, code (the server's error code, when sent) and payload (the response body).

ExceptionWhen
ValidationError400 or 422
AuthenticationError401: the credential is missing, expired or revoked
LicenseRequiredError402: the company has no licence for this feature; payload has the details
PermissionDeniedError403: the user or key may not do this
NotFoundError404
ConflictError409
RateLimitError429 after the retries; retry_after holds the server's wait in seconds
ServerError5xx
ConfigErrorbad base URL, no credential, or an invalid argument
python
from aribot import Aribot, LicenseRequiredError, RateLimitError

try:
    client.code_review.start_scan(scan_id)
except LicenseRequiredError as e:
    print("Ask your company admin to enable:", e.payload)
except RateLimitError as e:
    print("Try again in", e.retry_after, "seconds")

Security notes

Upgrading from 2.x

Version 3.0.0 drops the methods whose endpoints no longer exist and moves others to their current routes. See CHANGELOG.md for every removed and renamed method.

Documentation

Full reference: https://aribot.ayurak.com/developers/sdk/python/

Licence: proprietary. Use of the Aribot service is subject to your agreement with Ayurak.