kaxil commented on code in PR #74404:
URL: https://github.com/apache/airflow/pull/74404#discussion_r4263803513


##########
providers/common/ai/src/airflow/providers/common/ai/durable/strands.py:
##########
@@ -0,0 +1,209 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""
+Resume a `Strands Agents <https://strandsagents.com/>`__ agent where it 
stopped when Airflow retries its task.
+
+.. note:: Experimental, as Strands' checkpointing is; see 
:mod:`strands.experimental.checkpoint`.
+"""
+
+from __future__ import annotations
+
+import hashlib
+import json
+from typing import TYPE_CHECKING, Any, Protocol
+
+from airflow.providers.common.compat.sdk import 
AirflowOptionalProviderFeatureException, get_current_context
+
+try:
+    from strands.session import SnapshotSessionManager
+    from strands.types.session import encode_bytes_values
+except ImportError as e:
+    raise AirflowOptionalProviderFeatureException(e)
+
+from airflow.providers.common.ai.batch.state import compute_identity_key
+from airflow.providers.common.ai.utils.coroutines import run_coroutine_sync
+from airflow.providers.common.ai.utils.task_logger import get_task_logger
+from airflow.providers.common.compat.version_compat import AIRFLOW_V_3_3_PLUS

Review Comment:
   I'd keep stdlib first here. The guard raises the same 
`AirflowOptionalProviderFeatureException` either way, and it's the order the 
other optional-dependency modules in the provider use (`tools/strands.py`, 
`tools/adk.py`, `operators/llm_sql.py`, `toolsets/sql.py`, 
`toolsets/datafusion.py`). Same for the other import-order suggestions on this 
PR.



-- 
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]

Reply via email to