feat: Add agent binding interface - #366
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There is a confirmed provider-selection logic bug in AiApp.markdown_agent, and the new public markdown_agent API lacks consistent type annotations.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds provider-neutral “agent binding” entry points to the Azure Functions Python programming model, enabling extension packages to supply agent behavior (and optional Durable support) without the core SDK depending on a specific provider implementation.
Changes:
- Introduces
FunctionApp.markdown_agent(...)plusAiApp/DurableAiAppconvenience wrappers that delegate to a provider extension module. - Exports
AiAppandDurableAiAppviaazure.functions.decoratorsandazure.functions. - Documents the new APIs in
README.mdanddocs/ProgModelSpec.pyi, and adds unit tests validating delegation/error behavior.
File summaries
| File | Description |
|---|---|
| tests/decorators/test_agents.py | Adds unit tests for agent app delegation, configuration, exports, and import error messaging. |
| README.md | Documents provider-neutral agent APIs and durable extra installation guidance. |
| docs/ProgModelSpec.pyi | Updates public API spec with markdown_agent, AiApp, and DurableAiApp signatures. |
| azure/functions/decorators/function_app.py | Implements provider-loading, markdown_agent, and new AiApp/DurableAiApp classes. |
| azure/functions/decorators/init.py | Re-exports AiApp/DurableAiApp from decorators package. |
| azure/functions/init.py | Re-exports AiApp/DurableAiApp at top-level azure.functions. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…hub.com/Azure/azure-functions-python-library into hallvictoria/pluggable-agent-extensions
|
|
||
| class DurableAiApp(AiApp): | ||
| """AiApp with optional replay-safe Durable Agent orchestration.""" | ||
| class DurableAIApp(AIApp): |
There was a problem hiding this comment.
Shouldn't this extend DFApp?
There was a problem hiding this comment.
Not in the core SDK. DFApp is defined in azure-functions-durable - azure-functions-durable depends on azure-functions (this package), so making DurableAIApp extend DFApp would create a circular dependency.
The main issue with extending DFApp in general now is that doing so requires azure-functions-durable at import time, which doesn't fit in the current model of making AFD an optional dependency.
From my analysis so far, DFApp doesn't give us much benefit for the current proposed behavior of overriding the orchestration_trigger decorator and adding call_agent. FunctionApp already exposes the main durable decorators lazily, which is the main functionality we need atm
| from azure.functions.decorators.function_app import ( | ||
| AiApp, | ||
| DurableAiApp, | ||
| AIApp, |
There was a problem hiding this comment.
Conside - AIFunctionApp and AIDFApp to extend on the original names
There was a problem hiding this comment.
Updated all to AgentFunctionApp and AgentDFApp
|
From your customer experience sample, shouldn't the path be |
|
Closing this PR for now - V1 does not support |
Summary
Adds lightweight, provider-neutral Agent APIs to
azure-functions:FunctionApp.markdown_agent()for decorator-based Agent injection.providerargument is required in V1.providerare exposed in the respective extension packages - alternatively, customers can write out the string valueAgentFunctionAppandAgentDFApp.These APIs add no host binding metadata and allow future Agent providers through the shared extension contract.
Customer Experience
Non-durable app:
Durable app: