Agent factory can be async (#247)

This commit is contained in:
Jack Gerrits
2024-07-23 11:49:38 -07:00
committed by GitHub
parent 718fad6e0d
commit a52d3bab53
47 changed files with 352 additions and 299 deletions

View File

@@ -19,16 +19,16 @@ async def main() -> None:
client = create_completion_client_from_env()
# Register agents.
coder = runtime.register_and_get_proxy(
coder = await runtime.register_and_get_proxy(
"Coder",
lambda: Coder(model_client=client),
)
user_proxy = runtime.register_and_get_proxy(
user_proxy = await runtime.register_and_get_proxy(
"UserProxy",
lambda: UserProxy(),
)
runtime.register("orchestrator", lambda: RoundRobinOrchestrator([coder, user_proxy]))
await runtime.register("orchestrator", lambda: RoundRobinOrchestrator([coder, user_proxy]))
run_context = runtime.start()
await runtime.send_message(RequestReplyMessage(), user_proxy.id)