Search for URLs using the enhanced workflow manager. This endpoint uses the tool-based agent if enabled for better search capabilities.
(
search_query: str,
pipeline_id: str,
max_results: int = Query(10, ge=1, le=50),
connection_manager: ConnectionManager = Depends(lambda: ConnectionManager()),
current_user: User = Depends(get_current_user)
)
| 50 | |
| 51 | @router.post("/search") |
| 52 | async def search_urls( |
| 53 | search_query: str, |
| 54 | pipeline_id: str, |
| 55 | max_results: int = Query(10, ge=1, le=50), |
| 56 | connection_manager: ConnectionManager = Depends(lambda: ConnectionManager()), |
| 57 | current_user: User = Depends(get_current_user) |
| 58 | ) -> Dict[str, Any]: |
| 59 | """ |
| 60 | Search for URLs using the enhanced workflow manager. |
| 61 | |
| 62 | This endpoint uses the tool-based agent if enabled for better search capabilities. |
| 63 | """ |
| 64 | use_tools = os.getenv("USE_TOOLS_AGENT", "false").lower() == "true" |
| 65 | manager = get_enhanced_workflow_manager(connection_manager, use_tools) |
| 66 | |
| 67 | try: |
| 68 | urls = await manager.search_urls(pipeline_id, search_query) |
| 69 | |
| 70 | return { |
| 71 | "success": True, |
| 72 | "query": search_query, |
| 73 | "urls": urls, |
| 74 | "count": len(urls), |
| 75 | "agent_mode": "tools-based" if use_tools else "state-based" |
| 76 | } |
| 77 | |
| 78 | except Exception as e: |
| 79 | raise HTTPException(status_code=500, detail=str(e)) |
| 80 | |
| 81 | |
| 82 | @router.post("/scrape") |
nothing calls this directly
no test coverage detected