Spaces:
Sleeping
Sleeping
| 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 | |