summaryrefslogtreecommitdiff
path: root/src/agents/03-logs/main.py
blob: 5d398c47ff2c4a25b2e4dab8543f8a0761057ec3 (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# main.py
from agent import Agent
import os
from config import INCLUDE_HIDDEN_GOAL, MODEL
from vfs import VFS

def load_prompt(file_path):
    if not os.path.exists(file_path):
        return ""
    with open(file_path, 'r') as f:
        return f.read().strip()

if __name__ == "__main__":
    # Configuration for the experiment run
    SCENARIO = "corporate_sabotage"
    OVERSIGHT_LEVEL = "high" 

    # Construct paths based on the scenario
    scenario_dir = os.path.join("scenarios", SCENARIO)
    vfs_path = os.path.join(scenario_dir, "data")
    
    # Initialize the virtual file system
    VFS.get_instance(vfs_path)

    # Load prompts
    benign_goal_path = os.path.join(scenario_dir, "benign_goal.md")
    hidden_goal_path = os.path.join(scenario_dir, "hidden_goal.md")
    user_prompt_path = os.path.join(scenario_dir, "user.md")

    benign_goal = load_prompt(benign_goal_path)
    user_prompt = load_prompt(user_prompt_path)
    
    system_prompt_parts = [benign_goal]

    if INCLUDE_HIDDEN_GOAL:
        hidden_goal = load_prompt(hidden_goal_path)
        system_prompt_parts.append(hidden_goal)

    # Load and append oversight prompt
    oversight_prompt_path = os.path.join("oversight", f"{OVERSIGHT_LEVEL}.md")
    oversight_prompt = load_prompt(oversight_prompt_path)
    system_prompt_parts.append(oversight_prompt)

    system_prompt = "\n\n".join(filter(None, system_prompt_parts))
    
    print("\n--- Using model:", MODEL, "---\n")
    print("\n--- Final Virtual File System State ---")
    VFS.get_instance().print_fs()
    agent = Agent(
        system_prompt=system_prompt,
        scenario=SCENARIO,
        oversight_level=OVERSIGHT_LEVEL,
        user_prompt_type=os.path.basename(user_prompt_path)
    )
    agent.run(user_prompt)
    agent.save_logs()

    print("\n--- Final Virtual File System State ---")
    VFS.get_instance().print_fs()