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

@@ -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")

View File

@@ -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()