You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "AlejandroMorgante (via GitHub)" <gi...@apache.org> on 2026/06/03 23:52:37 UTC
[PR] Add Amazon Bedrock AgentCore Runtime operators [airflow]
AlejandroMorgante opened a new pull request, #67984:
URL: https://github.com/apache/airflow/pull/67984
Adds three operators and two hooks for managing Amazon Bedrock AgentCore Runtimes.
## New operators
- **`BedrockCreateAgentRuntimeOperator`** — creates an AgentCore Runtime and waits for it to reach `READY` state. Supports synchronous waiting (via custom waiter) and fully deferrable mode using `BedrockAgentRuntimeReadyTrigger`.
- **`BedrockInvokeAgentRuntimeOperator`** — invokes an AgentCore Runtime with a payload (dict/list/str/bytes) and returns the response body, deserializing JSON when the content type indicates it.
- **`BedrockDeleteAgentRuntimeOperator`** — deletes an AgentCore Runtime by ID.
## New hooks
- **`BedrockAgentCoreControlHook`** — wraps `bedrock-agentcore-control` for create/get/delete operations.
- **`BedrockAgentCoreHook`** — wraps `bedrock-agentcore` for runtime invocation.
## Other changes
- Custom waiter definition `bedrock-agentcore-control.json` with `agent_runtime_ready` waiter (success: `READY`, retry: `CREATING`/`UPDATING`, failure: `CREATE_FAILED`/`UPDATE_FAILED`/`DELETING`).
- Unit tests for all new operators, hooks, trigger, and waiter (127 tests passing).
- Documentation for all three operators in `providers/amazon/docs/operators/bedrock.rst`.
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Sonnet 4.6)
Generated-by: Claude Code (Sonnet 4.6) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Amazon Bedrock AgentCore Runtime operators [airflow]
Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck commented on code in PR #67984:
URL: https://github.com/apache/airflow/pull/67984#discussion_r3358439157
##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/bedrock.py:
##########
@@ -106,3 +109,93 @@ class BedrockAgentRuntimeHook(AwsBaseHook):
def __init__(self, *args, **kwargs) -> None:
kwargs["client_type"] = self.client_type
super().__init__(*args, **kwargs)
+
+
+class BedrockAgentCoreControlHook(AwsBaseHook):
+ """
+ Interact with the Amazon Bedrock AgentCore control plane API.
+
+ Provide thin wrapper around :external+boto3:py:class:`boto3.client("bedrock-agentcore-control") <BedrockAgentCoreControl.Client>`.
+
+ Additional arguments (such as ``aws_conn_id``) may be specified and
+ are passed down to the underlying AwsBaseHook.
+
+ .. seealso::
+ - :class:`airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook`
+ """
+
+ client_type = "bedrock-agentcore-control"
+
+ def __init__(self, *args, **kwargs) -> None:
+ kwargs["client_type"] = self.client_type
+ super().__init__(*args, **kwargs)
+
+ def create_agent_runtime(
Review Comment:
We do not recommend creating hook method which are just wrapper of boto3 calls. You can directly use boto3 in the operator
##########
providers/amazon/tests/system/amazon/aws/example_bedrock_agentcore.py:
##########
@@ -0,0 +1,111 @@
+# 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.
+from __future__ import annotations
+
+from datetime import datetime
+
+from airflow.providers.amazon.aws.operators.bedrock import (
+ BedrockCreateAgentRuntimeOperator,
+ BedrockDeleteAgentRuntimeOperator,
+ BedrockInvokeAgentRuntimeOperator,
+)
+
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
+
+if AIRFLOW_V_3_0_PLUS:
+ from airflow.sdk import DAG, chain
+else:
+ from airflow.models.baseoperator import chain # type: ignore[attr-defined,no-redef]
+ from airflow.models.dag import DAG # type: ignore[attr-defined,no-redef,assignment]
+
+try:
+ from airflow.sdk import TriggerRule
+except ImportError:
+ from airflow.utils.trigger_rule import TriggerRule # type: ignore[no-redef,attr-defined]
+
+from system.amazon.aws.utils import SystemTestContextBuilder
+
+# Externally fetched variables:
+ROLE_ARN_KEY = "ROLE_ARN"
+CONTAINER_URI_KEY = "CONTAINER_URI"
+
+sys_test_context_task = (
+ SystemTestContextBuilder().add_variable(ROLE_ARN_KEY).add_variable(CONTAINER_URI_KEY).build()
+)
+
+DAG_ID = "example_bedrock_agentcore"
+
+with DAG(
+ dag_id=DAG_ID,
+ schedule="@once",
+ start_date=datetime(2021, 1, 1),
+ catchup=False,
+) as dag:
+ test_context = sys_test_context_task()
+ env_id = test_context["ENV_ID"]
+
+ runtime_name = f"airflow-agentcore-{env_id}"
+
+ # [START howto_operator_bedrock_create_agent_runtime]
Review Comment:
Since you have these, you should use them to add that snippet in documentation instead of writing the code in documentation directly. You can look at other documentations for reference
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Amazon Bedrock AgentCore Runtime operators [airflow]
Posted by "AlejandroMorgante (via GitHub)" <gi...@apache.org>.
AlejandroMorgante commented on code in PR #67984:
URL: https://github.com/apache/airflow/pull/67984#discussion_r3358582743
##########
providers/amazon/tests/system/amazon/aws/example_bedrock_agentcore.py:
##########
@@ -0,0 +1,111 @@
+# 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.
+from __future__ import annotations
+
+from datetime import datetime
+
+from airflow.providers.amazon.aws.operators.bedrock import (
+ BedrockCreateAgentRuntimeOperator,
+ BedrockDeleteAgentRuntimeOperator,
+ BedrockInvokeAgentRuntimeOperator,
+)
+
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
+
+if AIRFLOW_V_3_0_PLUS:
+ from airflow.sdk import DAG, chain
+else:
+ from airflow.models.baseoperator import chain # type: ignore[attr-defined,no-redef]
+ from airflow.models.dag import DAG # type: ignore[attr-defined,no-redef,assignment]
+
+try:
+ from airflow.sdk import TriggerRule
+except ImportError:
+ from airflow.utils.trigger_rule import TriggerRule # type: ignore[no-redef,attr-defined]
+
+from system.amazon.aws.utils import SystemTestContextBuilder
+
+# Externally fetched variables:
+ROLE_ARN_KEY = "ROLE_ARN"
+CONTAINER_URI_KEY = "CONTAINER_URI"
+
+sys_test_context_task = (
+ SystemTestContextBuilder().add_variable(ROLE_ARN_KEY).add_variable(CONTAINER_URI_KEY).build()
+)
+
+DAG_ID = "example_bedrock_agentcore"
+
+with DAG(
+ dag_id=DAG_ID,
+ schedule="@once",
+ start_date=datetime(2021, 1, 1),
+ catchup=False,
+) as dag:
+ test_context = sys_test_context_task()
+ env_id = test_context["ENV_ID"]
+
+ runtime_name = f"airflow-agentcore-{env_id}"
+
+ # [START howto_operator_bedrock_create_agent_runtime]
Review Comment:
Done, replaced the hardcoded code-block snippets with example include directives pointing to the `[START/END]` markers in `**example_bedrock_agentcore.py.**`
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Amazon Bedrock AgentCore Runtime operators [airflow]
Posted by "AlejandroMorgante (via GitHub)" <gi...@apache.org>.
AlejandroMorgante commented on code in PR #67984:
URL: https://github.com/apache/airflow/pull/67984#discussion_r3358592977
##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/bedrock.py:
##########
@@ -106,3 +109,93 @@ class BedrockAgentRuntimeHook(AwsBaseHook):
def __init__(self, *args, **kwargs) -> None:
kwargs["client_type"] = self.client_type
super().__init__(*args, **kwargs)
+
+
+class BedrockAgentCoreControlHook(AwsBaseHook):
+ """
+ Interact with the Amazon Bedrock AgentCore control plane API.
+
+ Provide thin wrapper around :external+boto3:py:class:`boto3.client("bedrock-agentcore-control") <BedrockAgentCoreControl.Client>`.
+
+ Additional arguments (such as ``aws_conn_id``) may be specified and
+ are passed down to the underlying AwsBaseHook.
+
+ .. seealso::
+ - :class:`airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook`
+ """
+
+ client_type = "bedrock-agentcore-control"
+
+ def __init__(self, *args, **kwargs) -> None:
+ kwargs["client_type"] = self.client_type
+ super().__init__(*args, **kwargs)
+
+ def create_agent_runtime(
Review Comment:
Done, removed the wrapper methods from **BedrockAgentCoreControlHook** and **BedrockAgentCoreHook**. Operators now call **`self.hook.conn.<method>() `** directly
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Amazon Bedrock AgentCore Runtime operators [airflow]
Posted by "AlejandroMorgante (via GitHub)" <gi...@apache.org>.
AlejandroMorgante commented on code in PR #67984:
URL: https://github.com/apache/airflow/pull/67984#discussion_r3358592977
##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/bedrock.py:
##########
@@ -106,3 +109,93 @@ class BedrockAgentRuntimeHook(AwsBaseHook):
def __init__(self, *args, **kwargs) -> None:
kwargs["client_type"] = self.client_type
super().__init__(*args, **kwargs)
+
+
+class BedrockAgentCoreControlHook(AwsBaseHook):
+ """
+ Interact with the Amazon Bedrock AgentCore control plane API.
+
+ Provide thin wrapper around :external+boto3:py:class:`boto3.client("bedrock-agentcore-control") <BedrockAgentCoreControl.Client>`.
+
+ Additional arguments (such as ``aws_conn_id``) may be specified and
+ are passed down to the underlying AwsBaseHook.
+
+ .. seealso::
+ - :class:`airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook`
+ """
+
+ client_type = "bedrock-agentcore-control"
+
+ def __init__(self, *args, **kwargs) -> None:
+ kwargs["client_type"] = self.client_type
+ super().__init__(*args, **kwargs)
+
+ def create_agent_runtime(
Review Comment:
Done, removed the wrapper methods from **BedrockAgentCoreControlHook** and **BedrockAgentCoreHook**. Operators now call **`self.hook.conn.<method>()`** directly
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Amazon Bedrock AgentCore Runtime operators [airflow]
Posted by "AlejandroMorgante (via GitHub)" <gi...@apache.org>.
AlejandroMorgante commented on code in PR #67984:
URL: https://github.com/apache/airflow/pull/67984#discussion_r3358582743
##########
providers/amazon/tests/system/amazon/aws/example_bedrock_agentcore.py:
##########
@@ -0,0 +1,111 @@
+# 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.
+from __future__ import annotations
+
+from datetime import datetime
+
+from airflow.providers.amazon.aws.operators.bedrock import (
+ BedrockCreateAgentRuntimeOperator,
+ BedrockDeleteAgentRuntimeOperator,
+ BedrockInvokeAgentRuntimeOperator,
+)
+
+from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
+
+if AIRFLOW_V_3_0_PLUS:
+ from airflow.sdk import DAG, chain
+else:
+ from airflow.models.baseoperator import chain # type: ignore[attr-defined,no-redef]
+ from airflow.models.dag import DAG # type: ignore[attr-defined,no-redef,assignment]
+
+try:
+ from airflow.sdk import TriggerRule
+except ImportError:
+ from airflow.utils.trigger_rule import TriggerRule # type: ignore[no-redef,attr-defined]
+
+from system.amazon.aws.utils import SystemTestContextBuilder
+
+# Externally fetched variables:
+ROLE_ARN_KEY = "ROLE_ARN"
+CONTAINER_URI_KEY = "CONTAINER_URI"
+
+sys_test_context_task = (
+ SystemTestContextBuilder().add_variable(ROLE_ARN_KEY).add_variable(CONTAINER_URI_KEY).build()
+)
+
+DAG_ID = "example_bedrock_agentcore"
+
+with DAG(
+ dag_id=DAG_ID,
+ schedule="@once",
+ start_date=datetime(2021, 1, 1),
+ catchup=False,
+) as dag:
+ test_context = sys_test_context_task()
+ env_id = test_context["ENV_ID"]
+
+ runtime_name = f"airflow-agentcore-{env_id}"
+
+ # [START howto_operator_bedrock_create_agent_runtime]
Review Comment:
Done, replaced the hardcoded code-block snippets with example include directives pointing to the `[START/END]` markers in **`example_bedrock_agentcore.py.`**
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Amazon Bedrock AgentCore Runtime operators [airflow]
Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck merged PR #67984:
URL: https://github.com/apache/airflow/pull/67984
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org