Prerequisites
Before setting up Finance Agent locally, ensure you have the following installed:- Python 3.9+ - Required for the backend and agent system
- PostgreSQL 12+ - Database with pgvector extension for embeddings
- Node.js 16+ - For the React + TypeScript frontend
- Git - For cloning the repository
Finance Agent uses PostgreSQL with the pgvector extension for hybrid vector + keyword search. Make sure your PostgreSQL installation supports extensions.
Installation Steps
Install Python dependencies
- FastAPI + Uvicorn for the web server
- PostgreSQL drivers (asyncpg, psycopg2-binary)
- AI/ML libraries (OpenAI, Cerebras, LangChain, sentence-transformers)
- Authentication (PyJWT for Clerk integration)
- Redis for caching (optional)
Configure environment variables
Copy the example environment file and configure it:Edit
.env with your API keys and database credentials. See Environment Variables for details.Set up the database
Initialize PostgreSQL with the pgvector extension and create required tables.See Database Setup for detailed instructions.
(Optional) Ingest sample data
To test the RAG system, ingest sample financial data:
Data ingestion is optional for development. The application will work without data, but RAG queries will return no results.
Verify the installation
Open your browser and navigate to:
- Application: http://localhost:8000
- API Docs (Swagger): http://localhost:8000/docs
- API Docs (ReDoc): http://localhost:8000/redoc
By default, API documentation is disabled in production. Enable it by setting
ENABLE_DOCS=true in .env.Frontend Setup (Optional)
If you’re developing the React frontend:Configure frontend environment
The frontend reads environment variables from the root
.env file via envDir: '../' in vite.config.ts.Required variables:Leave
VITE_API_BASE_URL empty for same-origin requests. Only set it if the backend is on a separate domain.Start the development server
Verification
Test the API
Test the health endpoint:Test the RAG Agent
Test the chat endpoint with a streaming query:This requires data to be ingested first. If no data is available, you’ll receive a response indicating no results found.
Common Issues
Database Connection Failed
If you see database connection errors:- Verify PostgreSQL is running:
pg_isready - Check your
DATABASE_URLin.env - Ensure the database exists:
createdb stratalens - Verify pgvector extension is installed (see Database Setup)
Import Errors
If you see Python import errors:- Ensure your virtual environment is activated
- Reinstall dependencies:
pip install -r requirements.txt - Check Python version:
python --version(must be 3.9+)
API Key Errors
If you see API key errors:- Verify all required API keys are set in
.env - Check for typos in environment variable names
- Ensure
.envis in the project root directory
Next Steps
- Configure Environment Variables
- Set Up the Database
- Learn About the Agent System
- Explore the API Documentation