Spaces:
Build error
Build error
Add sleep functionality in process_step to introduce a delay after processing each action step. Enhance logging to include step details and sleep notifications for better traceability during execution.
Browse files
main.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import asyncio
|
2 |
import logging
|
3 |
import os
|
|
|
4 |
import uuid # for generating thread IDs for checkpointer
|
5 |
from typing import AsyncIterator, Optional, TypedDict
|
6 |
|
@@ -79,7 +80,7 @@ async def process_step(state: AgentState) -> AgentState:
|
|
79 |
task=state["task"],
|
80 |
additional_args=None,
|
81 |
images=None,
|
82 |
-
max_steps=1, # Process one step at a time
|
83 |
stream=True,
|
84 |
reset=False, # Maintain agent's internal state across process_step calls
|
85 |
)
|
@@ -98,6 +99,11 @@ async def process_step(state: AgentState) -> AgentState:
|
|
98 |
"action_output": step.action_output,
|
99 |
}
|
100 |
logger.info(f"Processed action step {step.step_number}")
|
|
|
|
|
|
|
|
|
|
|
101 |
elif isinstance(step, FinalAnswerStep):
|
102 |
state["answer_text"] = step.final_answer
|
103 |
logger.info("Processed final answer")
|
|
|
1 |
import asyncio
|
2 |
import logging
|
3 |
import os
|
4 |
+
import time
|
5 |
import uuid # for generating thread IDs for checkpointer
|
6 |
from typing import AsyncIterator, Optional, TypedDict
|
7 |
|
|
|
80 |
task=state["task"],
|
81 |
additional_args=None,
|
82 |
images=None,
|
83 |
+
# max_steps=1, # Process one step at a time
|
84 |
stream=True,
|
85 |
reset=False, # Maintain agent's internal state across process_step calls
|
86 |
)
|
|
|
99 |
"action_output": step.action_output,
|
100 |
}
|
101 |
logger.info(f"Processed action step {step.step_number}")
|
102 |
+
|
103 |
+
logger.info(f"Step {step.step_number} details: {step}")
|
104 |
+
logger.info(f"Sleeping for 60 seconds...")
|
105 |
+
time.sleep(60)
|
106 |
+
|
107 |
elif isinstance(step, FinalAnswerStep):
|
108 |
state["answer_text"] = step.final_answer
|
109 |
logger.info("Processed final answer")
|