mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-04-20 16:52:08 -05:00
de1ffedf1e
* fix: invalid oltp exporter in python example
* fix: add unwrap for schedule workflow
* Revert "fix: add unwrap for schedule workflow"
This reverts commit e7da2dbd1c.
* add unwrap for schedule workflow
* chore: update ts version, edit py otel doc example
* chore: update python sdk version, changelog, add TS changelog
* fix: lint
16 KiB
16 KiB
Changelog
All notable changes to Hatchet's Python SDK will be documented in this changelog.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[1.22.9] - 2026-01-26
Added
- Adds missing
unwrapforschedule_workflowin OpenTelemetry instrumentor.
[1.22.8] - 2026-01-20
Added
- Adds
HATCHET_CLIENT_WORKER_HEALTHCHECK_EVENT_LOOP_BLOCK_THRESHOLD_SECONDSto configure when the worker healthcheck becomes unhealthy if the listener process event loop is blocked / task runs are not starting promptly.
Removed
- Removes a bunch of Poetry scripts that were mostly used for local development and are not necessary for end users of the SDK.
Changed
- The worker healthcheck server (
/health,/metrics) now runs in the spawned action-listener process (non-durable preferred; durable fallback), instead of the main worker process. - The worker
/healthendpoint now checks for listener connection status and aio event loop health. - The worker
/metricsendpoint now exposes listener-focused metrics likehatchet_worker_listener_health_<worker_name>andhatchet_worker_event_loop_lag_seconds_<worker_name>.
[1.22.7] - 2026-01-19
Added
- Adds
is_in_hatchet_serialization_contextfunction which can be used on a PydanticValidationInfo.contextto determine if the validation/serialization is occurring as a part of Hatchet deserializing task input or serializing task outputs.
[1.22.6] - 2026-01-14
Added
- Adds
max_attempts: int(retries + 1) to the Context
[1.22.5] - 2026-01-09
Added
- Adds an
additional_metadatafield to theget_detailsresponse.
[1.22.4] - 2026-01-08
Added
- Adds a
get_detailsmethod to the runs client
[1.22.3] - 2026-01-07
Changed
- Fixes an issue with the type signature for chained dependencies
- Truncates log messages to 10,000 characters to avoid issues with overly large logs.
[1.22.2] - 2025-12-31
Added
- Crons can now be provided by alias, e.g.
@daily
Changed
- Failed workflow logs are only reported at the
exceptionlevel either on the last retry attempt or if the task is marked asnon_retryable, to avoid spamming e.g. Sentry with exceptions.
[1.22.1] - 2025-12-30
Changed
- Regenerates some API signatures after deprecating many v0 routes.
[1.22.0] - 2025-12-26
Added
- Dependencies are now chainable, so one dependency can rely on an upstream one, similar to in FastAPI.
- Dependencies can now be both functions (sync and async) and context managers (sync and async) to allow for cleaning up things like database connections, etc.
- The
ClientConfighas a newTenacityobject, which allows for specifying retry config. - Concurrency limits can now be specified as integers, which will provide behavior equivalent to setting a constant key with a
GROUP_ROUND_ROBINstrategy.
Changed
- Improves the errors raised out of the sync
resultmethod on theWorkflowRunRefto be more in line with the async version, raising aFailedTaskRunExceptionGroupthat contains all of the task run errors instead of just the first one.
Internal
- Replaces manual validation logic with Pydantic's
TypeAdapterfor improved correctness and flexibility.
[1.21.8] - 2025-12-26
Changed
- Fixes a bug where static rate limits reset their own values to zero on task registration.
[1.21.7] - 2025-12-15
Added
- Adds a
getmethod to the event client
[1.21.6] - 2025-12-11
Added
- Adds
get_task_statsandaio_get_task_statsmethods to themetricsfeature client.
Changed
- Regenerates the REST and gRPC clients to pick up latest API changes.
[1.21.5] - 2025-12-06
Changed
- Task outputs that fail to serialize to JSON will now raise an
IllegalTaskOutputErrorinstead of being stringified. This pulls errors from the engine upstream to the SDK, and will allow users to catch and handle these errors more easily.
[1.21.4] - 2025-12-05
Added
- Adds support for dynamic rate limits using CEL expressions (strings) for the
limitparameter.
Changed
- Fixes a serialization error caused by Pydantic sometimes being unable to encode bytes, reported here: https://github.com/hatchet-dev/hatchet/issues/2601
- Fixes a bug where string-based CEL expressions for
limitwere rejected due to the validation logic.
[1.21.3] - 2025-11-26
Added
- Adds GZIP compression for gRPC communication between the SDK and the Hatchet engine to reduce bandwidth usage.
[1.21.2] - 2025-11-13
Added
- Adds an OTel option to allow you to include the action name in the root span name for task runs.
Changed
- Span kinds (e.g. producer, consumer) have been added to OpenTelemetry spans created by the SDK to better reflect their roles.
[1.21.1] - 2025-11-08
Changed
- The
listmethods for the logs client now allow for pagination via thelimit,since, anduntilparams.
[1.21.0] - 2025-10-31
Added
- Adds support for dataclasses as input validators for workflows (and tasks), and also as output validators for tasks.
Changed
- Fixes a bug where an exception in a lifespan would cause the lifespan to hang indefinitely.
[1.20.2] - 2025-10-15
Added
- Adds a
include_payloadsparameter to thelistmethods on the runs client (defaults to true, so no change in behavior).
[1.20.1] - 2025-10-14
Added
- Adds wrapper methods for bulk cancelling / replaying large numbers of runs with pagination.
[1.20.0] - 2025-10-3
Removed
- Removes all references to
get_group_key_*which is no longer available in V1 - Removes all checks + references to V0
[1.19.0] - 2025-09-24
Removed
- Removed the deprecated
v0client and all related code. - Removed unused dependencies.
[1.18.1] - 2025-08-26
Changed
- Fixes an install issue caused by a misnamed optional dependency.
[1.18.0] - 2025-08-26
Added
- Adds a
stubsclient on the mainHatchetclient, which allows for creating typed stub tasks and workflows. These are intended to be used for triggering workflows that are registered on other workers in either other services or other languages. - Adds a config option
force_shutdown_on_shutdown_signalwhich allows users to forcefully terminate all processes when a shutdown signal is received instead of waiting for them to exit gracefully.
[1.17.2] - 2025-08-20
Added
- Adds back an optional
cel-pythondependency for v0 compatibility, allowing users to use the v0 client with the v0-compatible features in the SDK. - Adds
dependenciesto themock_runmethods on theStandalone. - Removes
aiostreamdependency that was unused. - Removes
aiohttp-retrydependency that was unused.
[1.17.1] - 2025-08-18
Added
- Adds a
HATCHET_CLIENT_LOG_QUEUE_SIZEenvironment variable to configure the size of the log queue used for capturing logs and forwarding them to Hatchet
[1.17.0] - 2025-08-12
Added
- Adds support for dependency injection in tasks via the
Dependsclass. - Deprecated
fetch_task_run_errorin favor ofget_task_run_error, which returns aTaskRunErrorobject instead of a string. This allows for better error handling and debugging.
Changed
- Uses
logger.exceptionin place oflogger.errorin the action runner to improve (e.g.) Sentry error reporting - Extends the
TaskRunErrorto include thetask_run_external_id, which is useful for debugging and tracing errors in task runs. - Fixes an issue with logging which allows log levels to be respected over the API.
Removed
- Removes the
cel-pythondependency
[1.16.5] - 2025-08-07
Changed
- Relaxes constraint on Prometheus dependency
[1.16.4] - 2025-07-28
Added
- Adds a new config option
grpc_enable_fork_supportto allow users to enable or disable gRPC fork support. This is useful for environments where gRPC fork support is not needed or causes issues. Previously was set toFalseby default, which would cause issues with e.g. Gunicorn setups. Can also be set with theHATCHET_CLIENT_GRPC_ENABLE_FORK_SUPPORTenvironment variable.
Changed
- Changes
ValidTaskReturnTypeto allowMapping[str, Any]instead ofdict[str, Any]to allow for more flexible return types in tasks, including usingTypedDict.
[1.16.3] - 2025-07-23
Added
- Adds support for filters and formatters in the logger that's passed to the Hatchet client.
- Adds a flag to disable log capture.
Changed
- Fixes a bug in
aio_sleep_forand theSleepConditionthat did not allow duplicate sleeps to be awaited correctly. - Stops retrying gRPC requests on 4XX failures, since retrying won't help
[1.16.2] - 2025-07-22
Added
- Adds an
input_validatorproperty toBaseWorkflowwhich returns a typechecker-aware version of the validator class.
[1.16.1] - 2025-07-18
Added
- Adds a
CELfeature client for debugging CEL expressions
[1.16.0] - 2025-07-17
Added
- Adds new methods for unit testing tasks and standalones, called
mock_runandaio_mock_run, which allow you to run tasks and standalones in a mocked environment without needing to start a worker or connect to the engine. - Improves exception logs throughout the SDK to provide more context for what went wrong when an exception is thrown.
- Adds
create_run_ref,get_result, andaio_get_resultmethods to theStandaloneclass, to allow for getting typed results of a run more easily. - Adds
return_exceptionsoption to therun_manyandaio_run_manymethods to be more similar to e.g.asyncio.gather. IfTrue, exceptions will be returned as part of the results instead of raising them.
Changed
- Correctly propagates additional metadata through the various
runmethods to spawned children.
[1.15.3] - 2025-07-14
Changed
remove_null_unicode_characternow accepts any type of data, not just strings, dictionaries, lists, and tuples. If the data is not one of these types, it's returned as-is.
[1.15.2] - 2025-07-12
Changed
- Fixes an issue in
capture_logswhere thelogcall was blocking the event loop.
[1.15.1] - 2025-07-11
Added
- Correctly sends SDK info to the engine when a worker is created
[1.15.0] - 2025-07-10
Added
- The
Metricsclient now includes a method to scrape Prometheus metrics from the tenant.
Changed
- The
Metricsclient'sget_task_metricsandget_queue_metricsnow return better-shaped, correctly-fetched data from the API.
[1.14.4] - 2025-07-09
Added
- Adds
deleteandaio_deletemethods to the workflows feature client and the correspondingWorkflowandStandaloneclasses, allowing for deleting workflows and standalone tasks.
[1.14.3] - 2025-07-07
Added
- Adds
remove_null_unicode_characterutility function to remove null unicode characters from data structures.
Changed
- Task outputs that contain a null unicode character (\u0000) will now throw an exception instead of being serialized.
- OpenTelemetry instrumentor now correctly reports exceptions raised in tasks to the OTel collector.
[1.14.2] - 2025-07-03
Added
- The
Runsclient now haslist_with_paginationandaio_list_with_paginationmethods that allow for listing workflow runs with internal pagination. The wrappers on theStandaloneandWorkflowclasses have been updated to use these methods. - Added retries with backoff to all of the REST API wrapper methods on the feature clients.
[1.14.1] - 2025-07-03
Changed
DurableContext.aio_wait_forcan now accept an or group, in addition to sleep and event conditions.
[1.14.0] - 2025-06-25
Added
- Adds an
IllegalTaskOutputErrorthat handles cases where tasks return invalid outputs. - Logs
NonRetryableExceptionas an info-level log so it doesn't get picked up by Sentry and similar tools.
Changed
- Exports
NonRetryableExceptionat the top level - Fixes an issue with the
statusfield throwing a Pydantic error when callingworker.get - Fixes an issue with duplicate protobufs if you try to import both the v1 and v0 clients.
[1.13.0] - 2025-06-25
Added
- Documentation for the
Contextclasses - Allows for a worker to be terminated after a certain number of tasks by providing the
terminate_worker_after_num_tasksconfig option
Changed
- Adds a number of helpful Ruff linting rules
DedupeViolationErris nowDedupeViolationError- Fixed events documentation to correctly have a skipped run example.
- Changed default arguments to many methods from mutable defaults like
[]to None - Changes
JSONSerializableMappingfromMappingtodict - Handles some potential bugs related to
asynciotasks being garbage collected. - Improves exception printing with an
ExceptionGroupimplementation - Fixes a bug with namespacing of user event conditions where the namespace was not respected so the task waiting for it would hang
- Fixes a memory leak in streaming and logging, and fixes some issues with log capture.
[1.12.3] - 2025-06-25
Changed
- Fixes a namespacing-related but in the
workflow.idproperty that incorrectly (and inconsistently) returned incorrect IDs for namespaced workflows.
[1.12.2] - 2025-06-17
Changed
- Fixes a security vulnerability by bumping the
protobuflibrary
[1.12.1] - 2025-06-13
Added
- Adds corresponding SDK changes from API changes to events (additional parameters to filter events by, additional data returned)
[1.12.0] - 2025-06-06
Added
- Adds a warning on client init if the SDK version is not compatible with the tenant (engine) version.
- Adds a
default_filtersparameter to theHatchet.workflowandHatchet.taskmethods to allow you to declaratively provide a list of filters that will be applied to the workflow by default when events are pushed. - Adds
get_statusandaio_get_statusmethods to theRunsfeature client, which return a workflow run's status by its ID. - Adds a
updatemethods to theFiltersfeature client.
Changed
- Allows the
concurrencyparameter to tasks to be alist. - Fixes an internal bug with duplicate concurrency expressions being set when using
Hatchet.task. - Modifies existing
datetimehandling to use UTC timestamps everywhere.
[1.11.1] - 2025-06-05
Changed
- Fixes a couple of blocking calls buried in the admin client causing loop blockages on child spawning
[1.11.0] - 2025-05-29
Changed
- Significant improvements to the OpenTelemetry instrumentor, including:
- Traceparents are automatically propagated through the metadata now so the client does not need to provide them manually.
- Added a handful of attributes to the
run_workflow,push_event, etc. spans, such as the workflow being run / event being pushed, the metadata, and so on. Ignoring - Added tracing for workflow scheduling
[1.10.2] - 2025-05-19
Changed
- Fixing an issue with the spawn index being set at the
workflow_run_idlevel and not the(workflow_run_id, retry_count)level, causing children to be spawned multiple times on retry.
[1.10.1] - 2025-05-16
Added
- Adds an
otelitem to theClientConfigand aexcluded_attributes: list[OTelAttribute]there to allow users to exclude certain attributes from being sent to the OpenTelemetry collector.
[1.10.0] - 2025-05-16
Added
- The main
Hatchetclient now has afiltersattribute (aFiltersclient) which wraps basic CRUD operations for managing filters. - Events can now be pushed with a
priorityattribute, which sets the priority of the runs triggered by the event. - There are new
listandaio_listmethods for theEventsclient, which allow listing events. - Workflow runs can now be filtered by
triggering_event_external_id, to allow for seeing runs triggered by a specific event. - There is now an
idproperty on allWorkflowobjects (Workflowcreated byhatchet.workflowandStandalonecreated byhatchet.task) that returns the ID (UUID) of the workflow. - Events can now be pushed with a
scopeparameter, which is required for using filters to narrow down the filters to consider applying when triggering workflows from the event.
Changed
- The
nameparameter tohatchet.taskandhatchet.durable_taskis now optional. If not provided, the task name will be the same as the function name.