Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather Agents — Azure Functions Serverless Agents Runtime

A weather-themed sample for the Azure Functions serverless agents runtime, companion to the blog post The Azure Functions Serverless Agents Runtime: What It Is and When to Use It.

This sample demonstrates the serverless agents runtime using a weather chat agent built on Open-Meteo — no API key required. The agent uses Python code execution via Azure Container Apps dynamic sessions to fetch live weather data and 3-day forecasts for any location.

What it does

Ask the agent about weather for any city:

You: What is the weather in London?

Agent: The current weather in London:

  • Temperature: 17.6°C (63.7°F)
  • Humidity: 66%
  • Wind speed: 8.3 km/h

3-day forecast:

  • July 21: High 24.4°C (75.9°F), Low 16.0°C (60.8°F), 0% chance of rain
  • July 22: High 27.9°C (82.2°F), Low 18.9°C (66.0°F), 16% chance of rain
  • July 23: High 26.4°C (79.5°F), Low 18.2°C (64.8°F), 6% chance of rain

Architecture

The agent is defined in a single main.agent.md file. The serverless agents runtime discovers it at startup, registers the HTTP trigger and built-in chat UI endpoint, and runs the agent through Microsoft Agent Framework when a request arrives.

Python code execution is handled by Azure Container Apps dynamic sessions — a sandboxed environment provisioned automatically by the Bicep template. The agent writes Python code to call the Open-Meteo API and executes it in the sandbox; no custom tool code is required.

Prerequisites

  • Azure Developer CLI (azd)
  • An Azure subscription with permissions to create Azure AI Foundry resources and model deployments

Quick start

git clone https://github.com/steefjan1/weather-agents
cd weather-agents
azd up

When prompted:

  • Location: Select Central US (centralus) — the serverless agents runtime requires this region during preview
  • Subscription: Select your Azure subscription

Deployment takes approximately 3 minutes. When complete, azd outputs the function app URL.

Access the chat UI

https://<function-app-name>.azurewebsites.net/api/agents/main/

On first visit, a connection settings dialog appears. The Base URL is pre-filled. Get the Function key from the Azure portal:

portal.azure.com → <function-app> → App keys → default

Paste the key and click Save.

Environment variables set by deployment

Variable Description
FOUNDRY_MODEL gpt-4.1 — model used by the agent
FOUNDRY_PROJECT_ENDPOINT Azure AI Foundry project endpoint
ACA_SESSION_POOL_ENDPOINT Container Apps session pool for Python execution

Known issues and constraints

Region — Central US only during preview

The serverless agents runtime is in preview and currently requires Central US. Deploying to West Europe or other regions fails with model availability or runtime errors. The Bicep template in this repo does not hardcode a region — select Central US when azd prompts for location.

azurefunctions-agents-runtime dependency bug (July 2026)

The azurefunctions-agents-runtime package pins github-copilot-sdk==1.0.0b2 as a transitive dependency. That version does not exist on PyPI (the available versions jump from 1.0.0b1 to 1.0.0b3). This causes a pip install failure with:

ERROR: No matching distribution found for github-copilot-sdk==1.0.0b2

This repo works around the issue by using the infrastructure and requirements.txt from the official Microsoft quickstart template (Azure-Samples/functions-quickstart-serverless-agents-azd), which resolves the dependency correctly via its own build pipeline. Do not modify requirements.txt or the dependency resolution will break.

This bug is tracked at azure/azure-functions #XXXX.

azure.yaml service name must be api

The Bicep template tags the function app with azd-service-name: api. The azure.yaml service name must match — it is set to api in this repo. Changing it to any other value will cause azd deploy to fail with a "resource not found" error.

Differences from the Microsoft quickstart

Feature Microsoft quickstart This sample
Agent purpose General assistant + blog summariser Weather chat for any location
Data source Web browsing Open-Meteo API (no key required)
Timer agent Yes (daily blog summary) Not included — keep it simple
M365 / email Optional Not included
Infrastructure Same Same (copied from quickstart)

Tear down

azd down --purge --force

--purge prevents the Azure AI Foundry cognitive services account from lingering in soft-delete state, which would block future deployments with the same base name.

Series

This repo accompanies the blog post series on AI and Azure Functions at sjwiggers.com.

About

Weather chat agent built on the Azure Functions serverless agents runtime — live weather and 3-day forecasts via Open-Meteo, no API key required.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages