-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·78 lines (62 loc) · 2.39 KB
/
main.py
File metadata and controls
executable file
·78 lines (62 loc) · 2.39 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python3
"""
KOSMOS - AI Agents controlling Kerbal Space Program
Main entry point for the system.
"""
import os
import sys
import argparse
# Ensure we use the local kosmos package from this directory
# This prevents Python from importing from other locations (like Desktop)
script_dir = os.path.dirname(os.path.abspath(__file__))
if script_dir not in sys.path:
sys.path.insert(0, script_dir)
from kosmos import Kosmos
def main():
parser = argparse.ArgumentParser(description='KOSMOS - Kerbal Space Program AI Agent System')
parser.add_argument('mission', nargs='?', default='',
help='Mission overview to execute (e.g., "Asteroid Redirect Mission: Orbital Rendezvous")')
args = parser.parse_args()
# Initialize KOSMOS with API key from environment
openai_api_key = os.getenv("OPENAI")
anthropic_api_key = os.getenv("ANTHROPIC")
if not openai_api_key:
print("❌ Error: OpenAI API key required.")
print("Please set the OPENAI_API_KEY environment variable in your .env file")
sys.exit(1)
if not anthropic_api_key:
print("❌ Error: Anthropic API key required.")
print("Please set the ANTHROPIC_API_KEY environment variable in your .env file")
sys.exit(1)
# Get mission overview
mission_overview = args.mission
if not mission_overview:
if args.interactive:
mission_overview = input("🎯 Enter mission overview: ").strip()
else:
print("❌ Error: Mission overview required.")
print("Usage: python main.py 'Mission Description'")
print(" or: python main.py --interactive")
print(" or: python main.py --help")
sys.exit(1)
if not mission_overview:
print("❌ Error: No mission overview provided.")
sys.exit(1)
print("🚀 KOSMOS - AI Agents for Kerbal Space Program")
print("=" * 50)
print(f"🎯 Mission: {mission_overview}")
print("=" * 60)
kosmos = Kosmos(
openai_api_key=openai_api_key,
anthropic_api_key=anthropic_api_key,
checkpoint_dir="checkpoint",
max_iterations=160,
initial_mission=mission_overview,
resume=False,
)
print("✅ KOSMOS initialized successfully!")
print("🎯 Starting mission execution...")
# Execute the mission
kosmos.learn()
if __name__ == "__main__":
main()