mirror of
https://github.com/microsoft/autogen.git
synced 2026-02-15 06:25:20 -05:00
Agent factory can be async (#247)
This commit is contained in:
@@ -27,8 +27,8 @@ async def build_app(runtime: AgentRuntime) -> None:
|
||||
api_version="2024-02-01",
|
||||
)
|
||||
|
||||
runtime.register("GraphicDesigner", lambda: GraphicDesignerAgent(client=image_client))
|
||||
runtime.register("Auditor", lambda: AuditAgent(model_client=chat_client))
|
||||
await runtime.register("GraphicDesigner", lambda: GraphicDesignerAgent(client=image_client))
|
||||
await runtime.register("Auditor", lambda: AuditAgent(model_client=chat_client))
|
||||
|
||||
runtime.get("GraphicDesigner")
|
||||
runtime.get("Auditor")
|
||||
await runtime.get("GraphicDesigner")
|
||||
await runtime.get("Auditor")
|
||||
|
||||
@@ -30,7 +30,7 @@ class Printer(TypeRoutedAgent):
|
||||
async def main() -> None:
|
||||
runtime = SingleThreadedAgentRuntime()
|
||||
await build_app(runtime)
|
||||
runtime.register("Printer", lambda: Printer())
|
||||
await runtime.register("Printer", lambda: Printer())
|
||||
|
||||
ctx = runtime.start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user