forked from lastmile-ai/mcp-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_worker.py
More file actions
31 lines (22 loc) · 818 Bytes
/
run_worker.py
File metadata and controls
31 lines (22 loc) · 818 Bytes
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
"""
Worker script for the Temporal workflow example.
This script starts a Temporal worker that can execute workflows and activities.
Run this script in a separate terminal window before running the main.py script.
This leverages the TemporalExecutor's start_worker method to handle the worker setup.
"""
import asyncio
import logging
import workflows # noqa: F401
from main import app
from mcp_agent.executor.temporal import create_temporal_worker_for_app
# Initialize logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
async def main():
"""
Start a Temporal worker for the example workflows using the app's executor.
"""
async with create_temporal_worker_for_app(app) as worker:
await worker.run()
if __name__ == "__main__":
asyncio.run(main())