@@ -9444,8 +9444,15 @@ async def admin_add_a2a_agent(
94449444 LOGGER .info (f"✅ Assembled OAuth config from UI form fields: grant_type={ oauth_grant_type } , issuer={ oauth_issuer } " )
94459445 LOGGER .info (f"DEBUG: Complete oauth_config = { oauth_config } " )
94469446
9447- # TODO
9448- # Handle passthrough_headers
9447+ passthrough_headers = str (form .get ("passthrough_headers" ))
9448+ if passthrough_headers and passthrough_headers .strip ():
9449+ try :
9450+ passthrough_headers = json .loads (passthrough_headers )
9451+ except (json .JSONDecodeError , ValueError ):
9452+ # Fallback to comma-separated parsing
9453+ passthrough_headers = [h .strip () for h in passthrough_headers .split ("," ) if h .strip ()]
9454+ else :
9455+ passthrough_headers = None
94499456
94509457 # Auto-detect OAuth: if oauth_config is present and auth_type not explicitly set, use "oauth"
94519458 auth_type_from_form = str (form .get ("auth_type" , "" ))
@@ -9474,6 +9481,7 @@ async def admin_add_a2a_agent(
94749481 visibility = form .get ("visibility" , "private" ),
94759482 team_id = team_id ,
94769483 owner_email = user_email ,
9484+ passthrough_headers = passthrough_headers ,
94779485 )
94789486
94799487 LOGGER .info (f"Creating A2A agent: { agent_data .name } at { agent_data .endpoint_url } " )
@@ -9551,6 +9559,7 @@ async def admin_edit_a2a_agent(
95519559 - team_id (optional)
95529560 - capabilities (JSON, optional)
95539561 - config (JSON, optional)
9562+ - passthrough_headers: Optional[List[str]]
95549563
95559564 Args:
95569565 agent_id (str): The ID of the agent being edited.
@@ -9678,17 +9687,16 @@ async def admin_edit_a2a_agent(
96789687 except (json .JSONDecodeError , ValueError ):
96799688 auth_headers = []
96809689
9681- """
96829690 # Passthrough headers
9683- passthrough_headers = None
9684- if form.get("passthrough_headers"):
9685- raw = str(form.get("passthrough_headers"))
9691+ passthrough_headers = str (form .get ("passthrough_headers" ))
9692+ if passthrough_headers and passthrough_headers .strip ():
96869693 try :
9687- passthrough_headers = json.loads(raw)
9688- except (ValueError, json.JSONDecodeError):
9689- passthrough_headers = [h.strip() for h in raw.split(",") if h.strip()]
9690-
9691- """
9694+ passthrough_headers = json .loads (passthrough_headers )
9695+ except (json .JSONDecodeError , ValueError ):
9696+ # Fallback to comma-separated parsing
9697+ passthrough_headers = [h .strip () for h in passthrough_headers .split ("," ) if h .strip ()]
9698+ else :
9699+ passthrough_headers = None
96929700
96939701 # Parse OAuth configuration - support both JSON string and individual form fields
96949702 oauth_config_json = str (form .get ("oauth_config" ))
@@ -9778,6 +9786,7 @@ async def admin_edit_a2a_agent(
97789786 auth_header_value = str (form .get ("auth_header_value" , "" )),
97799787 auth_value = str (form .get ("auth_value" , "" )),
97809788 auth_headers = auth_headers if auth_headers else None ,
9789+ passthrough_headers = passthrough_headers ,
97819790 oauth_config = oauth_config ,
97829791 visibility = visibility ,
97839792 team_id = team_id ,
0 commit comments