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.

Multi-language SDK strategy: one engine, many SDKs

Adriane's graph model, validator, and DSL compiler live once in Rust (under crates/). Every language SDK is a thin shim over that single engine rather than a re-implementation:

  • TypeScript SDK — calls the Rust core via napi-rs (crates/bindings, package adriane-napi).
  • Python SDK (this package) — calls the same Rust core via pyo3 (crates/py-bindings, package adriane-py).

Both bindings expose the identical JSON-in / JSON-out surface (graph validation, DSL compilation, the model policy, the component/prebuilt catalogs, and the fully-Rust run paths), 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.

API

Graph model & DSL

import adriane

adriane.engine_version()            # -> "0.0.1" (the bound Rust engine version)

adriane.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.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.GraphCompileError) when the DSL fails to parse, compile, or validate.

Model policy

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

adriane.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.resolve_model("frontier", available=["anthropic"], provider="mistral", model="mistral-tiny")
# -> {'provider': 'mistral', 'model': 'mistral-tiny', 'recommended': False}

Catalogs

adriane.list_components()   # -> list[str] of the 28 component kinds, e.g. "promptBuilder"
adriane.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.run_component(              # -> dict, the component's channel-update map
    "promptBuilder",
    {"template": "Hello {{name}}!", "into": "prompt"},
    {"name": "Ada"},
)
# {'prompt': 'Hello Ada!'}

adriane.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.prebuilt.summarizer("please summarise this long text")   # same as run_prebuilt("summarizer", ...)
adriane.prebuilt.classifier("is this spam?", provider="mistral") # override forwarded through

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

Install

Once published, the wheel installs from PyPI like any package — 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

Pre-release: not on PyPI yet — build from source (below).

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-0.0.1-cp39-abi3-*.whl

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

maturin compiles the pyo3 cdylib and places it as the adriane.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-0.1.0rc1-cp39-abi3-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

adriane_ai-0.1.0rc1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.6 MB view details)

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

adriane_ai-0.1.0rc1-cp39-abi3-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file adriane_ai-0.1.0rc1-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for adriane_ai-0.1.0rc1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f3bfd77343ac76d98357fe50e3478bb25b735dc74cd36bbede28de611547ecba
MD5 2e7598e47df63540ea5563953a938f45
BLAKE2b-256 2f49f19479eb8ad8ff70efe4e5ca015c1d2339a3b236bd838110d5cb0080a4fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for adriane_ai-0.1.0rc1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 04dba66c60a09bb222f8789ce467b85ae1d3ebe5fa7fcf8136cd19b36f6a4b2c
MD5 eec7e4b739fa7a3487e31a49528742a8
BLAKE2b-256 dd50992dda47657c2f764723e1190a5e269990db5e464b9615924d974e1f26d9

See more details on using hashes here.

File details

Details for the file adriane_ai-0.1.0rc1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for adriane_ai-0.1.0rc1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 778ddd0aae5a8331653e9eb5ad20726d8a9c1b6947297e48d2130dae221afe03
MD5 5ebbba2c447e5854c49435a0218fd6a9
BLAKE2b-256 baea2e17f301459607393a61e538b0696f43b384aa907a33bb36d2489b524902

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