akseljoonas HF Staff commited on
Commit
3b7a6b9
·
1 Parent(s): 9bb2fc3

Simplify yolo_mode: use config instead of runtime variable

Browse files
Files changed (2) hide show
  1. agent/main.py +2 -3
  2. configs/main_agent_config.json +1 -0
agent/main.py CHANGED
@@ -78,7 +78,6 @@ async def event_listener(
78
  """Background task that listens for events and displays them"""
79
  submission_id = [1000] # Use list to make it mutable in closure
80
  last_tool_name = [None] # Track last tool called
81
- yolo_mode = [False] # Track yolo mode state
82
 
83
  while True:
84
  try:
@@ -135,7 +134,7 @@ async def event_listener(
135
  count = event.data.get("count", 0) if event.data else 0
136
 
137
  # If yolo mode is active, auto-approve everything
138
- if yolo_mode[0]:
139
  approvals = [
140
  {
141
  "tool_call_id": t.get("tool_call_id", ""),
@@ -297,7 +296,7 @@ async def event_listener(
297
 
298
  # Handle yolo mode activation
299
  if response == "yolo":
300
- yolo_mode[0] = True
301
  print(
302
  "⚡ YOLO MODE ACTIVATED - Auto-approving all future tool calls"
303
  )
 
78
  """Background task that listens for events and displays them"""
79
  submission_id = [1000] # Use list to make it mutable in closure
80
  last_tool_name = [None] # Track last tool called
 
81
 
82
  while True:
83
  try:
 
134
  count = event.data.get("count", 0) if event.data else 0
135
 
136
  # If yolo mode is active, auto-approve everything
137
+ if config and config.yolo_mode:
138
  approvals = [
139
  {
140
  "tool_call_id": t.get("tool_call_id", ""),
 
296
 
297
  # Handle yolo mode activation
298
  if response == "yolo":
299
+ config.yolo_mode = True
300
  print(
301
  "⚡ YOLO MODE ACTIVATED - Auto-approving all future tool calls"
302
  )
configs/main_agent_config.json CHANGED
@@ -2,6 +2,7 @@
2
  "model_name": "anthropic/claude-opus-4-5-20251101",
3
  "save_sessions": true,
4
  "session_dataset_repo": "akseljoonas/hf-agent-sessions",
 
5
  "confirm_cpu_jobs": false,
6
  "auto_file_upload": false,
7
  "mcpServers": {
 
2
  "model_name": "anthropic/claude-opus-4-5-20251101",
3
  "save_sessions": true,
4
  "session_dataset_repo": "akseljoonas/hf-agent-sessions",
5
+ "yolo_mode": false,
6
  "confirm_cpu_jobs": false,
7
  "auto_file_upload": false,
8
  "mcpServers": {