โ† Back to Portofolios

Investment Agent

AI-Powered Stock Analysis with Semantic Kernel & Prompty AI POC

๐Ÿ“ˆ Project Overview

A comprehensive .NET 10 Aspire application demonstrating how to build intelligent investment analysis systems using Microsoft's Semantic Kernel and Prompty. This project showcases:

  • Stock Data Integration - Real-time stock market data via REST APIs
  • AI Analysis - LLM-powered investment insights and recommendations
  • Prompty Integration - Modern prompt management and orchestration
  • MCP Server - Model Context Protocol for AI tool integration
  • Complete Architecture - AppHost, API, Web, and Worker services
  • Storage Emulation - Local Azure Storage emulation for development

๐ŸŽฏ Key Features

  • ๐Ÿ“Š
    Real-time Stock Data - Fetch and analyze current stock market data
  • ๐Ÿค–
    AI-Powered Analysis - Semantic Kernel for intelligent investment recommendations
  • ๐Ÿ“
    Prompty Files - Declarative prompt management with YAML configuration
  • โš™๏ธ
    Background Processing - Worker Service for async analysis tasks
  • ๐ŸŒ
    Web Dashboard - Interactive Blazor UI for viewing analysis results
  • ๐Ÿ”Œ
    MCP Integration - AI tool support for Claude and other LLMs
  • ๐Ÿ’พ
    Local Storage Emulation - Azure Storage emulator for development
  • ๐Ÿงช
    Comprehensive Testing - Unit and integration tests included

๐Ÿ—๏ธ Architecture

Project Structure

Built as a complete .NET Aspire solution with multiple services:

AIPlayground.AppHost
Aspire orchestration and service coordination
AIPlayground.ApiService
REST API with stock data and analysis endpoints
AIPlayground.Web
Interactive Blazor Web App dashboard
AIPlayGround.WorkerService
Background processing with queue integration
AIPlayground.Stock.MCP.Server
Model Context Protocol server for LLM integration
AIPlayground.StockApi
Stock market data integration layer

Data Flow

  • Data Ingestion โ†’ Fetch stock data from external APIs
  • Processing โ†’ Analyze with Semantic Kernel and Prompty
  • Storage โ†’ Persist results to Azure Storage
  • Presentation โ†’ Display via Blazor dashboard and REST API
  • AI Integration โ†’ Expose capabilities via MCP for LLM tools

API Endpoints

  • GET /api/stocks - List available stocks
  • GET /api/stocks/{symbol} - Get stock details and analysis
  • POST /api/analysis - Request AI analysis of stocks
  • GET /api/analysis/{id} - Retrieve analysis results
  • WebSocket endpoints - Real-time updates for stock data

๐Ÿ’ก Technology Stack

.NET Stack

.NET 10 ASP.NET Core Blazor Web App Minimal APIs

AI & LLM

Semantic Kernel Prompty Azure OpenAI MCP Protocol

Cloud & Data

.NET Aspire Azure Storage Queue Services Service Bus

Testing & Tools

.NET Testing xUnit Integration Tests Storage Emulator

๐Ÿš€ Implementation Highlights

Prompty Integration

  • Declarative prompt files with .prompty extension
  • YAML-based configuration for models and parameters
  • Seamless integration with Semantic Kernel
  • Environment variable support for API keys and endpoints
  • Sample prompts included for stock analysis workflows

Semantic Kernel Usage

  • Multiple model support (Azure OpenAI, local models)
  • Function composition for complex analysis pipelines
  • Plugin architecture for extending capabilities
  • Context management for conversation continuity
  • Built-in error handling and retries

Aspire Orchestration

  • Service discovery for inter-service communication
  • Local storage emulation setup
  • Health checks and diagnostics
  • Environment configuration management
  • Ready for cloud deployment

Background Processing

  • Worker Service for async analysis tasks
  • Queue-based task processing
  • Distributed processing patterns
  • Long-running operation support

MCP Server Implementation

  • Complete MCP protocol support
  • Tool definitions for AI use
  • Integration with Claude and ChatGPT
  • Natural language command support
  • Real-time data access from LLM context

๐Ÿ“š Real-World Use Cases

Portofolio Analysis

AI-powered analysis of investment portofolios with personalized recommendations

Market Sentiment

Analyze market trends and sentiment using real-time stock data

Risk Assessment

LLM-based risk evaluation of investments and trading strategies

AI Assistant

Natural language interface to investment data via Claude or ChatGPT

๐ŸŽ“ What This Project Demonstrates

This Investment Agent is a professional portofolio piece showcasing:

  • โœ… Modern .NET Development - .NET 10, Aspire, latest frameworks
  • โœ… AI Integration - Semantic Kernel, Prompty, Azure OpenAI
  • โœ… Full-Stack Architecture - Backend, Frontend, Services
  • โœ… Real-World Integration - Stock APIs, market data
  • โœ… LLM Integration - MCP server for AI tool use
  • โœ… Cloud-Native Patterns - Aspire, storage, queues
  • โœ… Production Patterns - Testing, error handling, monitoring
  • โœ… Async Processing - Worker services, background jobs