Initializing the client
Hatchet constructor accepts the following parameters:
Enable debug-level logging for the client and worker.
A
ClientConfig instance with explicit configuration. When None, the client reads configuration from environment variables and .env files.ClientConfig
ClientConfig is a Pydantic settings model that can be constructed programmatically or populated from environment variables (prefixed with HATCHET_CLIENT_).
Fields
Your Hatchet API token (a JWT). Required — the client will raise a
ValueError if it is not set or is not a valid JWT.The gRPC server address, e.g.
"localhost:7070". When not explicitly set, the value is read from the token’s embedded address.A namespace prefix applied to all workflow names and event keys. The SDK appends a trailing underscore automatically — e.g.
"myapp" becomes "myapp_". Set via HATCHET_CLIENT_NAMESPACE.The tenant ID. When not set, it is extracted from the JWT automatically.
TLS settings. Configured via
HATCHET_CLIENT_TLS_* environment variables. Key fields:strategy—"tls"(default) or"none"cert_file,key_file,root_ca_file— paths to certificate filesserver_name— override the TLS server name (defaults to the host)
Maximum gRPC receive message size in bytes. Default is 4 MB.
Maximum gRPC send message size in bytes. Default is 4 MB.
Feature client properties
All feature clients are exposed as properties on theHatchet instance. Each client wraps a specific area of the Hatchet API.
| Property | Type | Description |
|---|---|---|
hatchet.runs | RunsClient | List, get, cancel, and replay task and workflow runs. |
hatchet.cron | CronClient | Create and manage cron workflow triggers. |
hatchet.scheduled | ScheduledClient | Create and manage one-off scheduled workflow runs. |
hatchet.webhooks | WebhooksClient | Create and manage incoming webhook endpoints. |
hatchet.workers | WorkersClient | List, get, pause, and unpause workers. |
hatchet.workflows | WorkflowsClient | List, get, and delete workflow declarations. |
hatchet.event | EventClient | Push events that trigger event-based workflows. |
hatchet.logs | LogsClient | Access run log lines. |
hatchet.metrics | MetricsClient | Read Hatchet metrics. |
hatchet.rate_limits | RateLimitsClient | Work with rate limit configurations. |
hatchet.cel | CELClient | Evaluate CEL expressions against Hatchet’s CEL API. |
hatchet.filters | FiltersClient | Create and manage workflow run filters. |
Helper properties
Getting context inside a task
Usehatchet.get_current_context() to retrieve the active Context from anywhere in the call stack during task execution:
get_current_context() returns None when called outside of task execution.