|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
| 15 | +import copy |
| 16 | + |
| 17 | +from conftest import GOOGLE_ADK_VERSION_TUPLE |
15 | 18 | from google.adk.agents import LlmAgent |
16 | 19 |
|
17 | 20 | MODEL = "gemini-3.5-flash" |
@@ -91,12 +94,17 @@ def build_sub_agent(): |
91 | 94 | sub_agent_recorded_event = [parent_recorded_event, child_recorded_event, transfer_to_agent_recorded_event] |
92 | 95 |
|
93 | 96 |
|
94 | | -# For error tests, the parent finishes its first turn normally with |
95 | | -# a tool call and does not see an error. The tool call also completes |
96 | | -# normally by initiating the transfer. The child raises an exception |
97 | | -# during its turn, so it is the only event that sees the error. |
98 | | - |
99 | | -parent_recorded_event_error = parent_recorded_event |
| 97 | +# For error tests, the tool call completes normally by initiating the transfer, |
| 98 | +# and the child raises an exception during its turn. |
| 99 | +# |
| 100 | +# The error status of the parent event depends on the ADK version. The parent agent |
| 101 | +# has the error bubble up through run_async on google-adk<2, but on google-adk>=2 |
| 102 | +# the parent agent's run_async completes normally and the error is contained to the |
| 103 | +# child agent's flow. |
| 104 | +parent_recorded_event_error = copy.deepcopy(parent_recorded_event) |
| 105 | +if GOOGLE_ADK_VERSION_TUPLE < (2, 0, 0): |
| 106 | + # Mark only the parent's LlmAgent event as error, as the LlmTool is successful. |
| 107 | + parent_recorded_event_error[1]["error"] = True |
100 | 108 |
|
101 | 109 | child_recorded_event_error = ( |
102 | 110 | {"type": "LlmAgent"}, |
|
0 commit comments