Skip to content

aakaashjois/Duddu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

70 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

title Duddu - Autonomous Investment Committee
emoji ๐Ÿค–
colorFrom red
colorTo green
sdk docker
app_port 7860
pinned false
suggested_hardware cpu-basic
suggested_storage small

๐Ÿค– Duddu

Autonomous Investment Committee

A multi-agent AI system for investment research and analysis

Python 3.13+ Gradio 6 LangGraph MCP HuggingFace


โœจ What is Duddu?

Duddu is a human-safe autonomous investment committee that transforms your investment questions into transparent, explainable trading strategies. It uses a multi-agent LangGraph workflow powered by MCP tools to research, analyze, and propose tradesโ€”with explicit human approval required before any execution.

๐Ÿ’ก Think of it as having a team of specialized analysts working for you: a researcher gathering market data, an analyst crunching numbers, and an interpreter translating it all into clear recommendations.

Check out Duddu on ๐Ÿค— HuggingFace Spaces now!


๐Ÿ† HuggingFace Gradio Winter 2025 Hackathon

This work is a submission for the ๐Ÿค— HuggingFace Agents Winter Hackathon 2025, Track 2: MCP in Action

Track tag: mcp-in-action-track-consumer

Built by @aakaashjois, @pmagadi17, @sravan953, @vineetrao25
Application Demo Video: https://www.youtube.com/watch?v=_2Vfm6LL84A (AI voiceover for video generated using ElevenLabs)
Social Media Post: https://x.com/sravan953/status/1995174119261032799?s=20


๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         GRADIO 6 INTERFACE                                  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  ๐Ÿ’ฌ Chat Interface  โ”‚  โ”‚  ๐Ÿ“Š Portfolio   โ”‚  โ”‚  ๐Ÿ“ˆ Backtest Results   โ”‚  โ”‚
โ”‚  โ”‚  + Voice Input ๐ŸŽ™๏ธ   โ”‚  โ”‚  + P/L Panel    โ”‚  โ”‚  + Equity Curves       โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      LANGGRAPH ORCHESTRATION                                โ”‚
โ”‚                                                                             โ”‚
โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚    โ”‚     O     โ”‚โ”€โ”€โ”€โ–ถโ”‚     R     โ”‚โ”€โ”€โ”€โ–ถโ”‚     A     โ”‚โ”€โ”€โ”€โ–ถโ”‚       I       โ”‚    โ”‚
โ”‚    โ”‚Orchestratorโ”‚โ—€โ”€โ”€โ”‚ Research  โ”‚โ—€โ”€โ”€โ”‚ Analyzer  โ”‚โ—€โ”€โ”€โ”‚  Interpreter  โ”‚    โ”‚
โ”‚    โ”‚  (Plan)   โ”‚    โ”‚ (Collect) โ”‚    โ”‚ (Signal)  โ”‚    โ”‚ (Synthesize)  โ”‚    โ”‚
โ”‚    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚          โ”‚               โ”‚                โ”‚                  โ”‚             โ”‚
โ”‚          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜             โ”‚
โ”‚                          โ–ผ                โ–ผ                                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                           MCP TOOL LAYER                                    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  AlphaVantage   โ”‚  โ”‚  Google Search  โ”‚  โ”‚        Alpaca               โ”‚ โ”‚
โ”‚  โ”‚  ๐Ÿ“ˆ Market Data โ”‚  โ”‚  ๐Ÿ” News/Web    โ”‚  โ”‚  ๐Ÿ’ผ Trading & Portfolio     โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”จ Tools used

  1. Alpaca MCP (MCP link) for paper trading
  2. ALphaVantage MCP for stock market data
  3. Blaxel for MCP
  4. ElevenLabs for speech-to-text
  5. Tavily MCP for web search, hosted on Blaxel

The Committee

Agent Role Responsibilities
๐ŸŽฏ Orchestrator Master Planner Routes between agents, manages context, ensures coverage
๐Ÿ”ฌ Research Data Collector Gathers market data, news, and fundamentals via MCP
๐Ÿ“Š Analyzer Signal Generator Produces BUY/HOLD/SELL/WATCH signals with confidence scores
๐Ÿ’ก Interpreter Strategy Synthesizer Translates analysis into plain-language recommendations

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.13+
  • uv package manager

Installation

# Clone and setup
git clone <repo-url>
cd hf-gradio-winter-2025-hackathon
uv sync

Configuration

Create a .env file with your API keys:

# Required
GEMINI_API_KEY=your_gemini_key
ALPHAVANTAGE_API_KEY=your_alphavantage_key
GOOGLE_SEARCH_API_KEY=your_google_search_key
GOOGLE_SEARCH_ENGINE_ID=your_engine_id

# Alpaca Trading (paper mode)
ALPACA_API_KEY=your_alpaca_key
ALPACA_SECRET_KEY=your_alpaca_secret
ALPACA_BASE_URL=https://paper-api.alpaca.markets
ALPACA_MODE=paper
ALPACA_USE_REST_API=true  # Recommended for stability

# Optional: Voice Input
ELEVENLABS_API_KEY=your_elevenlabs_key

Launch

uv run python app.py

Open http://localhost:7860 and start chatting!


๐ŸŽฎ Usage

Example Prompts

Type Example
Research "Research NVDA for me"
Compare "Compare TSLA and F for a 3-year horizon"
Sector Analysis "Analyze AI chip stocks"
With Budget "I have $5,000 to invest in tech stocks"
Backtest "Backtest AAPL for 180 days with $5,000 capital"

Workflow

  1. Set Your Profile โ€” Choose risk tolerance and investment horizon
  2. Ask Questions โ€” Type or use ๐ŸŽ™๏ธ voice input
  3. Watch the Committee โ€” See agents research, analyze, and synthesize
  4. Review Recommendations โ€” Get transparent, explainable strategies
  5. Approve Trades โ€” Execute via Alpaca (paper trading by default)
  6. Backtest โ€” Validate strategies with historical data

๐Ÿ“ˆ Backtesting

Duddu includes a powerful backtesting engine:

Feature Description
Auto Backtests BUY trades trigger automatic 12-month buy-and-hold simulations
Budget-Aware Mention a budget and shares are scaled to fit
Direct Commands Backtest TSLA for 180 days with $5,000 capital and 2 shares
Rich Metrics Return, P/L, CAGR, max drawdown, Sharpe, volatility, hit rate
Visual Output Equity curves, drawdown charts, trade logs

๐Ÿ›ก๏ธ Safety Features

Feature Description
Human-in-the-Loop All trades require explicit user approval
Paper Trading Uses Alpaca paper trading by default
Input Guards Screens for toxic content, prompt injection, off-topic queries
Output Guards Prevents leaking API keys or credentials
Crypto/Options Block Automatically rejects crypto and derivatives requests

๐Ÿ”Œ Data Sources

Source Purpose Configuration
AlphaVantage MCP Market data & fundamentals ALPHAVANTAGE_API_KEY
Google Search MCP News & web search GOOGLE_SEARCH_* keys
Alpaca REST/MCP Trading & portfolio ALPACA_* keys
Tavily MCP (Optional) Alternative search TAVILY_MCP_ENDPOINT

๐Ÿ’ก Tip: Set ALPACA_USE_REST_API=true for best stability. Set SEARCH_PROVIDER=google if you experience Tavily timeouts.


๐Ÿ“ Project Structure

.
โ”œโ”€โ”€ app.py                 # Main entry point
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ agents/            # O, R, A, I agent implementations
โ”‚   โ”œโ”€โ”€ graph/             # LangGraph state and workflow
โ”‚   โ”œโ”€โ”€ schemas/           # Pydantic models and contracts
โ”‚   โ”œโ”€โ”€ tools/             # MCP clients and utilities
โ”‚   โ”œโ”€โ”€ guardrails/        # Input/output safety validators
โ”‚   โ””โ”€โ”€ ui/                # Gradio interface
โ”œโ”€โ”€ scripts/               # Testing and utility scripts
โ””โ”€โ”€ docs/                  # Documentation

๐Ÿงช Testing

# Test all MCP integrations
uv run python scripts/test_mcp.py --test-all

# Test individual components
uv run python scripts/test_mcp.py --alphavantage-only
uv run python scripts/test_mcp.py --google-only
uv run python scripts/test_mcp.py --alpaca-only

โš™๏ธ Configuration

Key settings in src/config/settings.py:

Setting Default Description
max_graph_iterations 20 Maximum LangGraph iterations
request_timeout_seconds 30 MCP request timeout
guardrails_enabled True Enable input safety checks
guardrails_output_enabled True Enable output safety checks
elevenlabs_stt_model scribe_v1 Speech-to-text model

๐Ÿ› Troubleshooting

MCP Servers Not Found
uv pip list | grep -E "(alphavantage|mcp-google|alpaca-mcp)"

Ensure MCP servers are installed and remove old MCP command settings from .env.

API Quota Exceeded

Check your API usage limits, wait for quota reset, or upgrade API plans.

Alpaca Connection Issues

Set ALPACA_USE_REST_API=true to use direct REST API calls instead of MCP.

Graph Not Completing
  • Check logs for agent errors
  • Increase max_graph_iterations in settings
  • Verify all API keys are set correctly

๐Ÿ“š Documentation


โš ๏ธ Disclaimer

This is a demo application for educational purposes only.

  • Duddu is not a registered investment advisor
  • This is not financial advice
  • Default mode uses paper trading (no real money)
  • Always do your own research before making investment decisions

๐Ÿ™ Acknowledgments

Built for the HuggingFace Gradio Winter 2025 Hackathon โ€” Track 2: MCP in Action

Made with โค๏ธ using LangGraph, MCP, and Gradio 6

About

hf-gradio-winter-2025-hackathon

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages