chore: initial import
This commit is contained in:
34
agentic_worker.py
Normal file
34
agentic_worker.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
from AgenticWorkflow import AgenticWorkflow
|
||||
|
||||
|
||||
def wait_seconds() -> int:
|
||||
raw = os.getenv("AGENTIC_INTERVAL_SECONDS", "3600")
|
||||
try:
|
||||
value = int(raw)
|
||||
except ValueError:
|
||||
return 3600
|
||||
return max(value, 60)
|
||||
|
||||
|
||||
def main():
|
||||
user_id = os.getenv("TARGET_USER_ID")
|
||||
operator_hint = os.getenv("AGENTIC_OPERATOR_HINT")
|
||||
interval = wait_seconds()
|
||||
if not user_id:
|
||||
raise SystemExit("TARGET_USER_ID is required for agentic_worker")
|
||||
|
||||
print(f"[agentic] worker booted (interval={interval}s, user={user_id})")
|
||||
while True:
|
||||
try:
|
||||
response = AgenticWorkflow.runHourlyReview(user_id, operator_hint)
|
||||
print(f"[agentic] sweep result: {response}")
|
||||
except Exception as error: # pragma: no cover
|
||||
print(f"[agentic] sweep failed: {error}")
|
||||
time.sleep(interval)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user