Skip to main content

Python SDK for the Ambertrace neurosymbolic AI platform API

Project description

AmbertraceAI Python SDK

Python client for the Ambertrace neurosymbolic AI platform API.

Install

pip install ambertraceai

Quick Start

from ambertraceai import AmbertraceAPI

api = AmbertraceAPI(
    base_url="https://app.ambertrace.ai",
    api_key="at_...",
)

# Create a domain
domain = api.domains.create(
    name="Legal Contracts",
    description="Contract analysis for risk and compliance",
)

# Upload data
dataset = api.datasets.upload(
    domain_id=domain["id"],
    file_path="contracts.csv",
)

# Build a platform (async — returns a job)
result = api.platforms.create(
    domain_id=domain["id"],
    dataset_id=dataset["id"],
)

# Wait for the build to finish
job = api.wait_for_job(result["job_id"], timeout=600)

# Query the platform
answer = api.platforms.query(
    platform_id=result["platform_id"],
    query="What are the highest-risk clauses?",
)
print(answer["answer"])
print(answer["explanation"])

Resources

Resource Methods
api.domains list, create, get, update, delete, build_ontology
api.datasets list, get, upload, fetch, quality, clean, preview, delete
api.platforms list, create, get, status, query, suggest_rules, list_suggestions, graph
api.predictions predict, list_configs, create_config, train, list_predictions
api.jobs get
api.api_keys list, create, revoke

Agent Keys

AI agents authenticate with user-scoped API keys that give full lifecycle access (domains, datasets, platforms, rules, predictions). A human creates the key from the dashboard; the agent can then create narrower platform-scoped keys for its integrations.

# Agent creates a platform-scoped key for a specific integration
platform_key = api.api_keys.create(
    scope="platform",
    platform_id=42,
    name="Slack Integration",
)

# List keys visible to this agent
keys = api.api_keys.list()

# Revoke a platform key the agent created
api.api_keys.revoke(platform_key["id"])

User-scoped keys cannot create other user-scoped keys (no self-replication). Chat, conversations, and billing remain human-only.

Job Polling

Long-running operations (platform builds, data cleaning, training) return a job_id. Use wait_for_job to poll:

job = api.wait_for_job(job_id, timeout=300, poll_interval=5)
if job["status"] == "error":
    print(f"Failed: {job.get('error_message')}")

Error Handling

from ambertraceai import AmbertraceAPI, AmbertraceError

try:
    api.domains.get(999)
except AmbertraceError as e:
    print(e.status_code)  # 404
    print(e.code)         # "not_found"
    print(str(e))         # "Domain not found."

API Documentation

Full API reference: app.ambertrace.ai/openapi/redoc

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

ambertraceai-0.2.0.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

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

ambertraceai-0.2.0-py3-none-any.whl (107.6 kB view details)

Uploaded Python 3

File details

Details for the file ambertraceai-0.2.0.tar.gz.

File metadata

  • Download URL: ambertraceai-0.2.0.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ambertraceai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e0b4b73c245b41ab6968581101913d8216df9b3dbe49361ab552d7ce3ebfa73e
MD5 f16b23bcf40e479088fd3a642fa53c97
BLAKE2b-256 cdf26c606de6c2627c1a309b1f3e62e8937ce0c1fc420b064a45a5d4d60fcb26

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambertraceai-0.2.0.tar.gz:

Publisher: publish.yml on Pilot-Generative-AI/ambertraceai-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ambertraceai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ambertraceai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 107.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ambertraceai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83f88bd25133f3cf9bf8cc8f3f9f88a13c0c619727b6a9a2bfeebcebdded52ab
MD5 a7e2dcfa89e4a2737f09bb71db022420
BLAKE2b-256 0ce1aa5f0a8889ae50f68ae83379415ea80860eb92dd25f62c0bf7af30569747

See more details on using hashes here.

Provenance

The following attestation bundles were made for ambertraceai-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Pilot-Generative-AI/ambertraceai-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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