Skip to main content

Python SDK for the Adriane agentic graph runtime — one Rust engine, thin per-language SDKs.

Project description

Adriane — Python SDK

A thin, Pythonic SDK over the Adriane Rust engine, exposed through a pyo3 native extension module.

Install adriane-ai, import adriane_ai. The distribution name on PyPI is adriane-ai (hyphen, matching the @adriane-ai npm scope); the import package is adriane_ai (underscore, per PEP 8 — Python module names can't contain a hyphen). This is the standard pip↔import convention.

pip install adriane-ai
import adriane_ai

adriane_ai.engine_version()   # -> the bound Rust engine version, e.g. "0.1.0"

One engine, two SDKs — what to install where

The graph model, validator, and DSL compiler live once in Rust (under crates/). Each language SDK is a thin shim over that single engine, not a re-implementation — so a graph that validates one way in TypeScript validates exactly the same way in Python. There is no second source of truth to drift.

TypeScript Python (this package)
Install npm i @adriane-ai/graph-sdk pip install adriane-ai
Import import { createGraph } from "@adriane-ai/graph-sdk" import adriane_ai
Rust engine optional@adriane-ai/napi activates it; falls back to the in-bundle TS engine when absent built in — the wheel ships the compiled pyo3 extension
Bridge napi-rs (crates/bindings) pyo3 (crates/py-bindings)
Surface full builder + custom handlers + streaming JSON-in / JSON-out: validate, compile, model policy, catalogs, run paths

Both bindings expose the identical JSON-in / JSON-out core (graph validation, DSL compilation, the model policy, the component/prebuilt catalogs, and the fully-Rust run paths). The TypeScript SDK adds a builder and custom node handlers on top; the Python SDK is the thin JSON surface.

API

Graph model & DSL

import adriane_ai

adriane_ai.engine_version()            # -> the bound Rust engine version string

adriane_ai.validate_graph({            # -> list[dict] of validation errors ([] if sound)
    "id": "g", "version": "0.0.0", "name": "g", "channels": {},
    "nodes": [{"id": "a", "type": "action", "label": "a"}],
    "edges": [{"id": "e1", "from": "a", "to": "ghost", "type": "default"}],
    "entryNodeId": "a",
})
# [{'code': 'INVALID_EDGE_REFERENCE', 'message': "Edge 'e1' references unknown node 'ghost'.", 'path': ['e1']}]

adriane_ai.compile_graph_yaml("""    # -> dict (a compiled GraphDefinition)
id: g
version: 0.0.0
name: g
entryNodeId: a
nodes:
  - id: a
    type: action
    label: A
edges: []
channels: {}
""")

validate_graph returns the full list of structural errors (it does not raise on an invalid-but-parseable graph). compile_graph_yaml raises ValueError (adriane_ai.GraphCompileError) when the DSL fails to parse, compile, or validate.

Model policy

adriane_ai.available_providers()       # -> list[str], from process env credentials
# e.g. ["mistral"] when MISTRAL_API_KEY is set; [] when none are.

adriane_ai.resolve_model("fast", available=["mistral"])
# -> {'provider': 'mistral', 'model': 'mistral-small-latest', 'recommended': True}

# Tiers: "frontier" | "balanced" | "fast" | "creative".
# Omit `available` to derive it from the env. A provider/model override wins
# over the policy choice and flags `recommended = False`:
adriane_ai.resolve_model("frontier", available=["anthropic"], provider="mistral", model="mistral-tiny")
# -> {'provider': 'mistral', 'model': 'mistral-tiny', 'recommended': False}

Catalogs

adriane_ai.list_components()   # -> list[str] of the component kinds, e.g. "promptBuilder"
adriane_ai.list_prebuilt()     # -> list[dict] of the 16 prebuilt micro-agents
# each: {'name', 'description', 'tier', 'systemPrompt', 'toolNames',
#        'suspendForApproval', 'outputChannel'}  (camelCase, from the Rust engine)

Run paths (fully on Rust)

Both runs execute end-to-end in Rust — no Python callbacks. When no provider credentials are present in the env, run_prebuilt falls back to a deterministic mock gateway, so a run still completes offline.

adriane_ai.run_component(              # -> dict, the component's channel-update map
    "promptBuilder",
    {"template": "Hello {{name}}!", "into": "prompt"},
    {"name": "Ada"},
)
# {'prompt': 'Hello Ada!'}

adriane_ai.run_prebuilt("summarizer", "please summarise this long text")
# -> {'status': 'completed',
#     'channels': {'input': ..., 'summary': {...}},
#     'resolvedModel': {'provider': 'mock', 'model': 'mock-model'}}

# Ergonomic accessor: each attribute is bound to that agent name.
adriane_ai.prebuilt.summarizer("please summarise this long text")   # same as run_prebuilt("summarizer", ...)
adriane_ai.prebuilt.classifier("is this spam?", provider="mistral") # override forwarded through

run_component and run_prebuilt raise ValueError (adriane_ai.RunError) on an unknown kind/agent, invalid input, or an engine/runtime failure.

Install

A single cp39-abi3 wheel covers CPython 3.9+ (the extension targets the stable ABI), so nothing compiles on the user's machine:

pip install adriane-ai
import adriane_ai
print(adriane_ai.engine_version())

From source (dev)

The package is built with maturin over the Rust workspace crate crates/py-bindings, driven by python/pyproject.toml:

. "$HOME/.cargo/env"
python3 -m venv .venv && source .venv/bin/activate
pip install maturin

cd python
maturin develop            # build the extension + install into the active venv
# …or build a distributable wheel:
maturin build --release    # -> target/wheels/adriane_ai-<version>-cp39-abi3-*.whl

python -c "import adriane_ai; print(adriane_ai.engine_version())"

maturin compiles the pyo3 cdylib and places it as the adriane_ai.adriane submodule — the leaf import name adriane resolves the PyInit_adriane symbol emitted by #[pymodule] fn adriane in crates/py-bindings/src/lib.rs.

Tests

cd python
maturin develop                 # build + install the extension into the venv
python -m pytest tests -q       # if pytest is installed
python tests/test_adriane.py    # plain-assert fallback when pytest is absent

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

adriane_ai-1.13.0-cp39-abi3-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.9+Windows x86-64

adriane_ai-1.13.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

adriane_ai-1.13.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.8 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

adriane_ai-1.13.0-cp39-abi3-macosx_11_0_arm64.whl (2.5 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file adriane_ai-1.13.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: adriane_ai-1.13.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for adriane_ai-1.13.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 91f56eea9b761e023a142bfa2e1064082bbf388843fb565db1927047dfea5928
MD5 4ab2a3d89c1ded136ec44c65e2a872c8
BLAKE2b-256 1835977b33ec77c89a1547161f84be1cb8990cb05c1f343f63acf3b9fb44816e

See more details on using hashes here.

File details

Details for the file adriane_ai-1.13.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for adriane_ai-1.13.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e718f66151263569f707831d36abd4a03cf26ae94b8606b2616228716af52e90
MD5 6eb91d28650b953e80d65f98b7c16f07
BLAKE2b-256 f99d44f38a17719c89dce234b043ec2fa0902a2a4709e24b9261a6e22353bedb

See more details on using hashes here.

File details

Details for the file adriane_ai-1.13.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for adriane_ai-1.13.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b0612191565cb111cb47bb8a57d605576eee8068499e520dc1903b91597fe02e
MD5 455d2e7a07169236ac3166926216057d
BLAKE2b-256 64fa87a6bd1813d4937d8a23e246de6e443004dde72a87a3a6db0c145c663cff

See more details on using hashes here.

File details

Details for the file adriane_ai-1.13.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for adriane_ai-1.13.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5adffe81cdc1fa961e0558dc4764e6dfc005551aba1308c493733c985469eaa3
MD5 7d6ef1bf09f92d6e10eeafa283c69159
BLAKE2b-256 a766fd0ca2d09e1bd5cd2a3f76a8b4bafd42c983ddcfc70b22c4e01ea44dce1c

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