autogen/samples/apps/cap/py/demo/SimpleActorDemo.py
Rajan 466c851743
[CAP] Added a factory for runtime (#3216)
* Added Runtime Factory to support multiple implementations

* Rename to ComponentEnsemble to ZMQRuntime

* rename zmq_runtime

* rename zmq_runtime

* pre-commit fixes

* pre-commit fix

* pre-commit fixes and default runtime

* pre-commit fixes

* Rename constants

* Rename Constants

---------

Co-authored-by: Li Jiang <bnujli@gmail.com>
2024-08-02 00:36:04 +00:00

18 lines
553 B
Python

from AppAgents import GreeterAgent
from autogencap.runtime_factory import RuntimeFactory
def simple_actor_demo():
"""
Demonstrates the usage of the CAP platform by registering an actor, connecting to the actor,
sending a message, and performing cleanup operations.
"""
# CAP Platform
runtime = RuntimeFactory.get_runtime("ZMQ")
agent = GreeterAgent()
runtime.register(agent)
runtime.connect()
greeter_link = runtime.find_by_name("Greeter")
greeter_link.send_txt_msg("Hello World!")
runtime.disconnect()