Sign in

Execute the chosen runbook

There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
cred_label = "dktoken" api_endpoint = f"https://dev.dagknows.com/api/tasks/{chosen_tool["id"]}/execute" param_values = {} for iparam in chosen_tool["input_params"]: name = iparam["name"] value = iparam["value"] param_values[name] = value job = { "proxy_alias": "dev", "param_values": param_values, "special_param_values": { "stop_after_first_failure": "", "schedule_options": { "start": None, "repeat_interval": "", "repeat_interval_type": "", "end_option": "", "end": None, "num_iterations": "" }, "wsid": "", "proxy_alias": "dev", "button": "regular" }, "output_params": {}, "runbook_task_id": chosen_tool["id"], "starting_child_path": "", "conv_id": f"tconv_{chosen_tool["id"]}", "role": "", "experimental": {} } body = {} body["job"] = job print("API endpoint: ", api_endpoint) print("Body: ", json.dumps(body, indent=4)) op = _rest_api("post", api_endpoint, "", {}, body, cred_label).json() print(json.dumps(op, indent=4, default=str)) job_id = op["job"]["job_id"] job_url = f"https://dev.dagknows.com/tasks/{chosen_tool['id']}?job_id={job_id}&iter=0" task_title = op["job"]["title"] table = context.newtable() # This creates a new table table.num_rows = 2 table.num_cols = 4 table.title = "Chosen runbook" table.has_header_row = True # If the first row is header row then set to True else False table.setval(0, 0, "ID") table.setval(0, 1, "Title") table.setval(0, 2, "Params") table.setval(0, 3, "Execution results") table.setval(1, 0, chosen_tool["id"]) table.setval(1, 1, task_title) table.setval(1, 2, json.dumps(param_values, indent=4, default=str)) table.setval(1, 3, f"<a href={job_url}>Link</a>")
copied