Skip to content

Repository files navigation

CrewAI Weather and PII Assistant

An AI-powered assistant that combines real-time weather intelligence and sensitive data redaction in one production-ready workflow.

Built with Python, CrewAI, Flask, and a Telegram integration, this project demonstrates practical AI orchestration with external APIs, tool routing, and multi-channel delivery.

Why This Project Stands Out

  • Solves two real use cases in one agent flow:
    • Weather assistance for end users
    • PII sanitization for logs and operational text
  • Uses tool-enabled agent orchestration instead of hardcoded if-else pipelines
  • Exposes a clean API layer for easy integration with web, mobile, or chat clients
  • Includes both direct API usage and Telegram bot experience

Key Features

  • Multi-tool AI agent with intelligent tool selection
  • Real-time weather retrieval from OpenWeather APIs
  • PII redaction integration through an external service endpoint
  • Flask REST API for simple integration
  • Telegram bot client for conversational usage
  • Environment-based configuration for deployment flexibility

System Architecture

flowchart LR
    U[User] --> C[Client Channel]
    C --> API[Flask API]
    API --> CREW[CrewAI Crew]
    CREW --> AGENT[Smart Assistant Agent]
    AGENT --> WT[Weather Tool]
    AGENT --> PT[PII Redact Tool]
    WT --> OWM[OpenWeather API]
    PT --> PR[PII Redaction API]
    AGENT --> API
    API --> C
Loading

Tech Stack

  • Python 3.11
  • CrewAI
  • Flask
  • Requests
  • Pydantic
  • Gemini model via LiteLLM provider routing in CrewAI
  • Node.js + Telegraf for Telegram interface

Repository Structure

Quick Start

1. Clone and enter project

git clone <your-repo-url>
cd CrewAI_Weather_AI_Agent

2. Create and activate environment

python3 -m venv .venv
source .venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Configure environment variables

Create a .env file in project root with:

OPENWEATHER_API_KEY=your_openweather_key
GEMINI_API_KEY=your_gemini_key
PII_API_URL=http://your-pii-service:8000
OLLAMA_BASE_URL=http://localhost:11434

5. Run API server

python api_server.py

Server starts at:

API Usage

Weather request

curl -X POST http://127.0.0.1:1212/agent/route \
  -H "Content-Type: application/json" \
  -d '{"query":"weather in Berlin today"}'

PII redaction request

curl -X POST http://127.0.0.1:1212/agent/route \
  -H "Content-Type: application/json" \
  -d '{"query":"Redact this: User email is jane.doe@mail.com from IP 10.0.0.1"}'

Telegram Bot (Optional)

cd telegram_bot
npm install
node telegram_bot.js

Ensure the API server is already running locally on port 1212.

Engineering Highlights

  • Agentic architecture with tool abstraction and typed input schemas
  • External service integration with clean separation of concerns
  • API-first backend design that supports multiple client channels
  • Practical handling for operational concerns: timeout paths, logging hooks, and runtime configuration
  • Easy extensibility for adding more tools and workflows

Next Improvements

  • Add test suite for tool selection and failure cases
  • Add containerization with Docker and deployment manifests
  • Add structured observability (request tracing + metrics)
  • Add CI pipeline with linting and tests

Documentation

For an in-depth technical walkthrough including high-level and low-level diagrams, see walkthrough.md.

License

This project is available for educational and portfolio purposes. Add your preferred license before open-source distribution.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages