Skip to content

Commit 3206031

Browse files
committed
fix metadata bug
1 parent 0f2462a commit 3206031

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

veadk/agent.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,15 @@ def model_post_init(self, __context: Any) -> None:
227227
if self.long_term_memory is not None:
228228
from google.adk.tools import load_memory
229229

230-
if not load_memory.custom_metadata:
231-
load_memory.custom_metadata = {}
232-
load_memory.custom_metadata["backend"] = self.long_term_memory.backend
230+
if hasattr(load_memory, "custom_metadata"):
231+
if not load_memory.custom_metadata:
232+
load_memory.custom_metadata = {}
233+
load_memory.custom_metadata["backend"] = self.long_term_memory.backend
234+
else:
235+
logger.warning(
236+
"load_memory tool does not have custom_metadata attribute, you can update your Google-ADK version, "
237+
"long_term_memory backend information will not be set."
238+
)
233239
self.tools.append(load_memory)
234240

235241
logger.info(f"VeADK version: {VERSION}")

veadk/tracing/telemetry/exporters/apmplus_exporter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def record_tool_call(
402402
operation_type = "tool"
403403
operation_name = tool.name
404404
operation_backend = ""
405-
if tool.custom_metadata:
405+
if hasattr(tool, "custom_metadata") and tool.custom_metadata:
406406
operation_backend = tool.custom_metadata.get("backend", "")
407407

408408
attributes = {

0 commit comments

Comments
 (0)