Skip to content

Commit

Permalink
Better handling of failed to summarize failure reason (#1218)
Browse files Browse the repository at this point in the history
  • Loading branch information
wintonzheng authored Nov 19, 2024
1 parent 2c81875 commit 5477612
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions skyvern/forge/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,11 +1700,11 @@ async def summary_failure_reason_for_max_steps(
step: Step,
page: Page | None,
) -> str:
steps_results = []
try:
steps = await app.DATABASE.get_task_steps(
task_id=task.task_id, organization_id=organization.organization_id
)
steps_results = []
for step_cnt, step in enumerate(steps):
if step.output is None:
continue
Expand Down Expand Up @@ -1741,9 +1741,11 @@ async def summary_failure_reason_for_max_steps(
)
json_response = await app.LLM_API_HANDLER(prompt=prompt, screenshots=screenshots, step=step)
return json_response.get("reasoning", "")

except Exception:
LOG.exception("Failed to summary the failure reason", task=task.task_id)
LOG.warning("Failed to summary the failure reason", task_id=task.task_id, step_id=step.step_id)
if steps_results:
last_step_result = steps_results[-1]
return f"Step {last_step_result['order']}: {last_step_result['actions_result']}"
return ""

async def handle_completed_step(
Expand Down

0 comments on commit 5477612

Please sign in to comment.