Common AI Hooks
The common-ai provider ships hooks that bridge an Airflow connection to a specific
LLM framework’s model objects. Each hook is a thin adapter: it reads credentials and
config from the connection, then returns native framework objects (a pydantic_ai
Agent / Model, a LangChain BaseChatModel or Embeddings, an MCP client,
…). Operators and @task decorators in this provider use these hooks internally.
Choosing a hook
Hook |
When to use |
PydanticAIHook
|
Default for common.ai operators (LLMOperator, AgentOperator,
LLMBranchOperator, …). Returns a pydantic-ai Agent / Model. |
LangChainHook
|
Direct LangChain access for tasks that compose Runnable\s, use the
LangChain agent surface, or need LangChain-native chat / embedding model
objects. Independent of the pydantic-ai-backed operators. |
LlamaIndexHook
|
Backs the LlamaIndex LlamaIndexEmbeddingOperator and
LlamaIndexRetrievalOperator.
Returns LlamaIndex-native BaseEmbedding / LLM objects (OpenAI
by default). For non-OpenAI vendors, pass a pre-built
BaseEmbedding / LLM instance straight to the operator and
bypass the hook. |
MCPHook
|
Backs MCPToolset (see Toolsets — Airflow Hooks as AI Agent Tools) for agent tasks that call
tools on a remote MCP server. Configure the connection via
MCP Server Connection. |