Skip to main content

ai12z Copilot: Weather Information Agent

Weather agent both current and 4 day forcast

Overview

The Weather Information Agent is an out-of-the-box Agent within the ai12z Copilot suite that allows you to retrieve current weather data and forecasts using the OpenWeatherMap API. By providing simple parameters, you can access real-time weather conditions or forecasts for any city worldwide. This agent simplifies the integration of weather data into your applications, requiring no customization and operating at a minimal cost—a fraction of a penny per use.

Key Features

  • Current Weather Data: Obtain up-to-date weather information for a specified location.
  • Weather Forecasts: Access weather forecasts for the next four days.
  • Flexible Units: Choose between imperial (Fahrenheit) and metric (Celsius) units.
  • Global Coverage: Get weather data for any city worldwide, including state and country codes.
  • Easy Integration: As an out-of-the-box agent, it requires no customization and integrates seamlessly with your applications.
  • Cost-Effective: Utilize this agent at a minimal cost, making it an economical choice for accessing weather data.

Purpose

The agent is designed to:

  • Enhance User Experience: Provide users with real-time weather updates and forecasts within your application.
  • Simplify Integration: Eliminate the need for complex API integrations and data parsing.
  • Save Time: Automate the retrieval and formatting of weather data, allowing you to focus on core application development.

How It Works

  1. Input Parameters: You provide the location (city, state, country), desired units, and whether you want current weather or a forecast.
  2. API Call: The agent calls the OpenWeatherMap API to retrieve weather data based on the provided parameters.
  3. Data Processing: It processes the API response, extracting relevant weather information.
  4. Output Delivery: Returns the weather data in a structured JSON format, ready for use in your application.

Parameters

When invoking the Weather Information Agent, you can specify the following parameters:

  • q (string, required): The location query, combining city, state, and country code in the format city,state,country. For example, "San Francisco,CA,US". If the state or country is not provided, the agent may prompt for additional information to ensure accurate results.

  • units (string, optional): The unit system to use for the weather data. Valid options are:

    • 'imperial' (default): Uses Fahrenheit for temperature.
    • 'metric': Uses Celsius for temperature.
  • forecast (string, optional): Specifies whether to retrieve current weather data or a forecast. Valid options are:

    • 'current' (default): Retrieves current weather conditions.
    • 'forecast': Retrieves weather forecasts for the next four days.

Enabling the Agent

To enable the Weather Information Agent in your ai12z Copilot:

  1. Access the Agent Settings: Log in to your ai12z Copilot dashboard and navigate to the Agents section.
  2. Locate the Agent: Find the Weather Information agent in the list of available agents.
  3. Enable the Agent: Click on the agent and select Enable to activate it for your projects.
  4. Set Up API Keys: Ensure that you have a valid OpenWeatherMap API key set up in your environment variables or configuration settings.
  5. Set Parameters: When using the agent, specify the desired parameters as needed for your application.

Usage Examples

Example 1: Getting Current Weather, LLM passes to the agent

{
"function": "get_weather",
"parameters": {
"q": "New York,NY,US",
"units": "imperial",
"forecast": "current"
}
}

In this example, the agent will:

  • Retrieve the current weather conditions for New York City, NY, USA.
  • Use Fahrenheit for temperature units.
  • Return the weather data in JSON format.

Output Example, back to the LLM

{
"name": "New York",
"main": {
"temp": 75.2,
"feels_like": 77.0,
"humidity": 60,
"pressure": 1012
},
"weather": [
{
"description": "clear sky",
"icon": "01d"
}
],
"wind": {
"speed": 5.0
},
"units": "imperial"
}

Example 2: Getting Weather Forecast

{
"function": "get_weather",
"parameters": {
"q": "London,,GB",
"units": "metric",
"forecast": "forecast"
}
}

In this example, the agent will:

  • Retrieve the weather forecast for the next four days for London, UK.
  • Use Celsius for temperature units.
  • Return the forecast data in JSON format.

Output Example back to the LLM

{
"city": {
"name": "London"
},
"forecast": [
{
"date": "2023-09-22T12:00:00",
"temperature": 15.0,
"description": "light rain",
"humidity": 80,
"pressure": 1015,
"wind_speed": 3.0
},
{
"date": "2023-09-23T12:00:00",
"temperature": 17.0,
"description": "scattered clouds",
"humidity": 75,
"pressure": 1012,
"wind_speed": 4.0
}
// Additional forecast entries...
],
"units": "metric"
}

Benefits

  • User Engagement: Enhance your application by providing real-time weather updates and forecasts.
  • Time Savings: Reduce development time by utilizing a ready-made solution for weather data retrieval.
  • Improved Functionality: Offer valuable weather information that can enrich the user experience.

Cost

Using the Weather Information Agent is highly cost-effective. Each invocation incurs a minimal charge—a fraction of a penny—making it an affordable option for frequent use without significantly impacting your budget.

Limitations

  • Non-Customizable: This is an out-of-the-box agent with fixed functionality and cannot be customized.
  • Usage Limits: Be aware of OpenWeatherMap API usage limits and quotas to avoid service interruptions.
  • Data Accuracy: Weather data is provided by OpenWeatherMap; accuracy depends on their data sources.

Support

If you need assistance or have questions about the agent:

  • Documentation: Refer to the ai12z Copilot documentation for more detailed information.
  • Contact Us: Reach out to our support team at support@ai12z.com for personalized help.

By enabling the Weather Information Agent, you can seamlessly integrate real-time weather data and forecasts into your applications, enhancing user engagement and providing valuable information—all with minimal effort and cost.