diff --git a/libs/agno/agno/run/response.py b/libs/agno/agno/run/response.py index 7a20c3c89e..9826047602 100644 --- a/libs/agno/agno/run/response.py +++ b/libs/agno/agno/run/response.py @@ -72,6 +72,9 @@ class RunResponse: created_at: int = field(default_factory=lambda: int(time())) def to_dict(self) -> Dict[str, Any]: + if self.metrics is not None: + self.metrics = dict(self.metrics) + _dict = {k: v for k, v in asdict(self).items() if v is not None and k != "messages"} if self.messages is not None: _dict["messages"] = [m.to_dict() for m in self.messages]