Skip to content

Commit 1066eae

Browse files
authored
Merge branch 'main' into fix/list-agents-filter-non-agents-dirs
2 parents 14622f3 + d61846f commit 1066eae

37 files changed

Lines changed: 4499 additions & 561 deletions

contributing/samples/authn-adk-all-in-one/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
google-adk==1.12
2-
Flask==3.1.1
2+
Flask==3.1.3
33
flask-cors==6.0.1
44
python-dotenv==1.1.1
55
PyJWT[crypto]==2.10.1

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ dependencies = [
5656
"opentelemetry-resourcedetector-gcp>=1.9.0a0, <2.0.0",
5757
"opentelemetry-sdk>=1.36.0, <1.39.0",
5858
"pyarrow>=14.0.0",
59-
"pydantic>=2.7.0, <3.0.0", # For data validation/models
59+
"pydantic>=2.12.0, <3.0.0", # For data validation/models
6060
"python-dateutil>=2.9.0.post0, <3.0.0", # For Vertext AI Session Service
6161
"python-dotenv>=1.0.0, <2.0.0", # To manage environment variables
6262
"requests>=2.32.4, <3.0.0",
@@ -109,6 +109,7 @@ community = [
109109
eval = [
110110
# go/keep-sorted start
111111
"Jinja2>=3.1.4,<4.0.0", # For eval template rendering
112+
"gepa>=0.1.0",
112113
"google-cloud-aiplatform[evaluation]>=1.100.0",
113114
"pandas>=2.2.3",
114115
"rouge-score>=0.1.2",
@@ -155,6 +156,7 @@ extensions = [
155156
"crewai[tools];python_version>='3.11' and python_version<'3.12'", # For CrewaiTool; chromadb/pypika fail on 3.12+
156157
"docker>=7.0.0", # For ContainerCodeExecutor
157158
"kubernetes>=29.0.0", # For GkeCodeExecutor
159+
"k8s-agent-sandbox>=0.1.1.post2", # For GkeCodeExecutor sandbox mode
158160
"langgraph>=0.2.60, <0.4.8", # For LangGraphAgent
159161
"litellm>=1.75.5, <2.0.0", # For LiteLlm class. Currently has OpenAI limitations. TODO: once LiteLlm fix it
160162
"llama-index-readers-file>=0.4.0", # For retrieval using LlamaIndex.

src/google/adk/a2a/converters/event_converter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def convert_a2a_message_to_event(
370370
@a2a_experimental
371371
def convert_event_to_a2a_message(
372372
event: Event,
373-
invocation_context: InvocationContext,
373+
invocation_context: InvocationContext | None = None,
374374
role: Role = Role.agent,
375375
part_converter: GenAIPartToA2APartConverter = convert_genai_part_to_a2a_part,
376376
) -> Optional[Message]:
@@ -390,8 +390,6 @@ def convert_event_to_a2a_message(
390390
"""
391391
if not event:
392392
raise ValueError("Event cannot be None")
393-
if not invocation_context:
394-
raise ValueError("Invocation context cannot be None")
395393

396394
if not event.content or not event.content.parts:
397395
return None

src/google/adk/a2a/converters/part_converter.py

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ def convert_a2a_part_to_genai_part(
7070
if isinstance(part.file, a2a_types.FileWithUri):
7171
return genai_types.Part(
7272
file_data=genai_types.FileData(
73-
file_uri=part.file.uri, mime_type=part.file.mime_type
73+
file_uri=part.file.uri,
74+
mime_type=part.file.mime_type,
75+
display_name=part.file.name,
7476
)
7577
)
7678

@@ -79,6 +81,7 @@ def convert_a2a_part_to_genai_part(
7981
inline_data=genai_types.Blob(
8082
data=base64.b64decode(part.file.bytes),
8183
mime_type=part.file.mime_type,
84+
display_name=part.file.name,
8285
)
8386
)
8487
else:
@@ -104,10 +107,25 @@ def convert_a2a_part_to_genai_part(
104107
part.metadata[_get_adk_metadata_key(A2A_DATA_PART_METADATA_TYPE_KEY)]
105108
== A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
106109
):
110+
# Restore thought_signature if present
111+
thought_signature = None
112+
thought_sig_key = _get_adk_metadata_key('thought_signature')
113+
if thought_sig_key in part.metadata:
114+
sig_value = part.metadata[thought_sig_key]
115+
if isinstance(sig_value, bytes):
116+
thought_signature = sig_value
117+
elif isinstance(sig_value, str):
118+
try:
119+
thought_signature = base64.b64decode(sig_value)
120+
except Exception:
121+
logger.warning(
122+
'Failed to decode thought_signature: %s', sig_value
123+
)
107124
return genai_types.Part(
108125
function_call=genai_types.FunctionCall.model_validate(
109126
part.data, by_alias=True
110-
)
127+
),
128+
thought_signature=thought_signature,
111129
)
112130
if (
113131
part.metadata[_get_adk_metadata_key(A2A_DATA_PART_METADATA_TYPE_KEY)]
@@ -173,6 +191,7 @@ def convert_genai_part_to_a2a_part(
173191
file=a2a_types.FileWithUri(
174192
uri=part.file_data.file_uri,
175193
mime_type=part.file_data.mime_type,
194+
name=part.file_data.display_name,
176195
)
177196
)
178197
)
@@ -196,6 +215,7 @@ def convert_genai_part_to_a2a_part(
196215
file=a2a_types.FileWithBytes(
197216
bytes=base64.b64encode(part.inline_data.data).decode('utf-8'),
198217
mime_type=part.inline_data.mime_type,
218+
name=part.inline_data.display_name,
199219
)
200220
)
201221

@@ -214,16 +234,22 @@ def convert_genai_part_to_a2a_part(
214234
# TODO once A2A defined how to service such information, migrate below
215235
# logic accordingly
216236
if part.function_call:
237+
fc_metadata = {
238+
_get_adk_metadata_key(
239+
A2A_DATA_PART_METADATA_TYPE_KEY
240+
): A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
241+
}
242+
# Preserve thought_signature if present
243+
if part.thought_signature is not None:
244+
fc_metadata[_get_adk_metadata_key('thought_signature')] = (
245+
base64.b64encode(part.thought_signature).decode('utf-8')
246+
)
217247
return a2a_types.Part(
218248
root=a2a_types.DataPart(
219249
data=part.function_call.model_dump(
220250
by_alias=True, exclude_none=True
221251
),
222-
metadata={
223-
_get_adk_metadata_key(
224-
A2A_DATA_PART_METADATA_TYPE_KEY
225-
): A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
226-
},
252+
metadata=fc_metadata,
227253
)
228254
)
229255

src/google/adk/a2a/experimental.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
default_message=(
2424
"ADK Implementation for A2A support (A2aAgentExecutor, RemoteA2aAgent "
2525
"and corresponding supporting components etc.) is in experimental mode "
26-
"and is subjected to breaking changes. A2A protocol and SDK are"
26+
"and is subject to breaking changes. A2A protocol and SDK are "
2727
"themselves not experimental. Once it's stable enough the experimental "
2828
"mode will be removed. Your feedback is welcome."
2929
),

0 commit comments

Comments
 (0)