airflow.providers.common.ai.utils.hitl_review¶
Shared data models, exceptions, and XCom key constants for HITL Review.
Used by both the API-server-side plugin (plugins.hitl_review) and the
worker-side operator mixin (mixins.hitl_review). Depends only on
pydantic and the standard library.
Storage: all session state is persisted as XCom entries on the running task instance. See the XCom key constants below for the key naming scheme.
Attributes¶
These xcom keys are reserved for agentic operator with HITL feedback loop. |
|
Session metadata written by the worker. |
|
Human action command written by the plugin. |
|
Per-iteration AI output (append-only, written by worker). |
|
Per-iteration human feedback (append-only, written by plugin). |
Classes¶
Lifecycle states of a HITL review session. |
|
Single turn in the feedback conversation. |
|
Session metadata stored in the |
|
Human action payload stored in the |
|
Payload for the |
|
API response for a HITL review session (combined from multiple XCom entries). |
Module Contents¶
- airflow.providers.common.ai.utils.hitl_review.HumanActionType[source]¶
These xcom keys are reserved for agentic operator with HITL feedback loop.
- airflow.providers.common.ai.utils.hitl_review.XCOM_AGENT_SESSION = 'airflow_hitl_review_agent_session'[source]¶
Session metadata written by the worker.
Value:
{"status": "...", "iteration": N, "max_iterations": M, "prompt": "...", "current_output": "..."}.
- airflow.providers.common.ai.utils.hitl_review.XCOM_HUMAN_ACTION = 'airflow_hitl_review_human_action'[source]¶
Human action command written by the plugin.
Value:
{"action": "approve"|"reject"|"changes_requested", "feedback": "...", "iteration": N}.
- airflow.providers.common.ai.utils.hitl_review.XCOM_AGENT_OUTPUT_PREFIX = 'airflow_hitl_review_agent_output_'[source]¶
Per-iteration AI output (append-only, written by worker).
Actual key:
airflow_hitl_review_agent_output_1,_2, …
- airflow.providers.common.ai.utils.hitl_review.XCOM_HUMAN_FEEDBACK_PREFIX = 'airflow_hitl_review_human_feedback_'[source]¶
Per-iteration human feedback (append-only, written by plugin).
Actual key:
airflow_hitl_review_human_feedback_1,_2, …
- class airflow.providers.common.ai.utils.hitl_review.SessionStatus[source]¶
-
Lifecycle states of a HITL review session.
- class airflow.providers.common.ai.utils.hitl_review.ConversationEntry(/, **data)[source]¶
Bases:
pydantic.BaseModelSingle turn in the feedback conversation.
- timestamp: datetime.datetime = None[source]¶
- class airflow.providers.common.ai.utils.hitl_review.AgentSessionData(/, **data)[source]¶
Bases:
pydantic.BaseModelSession metadata stored in the
airflow_hitl_review_agent_sessionXCom.Written by the worker only.
- status: SessionStatus[source]¶
- class airflow.providers.common.ai.utils.hitl_review.HumanActionData(/, **data)[source]¶
Bases:
pydantic.BaseModelHuman action payload stored in the
airflow_hitl_review_human_actionXCom.Written by the plugin only. Invalid
actionvalues (e.g. typos like “approved”) fail validation at parse time instead of causing the worker to loop indefinitely.
- class airflow.providers.common.ai.utils.hitl_review.HumanFeedbackRequest(/, **data)[source]¶
Bases:
pydantic.BaseModelPayload for the
POST .../feedbackendpoint.
- class airflow.providers.common.ai.utils.hitl_review.HITLReviewResponse(/, **data)[source]¶
Bases:
pydantic.BaseModelAPI response for a HITL review session (combined from multiple XCom entries).
- status: SessionStatus[source]¶
- conversation: list[ConversationEntry] = [][source]¶