2525 Part ,
2626 TextPart ,
2727)
28- < << << << HEAD
29- from a2ui .a2a import (
30- get_a2ui_agent_extension ,
31- parse_response_to_parts ,
32- )
33- from a2ui .basic_catalog .provider import BasicCatalog
34- from a2ui .core .parser .parser import parse_response
35- from a2ui .core .schema .common_modifiers import remove_strict_validation
36- from a2ui .core .schema .constants import A2UI_CLOSE_TAG , A2UI_OPEN_TAG , VERSION_0_8
37- from a2ui .core .schema .manager import A2uiSchemaManager
38- == == == =
3928from a2ui .a2a .extension import get_a2ui_agent_extension
4029from a2ui .a2a .parts import parse_response_to_parts
4130from a2ui .basic_catalog .provider import BasicCatalog
4231from a2ui .parser .parser import parse_response
4332from a2ui .schema .common_modifiers import remove_strict_validation
4433from a2ui .schema .constants import A2UI_CLOSE_TAG , A2UI_OPEN_TAG , VERSION_0_8
4534from a2ui .schema .manager import A2uiSchemaManager
46-
47- > >> >> >> main
4835import dotenv
4936from google .adk .agents import run_config
5037from google .adk .agents .llm_agent import LlmAgent
@@ -71,7 +58,9 @@ def __init__(self, base_url: str):
7158 self .base_url = base_url
7259 self ._agent_name = "contact_agent"
7360 self ._user_id = "remote_agent"
74- self ._text_runner : Optional [Runner ] = self ._build_runner (self ._build_llm_agent ())
61+ self ._text_runner : Optional [Runner ] = self ._build_runner (
62+ self ._build_llm_agent ()
63+ )
7564
7665 self ._schema_managers : Dict [str , A2uiSchemaManager ] = {}
7766 self ._ui_runners : Dict [str , Runner ] = {}
@@ -137,7 +126,8 @@ def _build_agent_card(self) -> AgentCard:
137126 return AgentCard (
138127 name = "Contact Lookup Agent" ,
139128 description = (
140- "This agent helps find contact info for people in your organization."
129+ "This agent helps find contact info for people in your"
130+ " organization."
141131 ),
142132 url = self .base_url ,
143133 version = "1.0.0" ,
@@ -225,7 +215,9 @@ async def fetch_response(
225215 current_query_text = query
226216
227217 # Ensure catalog schema was loaded
228- if ui_version and (not selected_catalog or not selected_catalog .catalog_schema ):
218+ if ui_version and (
219+ not selected_catalog or not selected_catalog .catalog_schema
220+ ):
229221 logger .error (
230222 "--- ContactAgent.fetch_response: A2UI_SCHEMA is not loaded. "
231223 "Cannot perform UI validation. ---"
@@ -261,8 +253,14 @@ async def fetch_response(
261253 new_message = current_message ,
262254 ):
263255 if event .is_final_response ():
264- if event .content and event .content .parts and event .content .parts [0 ].text :
265- full_content_list .extend ([p .text for p in event .content .parts if p .text ])
256+ if (
257+ event .content
258+ and event .content .parts
259+ and event .content .parts [0 ].text
260+ ):
261+ full_content_list .extend (
262+ [p .text for p in event .content .parts if p .text ]
263+ )
266264
267265 final_response_content = "" .join (full_content_list )
268266
@@ -282,7 +280,8 @@ async def fetch_response(
282280 logger .info ("Retries exhausted on no-response" )
283281 # Retries exhausted on no-response
284282 final_response_content = (
285- "I'm sorry, I encountered an error and couldn't process your request."
283+ "I'm sorry, I encountered an error and couldn't process your"
284+ " request."
286285 )
287286 # Fall through to send this as a text-only error
288287
@@ -341,7 +340,8 @@ async def fetch_response(
341340 f" (Attempt { attempt } ) ---"
342341 )
343342 logger .warning (
344- f"--- Failed response content: { final_response_content [:500 ]} ... ---"
343+ "--- Failed response content:"
344+ f" { final_response_content [:500 ]} ... ---"
345345 )
346346 error_message = f"Validation failed: { e } ."
347347
0 commit comments