Under which category would you file this issue?
Providers
Apache Airflow version
Not version-specific — reproducible on any version shipping apache-airflow-providers-common-ai with PydanticAIAzureHook, PydanticAIBedrockHook, or PydanticAIVertexHook.
What happened and how to reproduce it?
Connection.get_hook() raises AirflowException: Unknown hook type "pydanticai_azure" (or
pydanticai_bedrock / pydanticai_vertex) whenever the connection is stored as a URI in a
secrets backend such as HashiCorp Vault or AWS Secrets Manager.
Stack trace:
AirflowException: Unknown hook type "pydanticai_azure"
File ".../airflow/sdk/execution_time/task_runner.py", line 1579 in _run_task_and_map_outcome
File ".../airflow/sdk/definitions/connection.py", line 223 in get_hook
How to reproduce:
- Store a connection whose type is
pydanticai-azure as a URI in a secrets backend
(e.g. pydanticai-azure://<host>?... in HashiCorp Vault).
- Reference that connection from a Dag using
@task.agent / AgentOperator.
- The task fails with
Unknown hook type "pydanticai_azure".
The bug does not reproduce when the connection is stored in the metadata DB directly, because
in that case conn_type is stored as a plain field and never passes through URI normalization.
Root cause:
Connection.get_uri() serializes conn_type with hyphens to produce a valid URI scheme:
uri = f"{self.conn_type.lower().replace('_', '-')}://"
Connection._normalize_conn_type() is the intended reverse — it converts hyphens back to
underscores when a URI is parsed:
elif "-" in conn_type:
conn_type = conn_type.replace("-", "_")
This round-trip works correctly for every other multi-word hook in the codebase because they all
declare their conn_type with underscores:
| Hook |
conn_type |
URI scheme |
| Azure Data Factory |
azure_data_factory |
azure-data-factory:// |
| Google Cloud Platform |
google_cloud_platform |
google-cloud-platform:// |
| Hive CLI |
hive_cli |
hive-cli:// |
| Spark Connect |
spark_connect |
spark-connect:// |
The three pydantic-ai hooks are the only outliers in the entire provider tree — they declare
their conn_type with hyphens in both provider.yaml and the hook class:
# providers/common/ai/hooks/pydantic_ai.py
class PydanticAIAzureHook(...):
conn_type = "pydanticai-azure" # ← hyphen; all other multi-word hooks use underscore
class PydanticAIBedrockHook(...):
conn_type = "pydanticai-bedrock"
class PydanticAIVertexHook(...):
conn_type = "pydanticai-vertex"
# providers/common/ai/provider.yaml
connection-type: pydanticai-azure
connection-type: pydanticai-bedrock
connection-type: pydanticai-vertex
So the broken round-trip is:
URI from secrets backend : "pydanticai-azure://..."
→ _normalize_conn_type() → "pydanticai_azure" (underscore form)
→ hooks.get("pydanticai_azure") → None (hook is registered under "pydanticai-azure")
→ AirflowException: Unknown hook type "pydanticai_azure"
What you think should happen instead?
The three hook conn_type attributes and the corresponding provider.yaml connection-type
entries should be renamed to use underscores, consistent with every other multi-word provider:
| Current |
Proposed |
pydanticai-azure |
pydanticai_azure |
pydanticai-bedrock |
pydanticai_bedrock |
pydanticai-vertex |
pydanticai_vertex |
default_conn_name values already use underscores (pydanticai_azure_default) so those are
unaffected.
Since these providers are relatively new, migration impact should be limited. A
_normalize_conn_type alias (like the existing postgresql → postgres entry) could be added
as a compatibility shim for users who already have connections stored with the hyphenated type.
Operating System
Redhat 44
Deployment
Official Apache Airflow Helm Chart
Apache Airflow Provider(s)
common-ai
Versions of Apache Airflow Providers
All versions shipping PydanticAIAzureHook, PydanticAIBedrockHook, or PydanticAIVertexHook.
Official Helm Chart version
1.22.0 (latest released)
Kubernetes Version
No response
Helm Chart configuration
No response
Docker Image customizations
No response
Anything else?
No response
Are you willing to submit PR?
Code of Conduct
Under which category would you file this issue?
Providers
Apache Airflow version
Not version-specific — reproducible on any version shipping
apache-airflow-providers-common-aiwithPydanticAIAzureHook,PydanticAIBedrockHook, orPydanticAIVertexHook.What happened and how to reproduce it?
Connection.get_hook()raisesAirflowException: Unknown hook type "pydanticai_azure"(orpydanticai_bedrock/pydanticai_vertex) whenever the connection is stored as a URI in asecrets backend such as HashiCorp Vault or AWS Secrets Manager.
Stack trace:
How to reproduce:
pydanticai-azureas a URI in a secrets backend(e.g.
pydanticai-azure://<host>?...in HashiCorp Vault).@task.agent/AgentOperator.Unknown hook type "pydanticai_azure".The bug does not reproduce when the connection is stored in the metadata DB directly, because
in that case
conn_typeis stored as a plain field and never passes through URI normalization.Root cause:
Connection.get_uri()serializesconn_typewith hyphens to produce a valid URI scheme:Connection._normalize_conn_type()is the intended reverse — it converts hyphens back tounderscores when a URI is parsed:
This round-trip works correctly for every other multi-word hook in the codebase because they all
declare their
conn_typewith underscores:conn_typeazure_data_factoryazure-data-factory://google_cloud_platformgoogle-cloud-platform://hive_clihive-cli://spark_connectspark-connect://The three pydantic-ai hooks are the only outliers in the entire provider tree — they declare
their
conn_typewith hyphens in bothprovider.yamland the hook class:So the broken round-trip is:
What you think should happen instead?
The three hook
conn_typeattributes and the correspondingprovider.yamlconnection-typeentries should be renamed to use underscores, consistent with every other multi-word provider:
pydanticai-azurepydanticai_azurepydanticai-bedrockpydanticai_bedrockpydanticai-vertexpydanticai_vertexdefault_conn_namevalues already use underscores (pydanticai_azure_default) so those areunaffected.
Since these providers are relatively new, migration impact should be limited. A
_normalize_conn_typealias (like the existingpostgresql→postgresentry) could be addedas a compatibility shim for users who already have connections stored with the hyphenated type.
Operating System
Redhat 44
Deployment
Official Apache Airflow Helm Chart
Apache Airflow Provider(s)
common-ai
Versions of Apache Airflow Providers
All versions shipping
PydanticAIAzureHook,PydanticAIBedrockHook, orPydanticAIVertexHook.Official Helm Chart version
1.22.0 (latest released)
Kubernetes Version
No response
Helm Chart configuration
No response
Docker Image customizations
No response
Anything else?
No response
Are you willing to submit PR?
Code of Conduct