kaxil opened a new pull request, #68117: URL: https://github.com/apache/airflow/pull/68117
`SQLToolset`'s `query`, `get_schema`, and `list_tables` tools raised on any database error, which failed the whole `@task.agent` task. The agent never saw the error, so it could not fix its SQL and retry within the run. A capable model that composes a slightly imperfect query (a Snowflake reserved word used as an unquoted alias such as `COUNT(*) rows`, or `PARSE_JSON` on a column that is already a `VARIANT`) failed the task instead of correcting itself. The same agent over Snowflake's managed MCP `sql_exec_tool` ran clean, because that tool returns errors to the model. ## What changed `SQLToolset.call_tool` now surfaces any tool failure to the agent as `pydantic_ai.ModelRetry`, carrying the database's own error message. It does not inspect the error type or text. `pydantic-ai` bounds the loop with the tool's `max_retries`, so a fixable SQL error is corrected within the run while an unrecoverable one (a bad connection, an auth failure) exhausts the budget and fails the task for Airflow to retry. The [`airflow_toolset_to_langchain_tools`](https://github.com/apache/airflow/blob/d88504564c/providers/common/ai/src/airflow/providers/common/ai/toolsets/langchain_bridge.py) bridge feeds `ModelRetry` back to the model as tool output, so it now applies the same `max_retries` bound: a tool that keeps failing propagates once the budget is exhausted instead of looping forever (the counter resets after a success or after it propagates). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
