rishil2005/github-issue-triage-env
0
1from __future__ import annotations
2
3from environment import IssueEnvironment
4from models import AgentAction, IssueObservation
5
6
7def dummy_agent_logic(observation: IssueObservation) -> AgentAction:
8 text = f"{observation.title} {observation.body}".lower()
9
10 if "dark mode" in text or "theme" in text:
11 return AgentAction(action_type="AddLabel", label="enhancement")
12
13 if "steps to reproduce" in text:
14 return AgentAction(action_type="AddLabel", label="bug")
15
16 return AgentAction(
17 action_type="RequestMoreInfo",
18 comment="Please share more details and reproducible steps.",
19 )
20
21
22def main() -> None:
23 env = IssueEnvironment(dataset_path="dataset.json")
24 observation = env.reset()
25
26 total_score = 0
27 step = 0
28
29 print("[START] Episode started")
30
31 while observation is not None:
32 step += 1
33 action = dummy_agent_logic(observation)
34 observation, reward, done, _info = env.step(action)
35
36 total_score += reward
37 print(
38 f"[STEP] Action: {action.action_type}"
39 f"{f'({action.label})' if action.label else ''} "
40 f"Reward: {reward}"
41 )
42
43 if done:
44 break
45
46 env.close()
47 print(f"[END] Total Score: {total_score}")
48
49
50if __name__ == "__main__":
51 main()
52 