kaxil commented on PR #67791: URL: https://github.com/apache/airflow/pull/67791#issuecomment-4588570418
Good catch, thanks. You're right that the bundled SQL/DataFusion tools lean on `ModelRetry`, and LangChain has no equivalent. I looked into it: Under `create_agent`'s default tool-error handling, langgraph's `_default_handle_tool_errors` only turns `ToolInvocationError` into a message and re-raises everything else, so a `ModelRetry` propagating out of a bridged tool aborts the run. Since `ModelRetry` is really a "send this back to the model and retry" signal rather than a failure, the bridge now catches it and returns the message as the tool's output. The model sees the guidance and self-corrects, which matches what `ModelRetry` does inside pydantic-ai and works regardless of how the agent handles tool errors. Verified with a real `SQLToolset` over SQLite: a query against a missing column raises `ModelRetry`, the tool returns `error: no such column ... Use get_schema and list_tables`, and the agent runs a corrected query and finishes. Unit tests cover the sync and async paths. Pushed in df86f61807. -- 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]
