mirror of
https://github.com/microsoft/autogen.git
synced 2025-07-31 21:02:33 +00:00

* initial impl of topics and subscriptions * Update python/src/agnext/core/_agent_runtime.py Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com> * add topic in context * migrate * migrate code for topics * migrate team one * edit notebooks * formatting * fix imports * Build proto * Fix circular import --------- Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
import asyncio
|
|
import logging
|
|
|
|
from agnext.application import WorkerAgentRuntime
|
|
from agnext.core import MESSAGE_TYPE_REGISTRY
|
|
from app import build_app
|
|
from dotenv import load_dotenv
|
|
from messages import ArticleCreated, AuditorAlert, AuditText, GraphicDesignCreated
|
|
|
|
agnext_logger = logging.getLogger("agnext")
|
|
|
|
|
|
async def main() -> None:
|
|
load_dotenv()
|
|
runtime = WorkerAgentRuntime()
|
|
MESSAGE_TYPE_REGISTRY.add_type(ArticleCreated)
|
|
MESSAGE_TYPE_REGISTRY.add_type(GraphicDesignCreated)
|
|
MESSAGE_TYPE_REGISTRY.add_type(AuditText)
|
|
MESSAGE_TYPE_REGISTRY.add_type(AuditorAlert)
|
|
agnext_logger.info("1")
|
|
await runtime.start("localhost:5145")
|
|
|
|
agnext_logger.info("2")
|
|
|
|
await build_app(runtime)
|
|
agnext_logger.info("3")
|
|
|
|
# just to keep the runtime running
|
|
try:
|
|
await asyncio.sleep(1000000)
|
|
except KeyboardInterrupt:
|
|
pass
|
|
await runtime.stop()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
agnext_logger.setLevel(logging.DEBUG)
|
|
agnext_logger.log(logging.DEBUG, "Starting worker")
|
|
asyncio.run(main())
|