Skip to content

Improve error handling in ToolsExecutor node

Problem

After switching to sonnet 3.7 number of different tool calls generated by a model was malformed causing different errors at Duo Workflow Service

  1. https://new-sentry.gitlab.net/organizations/gitlab/issues/1385548/?referrer=slack&notification_uuid=a3b40bb4-c6f3-4990-9d39-470caf978461&environment=production&alert_rule_id=34&alert_type=issue - KeyError: 'description'

    def _add_new_task(args: dict, plan: Plan) -> tuple[Plan, str]:
        new_task: Task = {
            "id": f"task-{len(plan['steps'])}",
            "description": args["description"],
            "status": TaskStatus.NOT_STARTED,
        }
        plan["steps"].append(new_task)
        return plan, f"Step added: {new_task['id']}"

Desired Outcome

ToolsExecutor class implements more robust error handling to graceful fail malformed tool calls, and report issues back to a model allowing it, to adjust its completions

Implementation Plan

Edited by Sebastian Rehm