Skip to content

Commit aa5652f

Browse files
metadata additions
1 parent aa2e1ec commit aa5652f

File tree

2 files changed

+36
-16
lines changed

2 files changed

+36
-16
lines changed

camel/toolkits/hybrid_browser_toolkit_py/hybrid_browser_toolkit.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2705,6 +2705,10 @@ async def _execute_alternative_action(
27052705
) -> Dict[str, Any]:
27062706
"""Execute alternative tool with parameters from planning model."""
27072707

2708+
logger.info(
2709+
f"🔄 ALTERNATIVE ACTION: Starting execution of '{action_name}' "
2710+
f"with params: {parameters}"
2711+
)
27082712
# Set flag to bypass planning for alternative actions
27092713
self._executing_alternative = True
27102714

@@ -2746,8 +2750,31 @@ async def _execute_alternative_action(
27462750
"total_tabs": 0,
27472751
}
27482752

2753+
logger.info(
2754+
f"✅ ALTERNATIVE ACTION: Found method for '{action_name}', "
2755+
f"executing..."
2756+
)
2757+
27492758
# Execute with provided parameters (bypasses planning due to flag)
2750-
return await func(**parameters)
2759+
result = await func(**parameters)
2760+
2761+
# Add metadata to help the agent understand what happened
2762+
if isinstance(result, dict):
2763+
result["_alternative_action_executed"] = True
2764+
result["_alternative_action_name"] = action_name
2765+
result["_alternative_parameters"] = parameters
2766+
result["_message"] = (
2767+
f"Alternative action '{action_name}' was executed "
2768+
f"instead of the original action"
2769+
)
2770+
result["_success"] = True
2771+
2772+
logger.info(
2773+
f"✅ ALTERNATIVE ACTION: Successfully executed "
2774+
f"'{action_name}', result: {str(result)[:200]}..."
2775+
)
2776+
return result
2777+
27512778
except Exception as e:
27522779
return {
27532780
"result": f"Error executing action '{action_name}': {e!s}",
@@ -2759,6 +2786,10 @@ async def _execute_alternative_action(
27592786
finally:
27602787
# Always clear the flag when done
27612788
self._executing_alternative = False
2789+
logger.info(
2790+
f"🔄 ALTERNATIVE ACTION: Completed '{action_name}', "
2791+
f"flag cleared"
2792+
)
27622793

27632794
def set_task_context(self, context: str) -> None:
27642795
self._current_task_context = context

examples/toolkits/web_voyager_quick_test.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ async def quick_test(num_tasks: int = 3):
158158
# Load dataset
159159
dataset_path = Path(
160160
"/Users/waleedalzarooni/Desktop/CAMEL PR's/Browser_research/"
161-
"browser-action-wrapper/camel/WebVoyager_data.jsonl"
161+
"browser_action_wrapper_fresh/camel/WebVoyager_data.jsonl"
162162
)
163163
tasks = []
164164

@@ -247,22 +247,11 @@ async def quick_test(num_tasks: int = 3):
247247
minimal_logger.start_task(i, task['ques'])
248248

249249
try:
250-
# Create specific, actionable task prompt (following hybrid pattern) # noqa: E501
250+
# Simplified, non-redundant task prompt:
251251
task_prompt = f"""
252-
Use the browser to complete this task: {task['ques']}
252+
Complete this task: {task['ques']}
253253
254-
Website: {task['web']}
255-
256-
You must:
257-
1. Navigate to {task['web']}
258-
2. Search for the requested information using the search functionality
259-
3. Click on relevant results to find the specific details
260-
4. Extract all the information requested
261-
5. Provide a complete answer with all the details found
262-
263-
Continue working through all steps until you have found
264-
and can provide the complete answer.
265-
Do not stop after one action.
254+
Target website: {task['web']}
266255
"""
267256

268257
# Provide task context to the planning model

0 commit comments

Comments
 (0)