A full-stack application for analyzing financial data and generating comprehensive budget reports using a multi-agent AI system.
ministry-finance-system/
├── backend/ # Existing Python multi-agent backend
│ ├── agents/ # Agent implementations
│ ├── skills/ # Tools and utilities
│ ├── main.py # Main entry point
│ └── ...
├── frontend/ # React frontend
│ ├── public/
│ ├── src/
│ │ ├── components/
│ │ ├── App.js
│ │ └── ...
│ └── package.json
└── api/ # FastAPI wrapper
├── server.py # API endpoints
└── requirements.txt
The backend should already be set up as per your existing codebase. Make sure your environment variables are configured properly in a .env file:
OPENAI_API_KEY=your_openai_api_key
MODEL=gpt-4o-2024-08-06 # or your preferred model
-
Navigate to the
apidirectory:cd api -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install the required dependencies:
pip install -r requirements.txt -
Start the FastAPI server:
python server.pyThe API will be available at http://localhost:8000
-
Navigate to the
frontenddirectory:cd frontend -
Install the required dependencies:
npm install -
Start the development server:
npm startThe frontend will be available at http://localhost:3000
- Open your browser and navigate to http://localhost:3000
- Upload a JSON file with the required structure (including revenue, expenditure, inflation, and gdp_growth data)
- The system will process the data and generate a comprehensive budget analysis report
- Once processing is complete, you can download the generated PDF report
The uploaded JSON file should have the following structure:
{
"revenue": [
{ "name": "Tax Revenue", "amount": 5000000 },
{ "name": "Non-tax Revenue", "amount": 2000000 },
...
],
"expenditure": [
{ "name": "Education", "amount": 3000000 },
{ "name": "Healthcare", "amount": 2500000 },
...
],
"inflation": [
{ "year": "2020", "rate": 3.4 },
{ "year": "2021", "rate": 3.5 },
...
],
"gdp_growth": [
{ "year": "2020", "rate": 1.5 },
{ "year": "2021", "rate": 2.5 },
...
]
}- The user uploads a JSON file through the frontend
- The API validates the file structure and starts the multi-agent processing pipeline
- The Data Manager Agent validates the data and creates visual plots
- The Budget Agent generates projections and performs risk analysis
- The Tax Policy Agent recommends tax slabs based on the projections
- The Report Agent compiles all information into a comprehensive PDF report
- The user can download the generated report through the frontend