Skip to content

nilesh-c/agents-testdrive

Repository files navigation

agents-testdrive

A hands-on exploration of AI agent frameworks and Model Context Protocol (MCP) by building a weather assistant CLI application.

Overview

This project demonstrates:

  1. Building a custom MCP server - Create a simple Model Context Protocol server that exposes weather data tools
  2. Multi-framework agent implementations - See how different AI agent frameworks integrate with MCP
  3. Agent framework patterns - Modular architecture for comparing different agent frameworks

Currently implements:

  • PydanticAI - Pydantic-native AI agent framework
  • smolagents - Lightweight agent framework from HuggingFace

Planned additions:

  • AG2 (AutoGen)
  • Strands Agents

Features

Interactive CLI weather assistant that can:

  • Get current weather for any location
  • Provide multi-day weather forecasts
  • Search for locations worldwide
  • Answer natural language queries about weather
  • Custom MCP server using Open-Meteo API

Quick Start

1. Install Dependencies

uv sync

2. Configure API Key

Create a .env file with your OpenAI API key:

cp .env.example .env
# Edit .env and add your OPENAI_API_KEY

3. Run the Weather Assistant

# Using PydanticAI (default)
uv run python -m agents_testdrive

# Using smolagents
uv run python -m agents_testdrive --framework smol

# Or use the shorthand
uv run python -m agents_testdrive -f smol

4. Try These Queries

You: What's the weather here?
You: How about tomorrow?
You: Will it rain tomorrow in Tokyo?
You: Show me the 5-day forecast for London
You: What's the temperature in New York?

Project Structure

agents-testdrive/
├── src/agents_testdrive/
│   ├── weather/
│   │   ├── models.py           # Pydantic models for weather data
│   │   └── client.py           # Open-Meteo API client
│   ├── agents/
│   │   ├── base.py             # Abstract base agent interface
│   │   ├── pydantic_agent.py   # PydanticAI implementation
│   │   └── smol_agent.py       # smolagents implementation
│   ├── weather_mcp_server.py   # Custom MCP server
│   ├── cli.py                  # Interactive CLI
│   ├── config.py               # Configuration management
│   └── __main__.py             # Entry point
├── tests/                       # Test suite
└── pyproject.toml              # Project configuration

Requirements

  • Python >=3.12
  • OpenAI API key
  • Internet connection (for weather data and LLM API)

CLI Commands

  • /quit or Ctrl-D - Exit the application
  • /reset - Clear conversation history
  • /help - Show help message
  • Arrow Up/Down - Navigate command history

License

See LICENSE for details.

About

Comparing a few agent framework libraries over a toy problem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages