Loading repository data…
Loading repository data…
Azure-Samples / repository
Sample App using Agent Framework for analysis of investment opportunities.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
An advanced AI-powered investment analysis platform that leverages multi-agent workflows to perform comprehensive analysis of investment opportunities. This sample application demonstrates how to build sophisticated agentic AI systems using the Microsoft Agent Framework, Azure services, and modern web technologies.
This application provides an intelligent system for analyzing investment opportunities through automated document processing, multi-agent analysis workflows, and interactive "what-if" scenario planning. The system orchestrates specialized AI agents that collaborate to provide comprehensive investment insights from multiple perspectives: financial, risk, market, and compliance.
api-app/)A FastAPI-based REST API that serves as the orchestration layer for the AI agents and data management.
Core Technologies:
Key Modules:
Workflow System ():
app/workflow/investment_workflow.py: Main investment analysis workflow orchestrating multiple specialized agentsinvestment_executors.py: Individual agent implementations (Financial, Risk, Market, Compliance analysts)prompts/: Agent-specific prompt templates for consistent analysisWhat-If Chat System (app/what_if_chat/):
what_if_workflow.py: Interactive chat workflow for scenario explorationwhat_if_executors.py: Specialized agents for handling hypothetical scenariosServices (app/services/):
analysis_workflow_executor_service.py: Manages workflow execution and event streamingdocument_processing_service.py: Handles multi-stage document processinganalysis_service.py: CRUD operations for investment analysesopportunity_service.py: Management of investment opportunitiesAPI Routers (app/routers/):
analysis.py: Endpoints for starting/monitoring analyses with SSE streamingchat.py: Interactive chat interface for what-if scenariosopportunity.py: Investment opportunity management endpointsData Models (app/models/):
web-app/)A modern React-based single-page application providing an intuitive user interface.
Core Technologies:
Key Features:
Main Pages:
Index.tsx: Landing page with feature showcaseNewOpportunity.tsx / EditOpportunity.tsx: Opportunity managementProcessDocuments.tsx: Document upload and processingAnalysis.tsx: Analysis execution and visualizationThe system uses a sophisticated multi-agent architecture:
Investment Analysis Workflow:
Data Preparation → [Financial Analyst, Risk Analyst, Market Analyst, Compliance Analyst]
→ Analysis Aggregator → Investment Debate Executor → Summary Report Generator
Each agent:
What-If Chat Workflow:
Planning Agent → [Financial, Risk, Market, Compliance Agents] → Analysis Summarizer
The application uses Server-Sent Events (SSE) for real-time updates:
app/utils/sse_stream_event_queue.py): In-memory queue for managing events per analysis/api/analysis/{id}/events endpointCreate a .env file in the api-app/ directory:
# API Server Settings
API_SERVER_HOST=0.0.0.0
API_SERVER_PORT=8084
API_SERVER_WORKERS=1
LOG_LEVEL=DEBUG
DEBUG=True
ENVIRONMENT=development
# Azure Cosmos DB
COSMOS_DB_ENDPOINT=https://<your-cosmos-account>.documents.azure.com:443/
COSMOS_DB_DATABASE_NAME=ai-investment-analysis-sample
# Azure Blob Storage
AZURE_STORAGE_ACCOUNT_NAME=your-storage-account
AZURE_STORAGE_CONTAINER_NAME=opportunity-documents
# Azure OpenAI
AZURE_OPENAI_ENDPOINT=https://<ai-foundry-resource>.cognitiveservices.azure.com/openai/deployments/<deployment_name>/chat/completions?api-version=2025-01-01-preview
AZURE_OPENAI_DEPLOYMENT_NAME=<model-deployment-name>
Create a .env file in the web-app/ directory:
VITE_API_BASE_URL=http://localhost:8084/api
# Navigate to the api-app directory
cd api-app
# Create and activate a virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Ensure your .env file is configured (see Configuration section)
# Run the FastAPI server
python main.py
# The API will be available at http://localhost:8084
# API documentation at http://localhost:8084/docs
Alternative: Run with uvicorn directly
uvicorn main:app --host 0.0.0.0 --port 8084 --reload
Open a new terminal window:
# Navigate to the web-app directory
cd web-app
# Install dependencies
npm install
# Ensure your .env file is configured (see Configuration section)
# Start the development server
npm run dev
# The web app will be available at http://localhost:8080
Cosmos DB:
Create a Cosmos DB account with NoSQL API
The application will automatically create the database and containers on first run
Ensure your connection endpoint is in the .env file
Ensure proper access permissions on Cosmos DB account:
Follow the steps in this article: Connect to Azure Cosmos DB for NoSQL using role-based access control and Microsoft Entra ID
Blob Storage:
opportunity-documents (or your chosen name)Azure AI Foundry:
For local development with Azure services, authenticate using Azure CLI:
az login
The application uses DefaultAzureCredential which supports:
/opportunity/newagentic-ai-investment-analysis-sample/
├── api-app/ # Backend FastAPI application
│ ├── main.py # Application entry point
│ ├── requirements.txt # Python dependencies
│ ├── run_investment_workflow.py # Workflow testing script
│ ├── run_what_if_chat.py # Chat testing script
│ └── app/
│ ├── core/ # Core configuration
│ ├── database/ # Database clients and repositories
│ ├── models/ # Pydantic data models
│ ├── routers/ # FastAPI route handlers
│ ├── services/ # Business logic layer
│ ├── utils/ # Utility functions
│ ├── workflow/ # Investment analysis workflow
│ │ ├── investment_workflow.py
│ │ ├── investment_executors.py
│ │ ├── investment_models.py
│ │ └── prompts/ # Agent promp