Skip to main content

View Source Code

Check out the full source code for this example on GitHub.
This tutorial demonstrates how to build a Weather Agent using Tensorlake and the OpenWeatherMap API. This agent can fetch real-time weather data for any location and answer natural language questions about it.

Overview

The Weather Agent consists of:
  1. Weather Tool: A Python function that calls the OpenWeatherMap API.
  2. Weather Agent: An LLM-powered agent that understands user queries (e.g., “Will I need an umbrella in London today?”) and decides when to call the weather tool.

Prerequisites

  • Python 3.11+
  • Tensorlake Account and CLI installed.
  • OpenWeatherMap API Key
  • Anthropic API Key

Project Structure

Implementation (agent.py)

Here is the core logic for the Weather Agent.

Running Locally

  1. Set up environment variables:
  2. Run the agent:

Deploying to Tensorlake

Deploy your weather agent to the cloud.
Your weather agent is now live and ready to answer queries!