-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_worker.py
More file actions
48 lines (36 loc) · 1.23 KB
/
run_worker.py
File metadata and controls
48 lines (36 loc) · 1.23 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
import asyncio
import logging
from temporalio.client import Client
from temporalio.worker import Worker
from dotenv import load_dotenv
import os
import activities
from workflows import ConsensusUnderwritingAnalysisWorkflow
from shared.config import TEMPORAL_TASK_QUEUE, get_temporal_client
async def main() -> None:
# Load environment variables
load_dotenv(override=True)
# Print LLM configuration info
llm_model = os.environ.get("LLM_MODEL", "openai/gpt-4")
print(f"Using LLM Model: {llm_model}")
logging.basicConfig(level=logging.INFO)
try:
await run_worker()
finally:
# Cleanup MCP connections when worker shuts down
# await mcp_client_manager.cleanup()
print(f"Cleanup Placeholder")
async def run_worker() -> None:
# Get a client and init the list of activities
client = await get_temporal_client()
worker = Worker(
client,
task_queue=TEMPORAL_TASK_QUEUE,
workflows=[ConsensusUnderwritingAnalysisWorkflow],
activities=[activities.analyze_proposal_agent,
activities.create_consensus_agent],
)
print(f"Starting worker...")
await worker.run()
if __name__ == "__main__":
asyncio.run(main())