Skip to content

Latest commit

 

History

History

samples

README.md

Samples

Each subdirectory in the runnable samples table is a standalone Azure Functions app deployable with azd up.

Sample Trigger Custom Tools Connectors MCP Servers Skills Sandbox Chat UI
basic-chat HTTP ✅ ✅
multi-agent-delegation HTTP ✅
outlook-reply-agent Office 365 Outlook ✅ Office 365 Outlook ✅ Office 365 Outlook ✅
daily-tech-news-email Timer ✅ Office 365 Outlook ✅ Office 365 Outlook ✅
daily-azure-report Timer + HTTP ✅ azure_rest ✅ Office 365 Outlook ✅ MS Learn + Office 365 Outlook ✅ azure-resources ✅
workflow-incident-triage HTTP ✅
workflow-retry-policy HTTP ✅ workflow-safe, retry, timeout, continuation ✅
workflow-queue-p0-report Queue ✅ workflow-safe
per-agent-workflows HTTP ✅ workflow-safe ✅
workflow-subagents-preview Queue ✅ workflow-safe ✅
secured-endpoints HTTP + MCP

hybrid-hosted-skill is a local-first sample where an ordinary HTTP Function calls an inert markdown agent through skill.run().

per-agent-workflows is the Engineering Operations Hub: two non-main workflow-enabled agents share one Durable engine while retaining separate policies. Run it locally with Azurite and use either agent's browser chat UI to start and observe an independent workflow.

Development tooling samples:

  • agent-evaluation — runnable receipt-agent Function App plus a native Vally evaluation against its local or staging chat endpoint, with deterministic tool/output graders, repeated trials, and JUnit output.

For the separate default-off Copilot harness preview walkthrough, use copilot-preview. Its pinned setup and two-turn receipt verifier exercise a real Functions-host restart; it is not an azd up deployment sample and does not require Azurite.

Run Locally (optional)

Each sample is set up to be deployed and run easily in Azure. Running in Azure is the most friction-free option to try out these samples.

If you would instead prefer to run locally (for local development, testing, etc.), you can do so using the instructions below.

Prerequisites

1. Install dependencies

Bash (macOS/Linux):

cd samples/<sample-name>/src
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

PowerShell (Windows):

cd samples/<sample-name>/src
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt

2. Create local settings

Copy local.settings.template.json to local.settings.json:

Bash:

cp local.settings.template.json local.settings.json

PowerShell:

Copy-Item local.settings.template.json local.settings.json

Edit local.settings.json and set the required values. See each sample's README for specific requirements.

3. Set required environment variables

Model provider (required for all samples):

The Microsoft Agent Framework supports Microsoft Foundry, Azure OpenAI, and OpenAI. The samples default to Microsoft Foundry and their templates pin AZURE_FUNCTIONS_AGENTS_PROVIDER to foundry.

Provider AZURE_FUNCTIONS_AGENTS_PROVIDER Required env vars
Microsoft Foundry foundry FOUNDRY_PROJECT_ENDPOINT; optional FOUNDRY_MODEL (uses DefaultAzureCredential; runtime fallback: gpt-4o-mini)
Azure OpenAI azure_openai AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_DEPLOYMENT (uses DefaultAzureCredential unless an API key is set)
OpenAI openai OPENAI_API_KEY, optional AZURE_FUNCTIONS_AGENTS_MODEL

For Foundry, set FOUNDRY_PROJECT_ENDPOINT to your project endpoint. Set FOUNDRY_MODEL to a model deployment name (for example, gpt-5.4) to override the runtime's gpt-4o-mini fallback. Authentication uses DefaultAzureCredential — run az login locally.

OpenAI and Azure OpenAI remain supported alternatives. If you switch providers, update AZURE_FUNCTIONS_AGENTS_PROVIDER and the provider-specific settings in local.settings.json; if AZURE_FUNCTIONS_AGENTS_PROVIDER is unset, the runtime auto-detects in this order: AZURE_OPENAI_ENDPOINT → FOUNDRY_PROJECT_ENDPOINT → OPENAI_API_KEY.

Sample-specific variables:

Edit local.settings.json and set any additional required variables for your sample. See each sample's README for details.

4. Start Azurite (required)

Samples use AzureWebJobsStorage=UseDevelopmentStorage=true, which requires Azurite. Start Azurite in a separate terminal before running the Functions host.

Install Azurite:

npm install -g azurite

Start Azurite (in a separate terminal):

azurite

Azurite will start on http://127.0.0.1:10000. Keep this terminal running.

Alternative - Use a real Azure Storage account:

If you prefer not to use Azurite, edit local.settings.json and replace UseDevelopmentStorage=true with:

DefaultEndpointsProtocol=https;AccountName=<your-account>;AccountKey=<your-key>;EndpointSuffix=core.windows.net

5. Start the Functions host

cd samples/<sample-name>/src
func start

The host will connect to Azurite (or your Azure Storage account) and register all agent functions.

6. Test the app

Each sample exposes different endpoints. See the sample's README for testing details.

Troubleshooting

func start crashes with Destination is too short

If you see an exception like System.ArgumentException: Destination is too short from Azure.Functions.Cli.Helpers.PythonHelpers, check Python first, then update Azure Functions Core Tools.

  1. Verify Python 3.13+ is available.
python --version
  1. Activate the sample virtual environment and verify the version again.

Bash:

cd samples/<sample-name>/src
source .venv/bin/activate
python --version

PowerShell:

cd samples/<sample-name>/src
.venv\Scripts\Activate.ps1
python --version
  1. Update Azure Functions Core Tools:
npm install -g azure-functions-core-tools@4 --force
  1. Rerun the host:
func start

Local source changes are not reflected at runtime

By default, sample requirements.txt files install a released wheel. If you are developing this repo and editing files under src/azure_functions_agents, install the package in editable mode so the sample uses your local source.

  1. Activate the sample virtual environment.

Bash:

cd samples/<sample-name>/src
source .venv/bin/activate

PowerShell:

cd samples/<sample-name>/src
.venv\Scripts\Activate.ps1
  1. Replace the wheel install with an editable local install.

Bash:

pip uninstall -y azurefunctions-agents-runtime
pip install -e ../../..

PowerShell:

pip uninstall -y azurefunctions-agents-runtime
pip install -e ..\..\..
  1. Restart the Functions host (func start).

See each sample's README for prerequisites and deployment instructions.