Requirements
- Python 3.10 or higher
pip,poetry, oruv
Installation
OpenTelemetry extra
Install the optionalotel extra to enable distributed tracing with OpenTelemetry:
opentelemetry-api, opentelemetry-sdk, opentelemetry-instrumentation, opentelemetry-distro, opentelemetry-exporter-otlp, and opentelemetry-exporter-otlp-proto-http.
Setup
Get an API token
Obtain your API token from the Hatchet Cloud dashboard or your self-hosted Hatchet instance.The token is a JWT that embeds your tenant ID and server addresses, so the SDK can read them automatically.
Set environment variables
Export your token so the SDK can pick it up automatically:For self-hosted deployments, also set the host and port:The SDK also reads from
.env, .env.hatchet, .env.dev, and .env.local files automatically.Initialize the client
Import Enable debug logging by passing
Hatchet and create an instance. With the environment variable set, no additional configuration is needed:debug=True:Environment variable reference
| Variable | Description | Default |
|---|---|---|
HATCHET_CLIENT_TOKEN | API token (required) | — |
HATCHET_CLIENT_HOST_PORT | gRPC server host and port | Read from token |
HATCHET_CLIENT_NAMESPACE | Namespace prefix for workflow and event names | "" |
HATCHET_CLIENT_TLS_STRATEGY | TLS strategy (tls or none) | "tls" |
The SDK validates that
HATCHET_CLIENT_TOKEN starts with ey (a valid JWT prefix). Tokens from the dashboard start with ey — if you see an error about token format, ensure you are not using a non-JWT token.