File size: 1,242 Bytes
d416acc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
""" 
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()