Official SDK for the Arcane public API
Project description
arcane-sdk
Official Python SDK for the Arcane public API.
Installation
pip install arcane-sdk
Quick Start
Sync client
from arcane_sdk import ArcaneClient
client = ArcaneClient(
base_url="https://your-instance.example.com",
api_key="your-api-key",
)
# List prompts
prompts = client.prompts.list()
# Get a dataset (paginated rows)
dataset = client.datasets.get("dataset-uuid", {"page": 1, "limit": 20})
# Iterate over all rows without loading everything
for row in client.datasets.list_rows_paginated("dataset-uuid"):
print(row["values"])
# Add a row
new_row = client.datasets.add_row("dataset-uuid", ["input1", "input2", "expected"])
# Search traces
search_result = client.traces.search("datasource-uuid", {"limit": 100})
# Iterate over experiment results (paginated, memory-efficient)
for result in client.experiments.list_results_paginated("experiment-uuid"):
print(result["dataset_row"], result["experiment_result"])
Async client
import asyncio
from arcane_sdk import ArcaneClientAsync
async def main():
async with ArcaneClientAsync(
base_url="https://your-instance.example.com",
api_key="your-api-key",
) as client:
prompts = await client.prompts.list()
datasets = await client.datasets.list()
async for result in client.experiments.list_results_paginated(
"experiment-uuid"
):
print(result)
asyncio.run(main())
Authentication
Use a project-scoped API key. Create one in the Arcane UI under Project → API Keys.
The SDK uses HTTP Basic Auth with username api-key and the API key as the password.
Resources
| Resource | Methods |
|---|---|
prompts |
list(), get(id), list_versions(id), get_latest_version(id) |
datasources |
list() |
traces |
search(), get(), get_attribute_names(), get_attribute_values() |
datasets |
list(), get(id, params?), list_rows_paginated(id), add_row(id, values) |
entities |
list(), get(id) |
evaluations |
list(), get(id), get_experiment_scores(), create(), create_result() |
experiments |
list(), get(id), list_results(), list_results_paginated(), create(), create_result() |
Async iterators
For paginated experiment results:
# Sync
for result in client.experiments.list_results_paginated(experiment_id):
...
# Async
async for result in client.experiments.list_results_paginated(experiment_id):
...
For paginated dataset rows:
# Sync
for row in client.datasets.list_rows_paginated(dataset_id):
print(row["values"])
# Async
async for row in client.datasets.list_rows_paginated(dataset_id):
print(row["values"])
Error handling
from arcane_sdk import ArcaneClient, ArcanApiError, ArcanNotFoundError
try:
client.datasets.get("invalid-id")
except ArcanNotFoundError:
print("Dataset not found")
except ArcanApiError as e:
print(e.status_code, e.message, e.request_id)
Retries
The SDK automatically retries on HTTP 5xx and network errors.
Configure with max_retries (default: 3):
client = ArcaneClient(
base_url="https://api.example.com",
api_key="...",
max_retries=5,
)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file arcane_sdk-0.1.0.tar.gz.
File metadata
- Download URL: arcane_sdk-0.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c2244a1ab6cfb4f89d3ed395bd5987ade6a4595fb2711e16c7e46780447ab9f
|
|
| MD5 |
2084d66be55e3f3e7668ee523273f4ea
|
|
| BLAKE2b-256 |
84faa1f41e5a8d3310399419fb2dc4ccfeb0567260f985140a019c40af1e513d
|
File details
Details for the file arcane_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: arcane_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
456b7443f0b73454f7d1122f3a883245e42590c6581e0f2f0e76ee07e558e10c
|
|
| MD5 |
24d78454729b8df6c5e2b208847e848d
|
|
| BLAKE2b-256 |
4d8d18677f64c94deac61605abecb1d4840c26fb03823d02e27d613266ec957f
|