Arthur Python Client

raw JSON →
1.4.2086 verified Mon Apr 27 auth: no python

Python client library for the Arthur AI monitoring platform. Version 1.4.2086, requires Python >=3.12. Actively maintained, weekly releases.

pip install arthur-client
error ImportError: cannot import name 'ArthurClient' from 'arthur'
cause Incorrect import path: using 'arthur' instead of 'arthur.client'.
fix
Use 'from arthur.client import ArthurClient'.
error AttributeError: module 'arthur.client' has no attribute 'send_trace'
cause The method send_trace is not directly on the ArthurClient class; it's on a monitoring sub-client.
fix
Use client = ArthurClient(...); monitoring = client.monitoring; monitoring.send_trace(trace)
error requests.exceptions.HTTPError: 401 Client Error: Unauthorized
cause Missing or invalid API key.
fix
Ensure ARTHUR_API_KEY environment variable is set or pass api_key to ArthurClient.
breaking Requires Python >=3.12. Projects on Python 3.11 or older will fail to install.
fix Upgrade Python to 3.12+ or pin an older version (e.g., arthur-client<1.0).
deprecated The method 'send_trace' may be deprecated in future versions in favor of 'monitoring.send_trace'. Check changelog.
fix Use from arthur.client.monitoring import MonitoringClient; monitoring_client.send_trace(...)
gotcha API key must be set via environment variable ARTHUR_API_KEY or passed explicitly. Missing key returns 401 but error message may be misleading.
fix Set ARTHUR_API_KEY environment variable or pass api_key parameter.

Initialize client and send a trace to Arthur.

from arthur.client import ArthurClient

client = ArthurClient(api_key=os.environ.get('ARTHUR_API_KEY', ''))
# Example: send a single trace
trace = {
    "id": "trace-001",
    "input": "What is the capital of France?",
    "output": "Paris"
}
result = client.send_trace(trace)
print(result)