Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/google/adk/a2a/converters/request_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ def convert_a2a_request_to_adk_run_args(
if not request.message:
raise ValueError('Request message cannot be None')

metadata = getattr(request, 'metadata', None)
return {
'user_id': _get_user_id(request),
'session_id': request.context_id,
'new_message': genai_types.Content(
role='user',
parts=[part_converter(part) for part in request.message.parts],
),
'run_config': RunConfig(),
'run_config': RunConfig(metadata=metadata),
}
3 changes: 3 additions & 0 deletions src/google/adk/agents/invocation_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ class InvocationContext(BaseModel):
plugin_manager: PluginManager = Field(default_factory=PluginManager)
"""The manager for keeping track of plugins in this invocation."""

a2a_metadata: Optional[dict[str, Any]] = None
"""The metadata of the A2A request."""

_invocation_cost_manager: _InvocationCostManager = PrivateAttr(
default_factory=_InvocationCostManager
)
Expand Down
4 changes: 4 additions & 0 deletions src/google/adk/agents/run_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from enum import Enum
import logging
import sys
from typing import Any
from typing import Optional

from google.genai import types
Expand All @@ -42,6 +43,9 @@ class RunConfig(BaseModel):
)
"""The pydantic model config."""

metadata: Optional[dict[str, Any]] = None
"""The metadata of the run."""

speech_config: Optional[types.SpeechConfig] = None
"""Speech configuration for the live agent."""

Expand Down
1 change: 1 addition & 0 deletions src/google/adk/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ def _new_invocation_context(
live_request_queue=live_request_queue,
run_config=run_config,
resumability_config=self.resumability_config,
a2a_metadata=run_config.metadata,
)

def _new_invocation_context_for_live(
Expand Down