Skip to content

Support [workers] state_store_backend in language SDK tasks #74400

Open

Description

@Andrushika

Description

[workers] state_store_backend lets a deployment keep large task and asset state store values in external storage. In a Python task, the task process calls the backend. On set, it stores the value and writes only a marker like {"__airflow_state_ref__": "<ref>"} to the metadata DB. On get, it reads the value back from that ref (task-sdk/src/airflow/sdk/execution_time/context.py).

Java and Go tasks do not run this code. They send SetTaskStateStore / GetTaskStateStore to the supervisor, and the supervisor stores and returns the value as-is. The Java and Go docs list this as a limitation, and the TypeScript SDK in #73618 has the same note.

Use case/motivation

When [workers] state_store_backend is configured, Task State Store behaves differently for Python tasks and language SDK tasks:

  • When a language SDK task reads a value stored as a backend reference, the supervisor returns the reference as-is instead of resolving it through the configured worker-side backend.
  • When a language SDK task writes a value, the supervisor forwards the unprocessed value to the Execution API, so the full value is stored in the metadata database without invoking the configured worker-side backend.

The backend is implemented as a Python class, so reimplementing it in every language SDK would be impractical. One possible solution is to let the supervisor invoke the backend while handling Task State Store messages, allowing every language SDK to honor the worker configuration without implementing the backend itself.

Python tasks currently invoke the backend inside the task process, so moving or adding this handling to the supervisor requires further design discussion to avoid processing Python requests twice. I would appreciate maintainers' thoughts on the appropriate architecture.

Related issues

related: #73464, #73420, #73618, #74217

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:feature
    needs-triage
    on Oct 7, 2026
  2. adityamukesh commented on Oct 7, 2026

    @adityamukesh

    Hi maintainers, I would like to work on this issue.

    🔍 Analysis & Requirement

    Airflow introduces [workers] state_store_backend to allow deployments to offload large task outputs and asset state values to remote object stores (S3, GCS, DB). However, in external language SDK tasks (Python / custom task execution runners), the task execution wrapper does not currently deserialize or configure the state store backend context, causing tasks relying on external state storage to fail to resolve or store outputs.

    🛠️ Proposed Implementation Plan

    1. Pass State Store Context: Update the task runner environment setup in airflow/task/task_runner/ and Python SDK interfaces to propagate state_store_backend settings.
    2. Initialize Backend: Ensure the worker SDK initializes the appropriate state store client before invoking task entry points.

    🧪 Testing Plan

    • Add unit tests in tests/task/task_runner/ validating that language SDK tasks correctly persist and retrieve values through a configured mock state store backend.

    Could you please assign this issue to me? Thanks!

  3. Andrushika commented on Oct 7, 2026

    @Andrushika
    ContributorAuthor

    This is not a good first issue and need further discussion from maintainers. I suggest finding other issues to solve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:featureneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions