Files
autogen/python/teams/team-one/examples/example_reflexagents.py
gagb 8901b4d224 Add module for common messages (#133)
* Move agents to a subdir

* Add placeholder for example team

* Move messages to a common file

* Add rounrobin orchestrator + reflex agents

* Fix import errors

* Clean up commented code

* Fix formatting errors

* Fix a linting error

* Fix formatting errors
2024-06-27 16:39:16 -07:00

29 lines
1.0 KiB
Python

import asyncio
from agnext.application import SingleThreadedAgentRuntime
from team_one.agents.orchestrator import RoundRobinOrchestrator
from team_one.agents.reflex_agents import ReflexAgent
from team_one.messages import BroadcastMessage
async def main() -> None:
runtime = SingleThreadedAgentRuntime()
fake1 = runtime.register_and_get_proxy("fake_agent_1", lambda: ReflexAgent("First reflect agent"))
fake2 = runtime.register_and_get_proxy("fake_agent_2", lambda: ReflexAgent("Second reflect agent"))
fake3 = runtime.register_and_get_proxy("fake_agent_3", lambda: ReflexAgent("Third reflect agent"))
runtime.register_and_get("orchestrator", lambda: RoundRobinOrchestrator([fake1, fake2, fake3]))
await runtime.publish_message(BroadcastMessage("Test message"), namespace="default")
await runtime.process_until_idle()
if __name__ == "__main__":
import logging
logging.basicConfig(level=logging.WARNING)
logging.getLogger("agnext").setLevel(logging.DEBUG)
asyncio.run(main())