Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Enhanced logging in reformat_agent_history to provide detailed insights into agent history usage data, including type checks and warnings for missing usage information.

Magnus Müller8e69bc603b3a
diff --git a/eval/service.py b/eval/service.py
index 1f3b37ae4..a5057cc28 100644
--- a/eval/service.py
+++ b/eval/service.py
@@ -1034,8 +1034,13 @@ async def reformat_agent_history(
# Extract usage data from agent history
usage_data = None
- if agent_history.usage:
+ logger.info(f'Agent history usage object: {agent_history.usage}')
+ logger.info(f'Agent history usage type: {type(agent_history.usage)}')
+ if hasattr(agent_history, 'usage') and agent_history.usage:
+ logger.info(f'Agent history usage model_dump: {agent_history.usage.model_dump()}')
usage_data = agent_history.usage.model_dump()
+ else:
+ logger.warning('Agent history has no usage data or usage is empty/None')
# Create results structure with new fields
results = {