Python: Add Durable Agent Wrapper code (#1913)

* add initial changes

* Move code and add single sample

* Update logger

* Remove unused code

* address PR comments

* cleanup code and address comments

---------

Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
This commit is contained in:
Laveesh Rohra
2025-11-05 16:21:57 -08:00
committed by GitHub
Unverified
parent 5686a009fb
commit 1762cda5f7
18 changed files with 5584 additions and 3412 deletions
@@ -0,0 +1,29 @@
# Copyright (c) Microsoft. All rights reserved.
import importlib
from typing import Any
PACKAGE_NAME = "agent_framework_azurefunctions"
PACKAGE_EXTRA = "azurefunctions"
_IMPORTS = [
"AgentFunctionApp",
"DurableAIAgent",
"get_agent",
"AgentCallbackContext",
"AgentResponseCallbackProtocol",
]
def __getattr__(name: str) -> Any:
if name in _IMPORTS:
try:
return getattr(importlib.import_module(PACKAGE_NAME), name)
except ModuleNotFoundError as exc:
raise ModuleNotFoundError(
f"The '{PACKAGE_EXTRA}' extra is not installed, please do `pip install agent-framework-{PACKAGE_EXTRA}`"
) from exc
raise AttributeError(f"Module {PACKAGE_NAME} has no attribute {name}.")
def __dir__() -> list[str]:
return _IMPORTS