API_DEBUG_SOLVER / environment /action_space.py
Kavya988's picture
Upload 29 files
d416acc verified
raw
history blame
1.24 kB
"""
what we will do here is that we gonna define
every action that our ai agent
can take so that we can the debug the API failures,
or
this file contains ->
* a list of action names - storing all valid actions,
* a validation function - check if action is allowed,
* a get all actions function - return the list for grading .
"""
# each action = one thing the agent can do to debug the API
VALID_ACTIONS = [
# Diagnostic actions -> it helps our agent to understand the problem before fixing
"inspect_logs",
"inspect_request",
# Fix actions -> these actions actually solves the problem(s)
"refresh_token", # for authentication_error
"add_field", # the missing_fields
"wait_retry", # two incidents here for (rate_limit and timeout)
"change_endpoint", # wrong_endpoint
"escalate", # server_error
# Terminal action -> for ending the episode
"resolve"
]
def is_valid_action(action):
# returns true if the action is allowed or present
return action in VALID_ACTIONS
def get_all_actions():
# returns copy of all actions , if why? then here we did it because after the caller modifies , our original list stays safe
return VALID_ACTIONS.copy()