|
| 1 | +# Copyright 2025 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +"""A2A specific experimental decorator with custom warning message.""" |
| 16 | + |
| 17 | +from __future__ import annotations |
| 18 | + |
| 19 | +from google.adk.utils.feature_decorator import _make_feature_decorator |
| 20 | + |
| 21 | +a2a_experimental = _make_feature_decorator( |
| 22 | + label="EXPERIMENTAL", |
| 23 | + default_message=( |
| 24 | + "ADK Implementation for A2A support (A2aAgentExecutor, RemoteA2aAgent " |
| 25 | + "and corresponding supporting components etc.) is in experimental mode " |
| 26 | + "and is subjected to breaking changes. A2A protocol and SDK are" |
| 27 | + "themselves not experimental. Once it's stable enough the experimental " |
| 28 | + "mode will be removed. Your feedback is welcome." |
| 29 | + ), |
| 30 | +) |
| 31 | +"""Mark a class or function as experimental A2A feature. |
| 32 | +
|
| 33 | +This decorator shows a specific warning message for A2A functionality, |
| 34 | +indicating that the API is experimental and subject to breaking changes. |
| 35 | +
|
| 36 | +Sample usage: |
| 37 | +
|
| 38 | +``` |
| 39 | +# Use with default A2A experimental message |
| 40 | +@a2a_experimental |
| 41 | +class A2AExperimentalClass: |
| 42 | + pass |
| 43 | +
|
| 44 | +# Use with custom message (overrides default A2A message) |
| 45 | +@a2a_experimental("Custom A2A experimental message.") |
| 46 | +def a2a_experimental_function(): |
| 47 | + pass |
| 48 | +
|
| 49 | +# Use with empty parentheses (same as default A2A message) |
| 50 | +@a2a_experimental() |
| 51 | +class AnotherA2AClass: |
| 52 | + pass |
| 53 | +``` |
| 54 | +""" |
0 commit comments