malimasood47's picture
Update README.md
61974ad verified

A newer version of the Streamlit SDK is available: 1.54.0

Upgrade
metadata
title: Agent Workshop
emoji: 🧠
colorFrom: blue
colorTo: purple
sdk: streamlit
sdk_version: 1.51.0
app_file: app.py
pinned: false
license: mit
tags:
  - langchain
  - gemini
  - ai-agent
  - crypto
  - huggingface-space

🪙 Crypto AI Agent (Gemini + LangChain)

This project is a simple AI-powered crypto assistant built using Google’s Gemini model and LangChain. It can intelligently respond to prompts and fetch real-time cryptocurrency prices (like Bitcoin and Ethereum) using a live API.

🚀 Features

Conversational AI — Powered by ChatGoogleGenerativeAI (Gemini). ✅ Live Crypto Data — Fetches real-time prices from the CoinCap API. ✅ LangChain Integration — Uses LangChain’s latest tool architecture (Tool). ✅ Simple Deployment — Can run directly on Hugging Face Spaces or locally. ✅ Extendable — Easily add more tools, prompts, or custom logic.

🧠 How It Works

  1. The user gives a text input (e.g., “Check the Bitcoin price”).

  2. The agent detects whether it should:

    • Use a tool (like the CryptoPriceChecker), or
    • Use the Gemini model to generate a conversational answer.
  3. The result is printed or returned as a response.

📂 Project Structure

crypto-ai-agent/
│
├── app.py                # Main application code
├── requirements.txt      # All Python dependencies
└── README.md             # Project documentation

🧩 Installation

You can run this project locally or deploy it on Hugging Face.

Option 1: Run Locally

# Clone the repository
git clone https://github.com/yourusername/crypto-ai-agent.git
cd crypto-ai-agent

# Install dependencies
pip install -r requirements.txt

Option 2: Run in Google Colab

Simply upload app.py to your Colab environment and run:

!pip install -r requirements.txt
!python app.py

Option 3: Deploy on Hugging Face Spaces

  1. Create a new Space.

  2. Choose “Static / Python (Gradio)” as your Space type.

  3. Upload:

    • app.py
    • requirements.txt
    • README.md
  4. Add your Google API key in the Hugging Face Secrets tab as:

    GOOGLE_API_KEY=your_api_key_here
    

🔧 Configuration

You’ll need a valid Google Generative AI API key (Gemini). You can get one from Google AI Studio.

Once you have it, set it as an environment variable:

export GOOGLE_API_KEY="your_api_key_here"

Or, on Hugging Face, use the “Repository Secrets” feature.

🧾 Example Usage

In Python:

from app import run_agent

print(run_agent("Check Bitcoin price"))
print(run_agent("What is blockchain?"))

Output:

💰 BTC current price: $68,245.12
Blockchain is a distributed ledger technology that allows secure and transparent record-keeping.

📦 Requirements

See requirements.txt:

langchain>=0.3.0
langchain-google-genai>=0.1.0
langchain-core>=0.3.0
requests>=2.31.0
python-dotenv>=1.0.0

🧩 Future Enhancements

  • Add multiple crypto symbols (e.g., ADA, XRP, DOGE)
  • Integrate trading signals or portfolio management
  • Add Gradio interface for user input
  • Deploy on Hugging Face Space with persistent logs

👨‍💻 Author

Ali Masood PhD in Artificial Intelligence | Founder, Zaytrics Pvt Ltd 🚀 Building world-class AI & blockchain solutions.