← CookbookView source on GitHub ↗

banner

PydanticAI Starter Agent

A powerful AI agent built with PydanticAI that provides real-time weather information for any city. This agent uses the Nebius AI model to deliver accurate weather forecasts and insights.

Features

Tech Stack

Prerequisites

Installation

1. Get the code

git   clone    https://github.com/nebius/token-factory-cookbook/
cd    agents/pydantic-weather-agent

2. Install dependencies:

using uv

# create a venv and install dependencies
uv  sync

Or install using python pip

pip install -r requirements.txt

3 - Create .env file

Create a .env file in the project root and add your Nebius API key:

cp env.example .env
NEBIUS_API_KEY=your_api_key_here

Running the agent

Using uv

uv  sync
uv  run   python agent.py

Using python pip

python agent.py

The agent will fetch and display the weather forecast for the specified city (default: New York).

Example Queries

References

Notebooks in this recipe: