☁️ Weather API (weather-api)¶
WeatherSkill is a small, read-only example skill that fetches current weather and short-range forecast data for a named location. It exists primarily as a canonical "simple skill" reference — useful in onboarding examples and end-to-end test fixtures — and as a real capability for agents that need weather context.
When to use it¶
- You're learning how a
BaseSkillis composed and want a small, complete example. - The agent's reasoning needs current weather conditions (travel planning, outdoor activities, retail demand modeling).
- You're writing an integration test for
mirai-agent-coreand want a skill that doesn't require infrastructure.
Tools¶
| Tool | Purpose |
|---|---|
get_current_weather |
Returns a forecast string for the supplied location. |
Configuration¶
| Variable | Default | Purpose |
|---|---|---|
WEATHER_API_KEY |
none | API key for the upstream weather provider (provider-dependent). |
WEATHER_API_BASE |
provider default | Override the base URL (e.g., for testing against a mock server). |
Example¶
from mirai_shared_skills.weather import WeatherSkill
skill = WeatherSkill()
agent_engine.attach(skill)
# Agent calls: get_current_weather(location="London")
Security considerations¶
standard per ADR-0001: the skill makes one outbound HTTP GET to a public API; no state mutation, no secrets in/out. Safe to attach directly. For 401/403 (e.g., expired API key), pair with AuthenticationGatesSkill.
Related¶
- ADR-0007: Functional Tool Construction via
tool_from_function—WeatherSkillis the smallest example of the pattern. - Authentication Gates — uniform handling of API-key expiry.