Airflow Summit 2026 is coming August 31 - September 2 in Austin, TX. Register now to secure your spot!

airflow.providers.anthropic.sensors.batch

Classes

AnthropicBatchSensor

Wait for an already-submitted Anthropic Message Batch to reach a terminal status.

Module Contents

class airflow.providers.anthropic.sensors.batch.AnthropicBatchSensor(*, batch_id, conn_id=AnthropicHook.default_conn_name, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), fail_on_partial_error=False, **kwargs)[source]

Bases: airflow.providers.common.compat.sdk.BaseSensorOperator

Wait for an already-submitted Anthropic Message Batch to reach a terminal status.

Pairs with AnthropicBatchOperator(wait_for_completion=False) (or any out-of-band submission) for a fire-and-forget submit + re-entrant await. Because the sensor only polls an existing batch_id, it is naturally idempotent across retries — unlike a submit step, retrying it never creates a new batch.

On a terminal batch it applies the same policy as the operator: a fully-cancelled batch skips the task, and fail_on_partial_error controls whether errored/expired requests fail it.

See also

For more information, take a look at the guide: AnthropicBatchSensor

Parameters:
  • batch_id (str) – The ID of the batch to wait for.

  • conn_id (str) – The Anthropic connection ID to use.

  • deferrable (bool) – Run the sensor in deferrable mode (polls via a trigger).

  • fail_on_partial_error (bool) – If True, fail when any request errored or expired. Defaults to False (succeed and log a warning).

template_fields: collections.abc.Sequence[str] = ('batch_id',)[source]
batch_id[source]
conn_id = 'anthropic_default'[source]
deferrable[source]
fail_on_partial_error = False[source]
property hook: airflow.providers.anthropic.hooks.anthropic.AnthropicHook[source]

Return an instance of the AnthropicHook.

poke(context)[source]

Override when deriving this class.

execute(context)[source]

Derive when creating an operator.

The main method to execute the task. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

execute_complete(context, event=None)[source]

Was this entry helpful?