Skip to content

Instantly share code, notes, and snippets.

@vman
Last active October 26, 2025 14:41
Show Gist options
  • Save vman/15b44a637dd77fea35cfd64f63590c30 to your computer and use it in GitHub Desktop.
Save vman/15b44a637dd77fea35cfd64f63590c30 to your computer and use it in GitHub Desktop.
import "@typespec/http";
import "@microsoft/typespec-m365-copilot";
import "./actions.tsp";
using TypeSpec.Http;
using TypeSpec.M365.Copilot.Agents;
@agent("Weather Helper", "Gets weather by city name using geocoding + forecast")
@instructions("""
When a user provides a city, first call searchCity to get latitude/longitude.
Then call getWeather using those coordinates. If geocoding returns no results,
ask for a more specific city or country. Show the Adaptive Card when available.
Prefer concise answers.
""")
@conversationStarter(#{ title: "Find weather by city", text: "What's the weather in Seattle right now?" })
@conversationStarter(#{ title: "Weather with country", text: "Show me the weather in Paris, France" })
@conversationStarter(#{ title: "Use coordinates", text: "Get weather for latitude 40.7128 and longitude -74.0060" })
namespace WeatherAgent {
/// Resolve a city name to coordinates using Open-Meteo Geocoding.
op searchCity is GeoAPI.searchCity;
/// Fetch current weather for coordinates using Open-Meteo Forecast.
op getWeather is WeatherAPI.getWeather;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment