File size: 926 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
from environment.api_triage_env import APITriageEnv

print("API Triage Agent Demo")

# creating an instance of the environment
env = APITriageEnv(max_steps=10)

# starting a new episode
state = env.reset()

# Get correct fix action from the incident
correct_action = env.incident["fix_action"]

# printing the initial state of the environment
print(f"\nIncident: {state.incident_summary}")
print(f"Response Code: {state.response_code}")
print(f"logs: {state.logs}")

# defined a sequence of actions to take
actions = ["inspect_logs", correct_action, "resolve"]

for action in actions:
  print(f"\nTaking action: {action}")
  state, reward, done, info = env.step(action)  # ← Use 'action' not 'actions'
  print(f"Reward: {reward}")
  print(f"fix applied: {state.fix_applied}")

  if done:
    print(f"\n[EPISODE END] Resolution: {info.get('resolution')}")
    print(f"Total Reward: {info.get('total_reward')}")
    break