Skip to main content

ordan

The Python client for ORDan, communications infrastructure for autonomous AI agents.

pip install ordan
import os
import ordan

ordan.api_key = os.environ["ORDAN_API_KEY"]

agent = ordan.agents.create(name="Executive Assistant")
line = ordan.lines.create(agent=agent.id, country="US")

call = ordan.calls.create(
    agent=agent.id,
    to="+12125550123",
    objective="Move Tuesday's appointment to Friday afternoon.",
)
# call.status == "authorized"; call.line == "+12125550148"; call.policy == "default_policy_v1"

Python 3.9+, standard library only.

API objects are dicts that also read as attributes: call.status and call["status"] return the same value. Lists have .data and .next_cursor.

Configuration

Configure the module-level client:

  • ordan.api_key falls back to ORDAN_API_KEY. Without one, only the public prices.retrieve() works; every other call raises missing_api_key.
  • ordan.base_url falls back to ORDAN_API_URL, then https://api.ordan.io.
  • ordan.max_retries defaults to 2.
  • ordan.timeout defaults to 60 seconds.

To use several credentials at once, create explicit clients:

from ordan import Ordan

backend = Ordan(api_key="ordan_sk_live_…")       # a project key acts for its agents
assistant = Ordan(api_key="ordan_sk_agent_…")    # an agent credential acts as that agent

Either way, each action passes the agent's grant, its pinned policy and its budget.

Approvals and refusals

try:
    call = ordan.calls.create(agent=agent.id, to=to, objective=objective)
except ordan.ApprovalRequiredError as err:
    # The owner approves err.approval_request (apr_…) in the console, then:
    call = ordan.calls.create(agent=agent.id, to=to, objective=objective, approval=err.approval_request)

Every error is an ordan.OrdanError carrying status, code, message and details. The subclasses are:

  • ApprovalRequiredError
  • PolicyViolationError
  • SpendLimitError: refused, not billed
  • PermissionDeniedError
  • ValidationError
  • AuthenticationError
  • NotFoundError
  • ConflictError
  • RateLimitError
  • APIError
  • APIConnectionError

Retries and idempotency

Every POST sends an Idempotency-Key, so a retry can never place a second call or send a second text.

  • The same key is reused for all retries of that request.
  • Network errors, 408, 429 and 5xx responses are retried with backoff, and Retry-After is honored.
  • Other 4xx responses are never retried.

To tie a request to your own operation, pass idempotency_key="…" to any create.

Resources

  • agents: create, retrieve, list
  • lines: create, retrieve, list, release
  • calls: create, retrieve, list, hangup, answer, transfer
  • messages: create, retrieve, list. list(with_="+1…") returns a conversation.
  • usage: retrieve, ledger
  • events: list
  • policy: check

client.request(method, path, query=…, body=…) reaches endpoints the SDK doesn't wrap yet.

Tests

python3 -m unittest discover -s sdks/python/tests

tests/test_live.py runs the sample above against a real API when ORDAN_TEST_API_URL and ORDAN_TEST_API_KEY are set.

License

Copyright Neuromorph Systems, LLC. All rights reserved. Proprietary software; see LICENSE.

Metadata

Release files for ordan 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ordan 0.1.0
File Size Uploaded Provenance Actions
ordan-0.1.0.tar.gz 18.1 kB Without provenance Details for ordan-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ordan 0.1.0
File Interpreter ABI Platform Actions
ordan-0.1.0-py3-none-any.whl Python 3 none any Details for ordan-0.1.0-py3-none-any.whl

Total release size: 31.3 kB

Release files / ordan-0.1.0.tar.gz

Download URL ordan-0.1.0.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7401d34ac89e8d9947a1e4ef61764dfa23e53c04b22c5cefcb28b58c1c256fee
BLAKE2b-256 checksum
How to use checksums
592e4deb2b3870548ff2bb219061beb5396fe5df4fd382397bd072d08327fa98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ordan-0.1.0-py3-none-any.whl

Download URL ordan-0.1.0-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b386e9d607faa5c0fb0ce0305e2abf878aa957603a7c9d54b3150dad1b1f2353
BLAKE2b-256 checksum
How to use checksums
334279b9bc1d5d27911aae18686d2da9f3bf99e9528394acb78426f044970934
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for ordan 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page