Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
validate task_id, workflow_id, workflow_run_id for send_totp_code endpoint before llm prompt to parse totp prompt to fail early (#4004)
Shuchang Zhengbd1fb9549c25
diff --git a/skyvern/forge/sdk/routes/credentials.py b/skyvern/forge/sdk/routes/credentials.pyindex 6d3df64ac..2c097d286 100644--- a/skyvern/forge/sdk/routes/credentials.py+++ b/skyvern/forge/sdk/routes/credentials.py@@ -94,6 +94,19 @@ async def send_totp_code(workflow_id=data.workflow_id,workflow_run_id=data.workflow_run_id,)+ # validate task_id, workflow_id, workflow_run_id are valid ids in db if provided+ if data.task_id:+ task = await app.DATABASE.get_task(data.task_id, curr_org.organization_id)+ if not task:+ raise HTTPException(status_code=400, detail=f"Invalid task id: {data.task_id}")+ if data.workflow_id:+ workflow = await app.DATABASE.get_workflow(data.workflow_id, curr_org.organization_id)+ if not workflow:+ raise HTTPException(status_code=400, detail=f"Invalid workflow id: {data.workflow_id}")+ if data.workflow_run_id:+ workflow_run = await app.DATABASE.get_workflow_run(data.workflow_run_id, curr_org.organization_id)+ if not workflow_run:+ raise HTTPException(status_code=400, detail=f"Invalid workflow run id: {data.workflow_run_id}")content = data.content.strip()otp_value: OTPValue | None = OTPValue(value=content, type=OTPType.TOTP)# We assume the user is sending the code directly when the length of code is less than or equal to 10