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

airflow.providers.anthropic.triggers.agent

Classes

AnthropicAgentSessionTrigger

Poll a Managed Agents session until it reaches a terminal status.

Module Contents

class airflow.providers.anthropic.triggers.agent.AnthropicAgentSessionTrigger(conn_id, session_id, poll_interval, end_time, expect_outcome=False, kickoff_event_id=None)[source]

Bases: airflow.triggers.base.BaseTrigger

Poll a Managed Agents session until it reaches a terminal status.

Parameters:
  • conn_id (str) – The Anthropic connection ID.

  • session_id (str) – The session to poll.

  • poll_interval (float) – Seconds to sleep between polls.

  • end_time (float) – Wall-clock deadline (time.time() epoch seconds). Wall-clock is used deliberately: the trigger is serialized and may resume in a different triggerer process, where a per-process time.monotonic() value is meaningless.

  • expect_outcome (bool) – Whether the session is running a user.define_outcome loop (completion is then judged from outcome_evaluations, not from idle alone).

  • kickoff_event_id (str | None) – ID of the kickoff event, used to correlate the terminal idle event on a message run (defeats the start race).

conn_id[source]
session_id[source]
poll_interval[source]
end_time[source]
expect_outcome = False[source]
kickoff_event_id = None[source]
serialize()[source]

Serialize AnthropicAgentSessionTrigger arguments and class path.

async on_kill()[source]

Archive the session when a user kills the deferred task.

Runs in the triggerer event loop on Airflow 3.3+ (a no-op override on older versions, which never call it). Closes the gap the operator’s on_kill leaves for deferred tasks, which have released their worker slot.

async run()[source]

Poll the session and yield exactly one terminal event.

Was this entry helpful?