Skip to main content

orchestrator-client

Python client for the DAMIT AIOps Orchestrator REST API and Socket.IO realtime events.

Install

pip install orchestrator-client

Requires Python >= 3.12.

Quick Start

from orchestrator_client import Orchestrator

client = Orchestrator(base_url="http://localhost:8080")

# Create a task
task = client.create_task(
    workflow_id="proactive",
    goal_prompt="Analyze system logs for errors",
    max_iterations=50,
)
print(f"Created: {task.task_id}")

# Poll status
status = client.get_task_status(task.task_id)
print(f"Status: {status.status}, iteration {status.iteration}/{status.max_iterations}")

# List tasks
tasks = client.list_tasks(workflow_id="proactive", limit=10)
for t in tasks.tasks:
    print(f"  {t.id}: {t.status}")

# Cancel
client.cancel_task(task.task_id)

client.close()

Authentication

The SDK sends a bearer token on every request when configured; the Socket.IO client carries it in the handshake (auth.token) so the server can authenticate the connection under socket_auth_policy: strict:

from orchestrator_client import Orchestrator
from orchestrator_client.socketio import RealtimeClient

# REST: static token on every request
client = Orchestrator(base_url="http://localhost:8080", api_key="<keycloak-token>")

# Realtime: static token, or a callable (re-invoked on every connect/reconnect)
rt = RealtimeClient("http://localhost:8080", get_token=lambda: get_token_from_memory())
await rt.connect()

When neither is set, no Authorization header / auth payload is sent — the SDK behaves exactly as before.

Dynamic service tokens (ServiceTokenSource)

For gateway-relayed integration apps, the Keycloak JWT is minted via the client-credentials grant and sent as X-Authorization on REST requests alongside the gateway key in Authorization (the gateway strips only Authorization). The static api_key is not used for authentication in this mode:

from orchestrator_client import OrchestratorAsync
from orchestrator_client import ServiceTokenSource

source = ServiceTokenSource(
    base_url="http://localhost:8080",   # optional if KEYCLOAK_URL/KEYCLOAK_REALM are set
    client_id="ai-wiki",
    client_secret="<service-secret>",
)
client = OrchestratorAsync(base_url="http://localhost:8080", x_token_getter=source.get_token)

The getter is resolved per request and re-invoked on every connect/reconnect, so an expired JWT refreshes itself. ServiceTokenSource caches the mint with a freshness margin and a negative cache, and raises KeycloakTokenError on failure (fetch rejection, non-OK response, malformed payload, negative-cache hit). Close the source on shutdown (await source.aclose()) when it owns its HTTP client.

RealtimeClient

The RealtimeClient carries credentials in the Socket.IO handshake auth payload:

  • get_token — a static token (auth.token) or a callable re-invoked on every connect/reconnect (async callables are awaited);
  • api_key — the gateway API key, sent as Authorization: Bearer <key> in the auth payload next to token, for gateway deployments that validate the handshake against the gateway key alongside the JWT.
from orchestrator_client.socketio import RealtimeClient

rt = RealtimeClient(
    "http://localhost:8080",
    get_token=lambda: get_token_from_memory(),
    api_key="<gateway-key>",
)
await rt.connect()

Token-getter failures are contained: a throwing getter degrades to an unauthenticated handshake, which the server rejects — the client never hangs on the connect.

Environment Variables

Variable Default Description
ORCHESTRATOR_URL http://localhost:8080 Base URL (supports subpath)
ORCHESTRATOR_API_KEY — Optional bearer token
ORCHESTRATOR_TIMEOUT 30.0 HTTP timeout (seconds)
ORCHESTRATOR_MAX_RETRIES 3 Max retry attempts

SSL / Self-Signed Certificates

For orchestrator instances behind HTTPS with self-signed certificates, pass verify_ssl=False:

from orchestrator_client import Orchestrator

client = Orchestrator(
    base_url="https://orchestrator.internal:8443",
    verify_ssl=False,
)

Or inject a pre-configured httpx.AsyncClient for full control:

import httpx
from orchestrator_client import OrchestratorAsync

custom = httpx.AsyncClient(verify=False, timeout=httpx.Timeout(60.0))
client = OrchestratorAsync(http_client=custom)

## Async Variant

For use inside async code (e.g. FastAPI, asyncio scripts):

```python
from orchestrator_client import OrchestratorAsync

async with OrchestratorAsync() as client:
    status = await client.get_task_status("task-abc123")

Prompt assets

The prompt-asset registry is admin-only on the API side; these methods mirror GET/PUT/DELETE /prompt-assets and POST /prompt-assets. A deployment-local skill is an override row with no repo file, so it is created, edited, disabled and deleted through the same surface. The key keeps its : and / characters literal (skill:utilization, sections/agent/action_risk), and an omitted base_hash lets the API default it to the current default hash.

assets = client.list_prompt_assets()
detail = client.get_prompt_asset("skill:utilization")
client.set_prompt_asset_override("sections/agent/action_risk", "Never delete production data.\n")
client.set_prompt_asset_override(
    "sections/agent/action_risk",
    "Override.\n",
    base_hash=detail.default_hash,
)
client.set_prompt_asset_override("skill:utilization", "Override.\n", enabled=False)
client.delete_prompt_asset_override("skill:utilization")
client.create_local_skill("---\nname: my-skill\n---\n# body\n")

Exceptions

All inherit from OrchestratorError and carry status_code and error_code:

Exception Meaning
OrchestratorConnectionError Network / DNS / timeout
OrchestratorAuthError 401/403
OrchestratorNotFoundError 404
OrchestratorAPIError 400/500 with error code
OrchestratorConfigError Bad env vars / missing config

Documentation

Detailed docs with full method listings and examples:

Testing

pip install -e ".[dev]"
pytest

License

Apache 2.0

Metadata

Release files for orchestrator-client 6.4.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 orchestrator-client 6.4.0
File Size Uploaded Provenance Actions
orchestrator_client-6.4.0.tar.gz 122.5 kB With provenance Details for orchestrator_client-6.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for orchestrator-client 6.4.0
File Interpreter ABI Platform Actions
orchestrator_client-6.4.0-py3-none-any.whl Python 3 none any Details for orchestrator_client-6.4.0-py3-none-any.whl

Total release size: 212.9 kB

Release files / orchestrator_client-6.4.0.tar.gz

Download URL orchestrator_client-6.4.0.tar.gz
Size 122.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d87b6885418869eb3d842f3c1eed8749c66f638fb78ea53442f49058955356c2
BLAKE2b-256 checksum
How to use checksums
df602bf7888aad39a1f566bb1e161a286323cb68c76972d3da7b62b91a0520d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / orchestrator_client-6.4.0-py3-none-any.whl

Download URL orchestrator_client-6.4.0-py3-none-any.whl
Size 90.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
680508db3d0e688b26e20529a05e9328f80b0fd740af479d5e52f6b0b90f9242
BLAKE2b-256 checksum
How to use checksums
04756de24c9426f742ddcfe6232663d71da8aa2eeb20e50a97156eaeed86c684
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for orchestrator-client 6.4.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for orchestrator_client-6.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

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

6.4.0 This release

2 release files Full 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