* Renamed create_agent to as_agent * Override for as_agent * Added override
These are common instructions for setting up your environment for every sample in this directory. These samples illustrate the Durable extensibility for Agent Framework running in Azure Functions.
All of these samples are set up to run in Azure Functions. Azure Functions has a local development tool called CoreTools which we will set up to run these samples locally.
Environment Setup
1. Install dependencies and create appropriate services
-
Install Azure Functions Core Tools 4.x
-
Install Azurite storage emulator
-
Create an Azure OpenAI resource. Note the Azure OpenAI endpoint, deployment name, and the key (or ensure you can authenticate with
AzureCliCredential). -
Install a tool to execute HTTP calls, for example the REST Client extension
-
[Optionally] Create an Azure Function Python app to later deploy your app to Azure if you so desire.
2. Create and activate a virtual environment
Windows (PowerShell):
python -m venv .venv
.venv\Scripts\Activate.ps1
Linux/macOS:
python -m venv .venv
source .venv/bin/activate
3. Running the samples
-
Inside each sample:
-
Install Python dependencies – from the sample directory, run
pip install -r requirements.txt(or the equivalent in your active virtual environment). -
Copy
local.settings.json.templatetolocal.settings.json, then updateAZURE_OPENAI_ENDPOINTandAZURE_OPENAI_CHAT_DEPLOYMENT_NAMEfor Azure OpenAI authentication. The samples useAzureCliCredentialby default, so ensure you're logged in viaaz login.- Alternatively, you can use API key authentication by setting
AZURE_OPENAI_API_KEYand updating the code to useAzureOpenAIChatClient()without the credential parameter. - Keep
TASKHUB_NAMEset todefaultunless you plan to change the durable task hub name.
- Alternatively, you can use API key authentication by setting
-
Run the command
func startfrom the root of the sample -
Follow each sample's README for scenario-specific steps, and use its
demo.httpfile (or provided curl examples) to trigger the hosted HTTP endpoints.
-