airflow.providers.common.ai.decorators.agent¶
TaskFlow decorator for agentic LLM workflows.
The user writes a function that returns the prompt string. The decorator handles hook creation, agent configuration with toolsets, multi-turn reasoning, and output serialization.
Functions¶
|
Wrap a function that returns a prompt into an agentic LLM task. |
Module Contents¶
- airflow.providers.common.ai.decorators.agent.agent_task(python_callable=None, **kwargs)[source]¶
Wrap a function that returns a prompt into an agentic LLM task.
The function body constructs the prompt (can use Airflow context, XCom, etc.). The decorator handles hook creation, agent configuration with toolsets, multi-turn reasoning, and output serialization.
Usage:
@task.agent( llm_conn_id="pydanticai_default", system_prompt="You are a data analyst.", toolsets=[SQLToolset(db_conn_id="postgres_default")], ) def analyze(question: str): return f"Answer: {question}"
- Parameters:
python_callable (collections.abc.Callable | None) – Function to decorate.