Quickstart guide
This guide will help you set up Finance Agent and run your first query in minutes.Prerequisites
Before starting, ensure you have:- Python 3.9 or higher installed
- PostgreSQL 12+ with the pgvector extension
- Git for cloning the repository
- API keys for OpenAI and Cerebras (see Getting API keys)
If you don’t have PostgreSQL with pgvector, see the Installation guide for detailed setup instructions.
Quick setup
Install dependencies
- FastAPI and uvicorn for the web server
- PostgreSQL drivers (asyncpg, psycopg2-binary)
- AI/ML libraries (OpenAI, Cerebras, LangChain, sentence-transformers)
- Vector search and caching (pgvector, Redis)
Configure environment variables
Copy the example environment file and add your API keys:Edit
.env with your configuration:Your first query
Now that the server is running, let’s try asking a question!Option 1: Web interface
- Navigate to
http://localhost:8000 - Type a question in the chat interface:
- Watch the agent’s reasoning in real-time:
- Question analysis and data source routing
- Research planning statement
- Retrieved transcript chunks with citations
- Final answer with sources
Option 2: API endpoint
Use curl or any HTTP client:Option 3: Python client
Understanding the response
Finance Agent streams multiple event types:analysis - Question analysis complete
analysis - Question analysis complete
reasoning - Research planning
reasoning - Research planning
iteration_start - Beginning search iteration
iteration_start - Beginning search iteration
result - Final answer with citations
result - Final answer with citations
Example queries by type
Earnings transcript queries
These automatically route to earnings call transcripts:SEC 10-K queries
These route to the specialized 10-K retrieval agent:Executive compensation data is only available in 10-K filings, not earnings transcripts. The semantic router automatically detects this.
Real-time news queries
These use Tavily for current events:Multi-source hybrid queries
Configuration options
Choose your LLM provider
Finance Agent supports multiple LLM providers:Adjust answer quality vs. speed
The agent automatically selects answer modes, but you can understand the tradeoffs:- Direct mode: 2 iterations, 70% confidence - Quick factual lookups (~5 sec)
- Standard mode: 3 iterations, 80% confidence - Balanced analysis (~10 sec)
- Detailed mode: 4 iterations, 90% confidence - Comprehensive research (~15 sec)
Enable debug mode
Next steps
Now that you have Finance Agent running:Installation guide
Complete setup with data ingestion and production deployment
Agent system
Understand semantic routing and iterative improvement
SEC agent
Deep dive into 10-K retrieval architecture
API reference
Explore all endpoints and integration options
Getting API keys
OpenAI API key (required)
- Visit platform.openai.com
- Sign up or log in
- Navigate to API keys section
- Create a new secret key
- Copy to
.envasOPENAI_API_KEY
Cerebras API key (recommended)
- Visit cerebras.ai
- Request API access
- Copy key to
.envasCEREBRAS_API_KEY
Cerebras provides faster inference (Qwen-3-235B) and is the default provider. OpenAI is used as fallback.
API Ninjas key (required for transcripts)
- Visit api-ninjas.com
- Sign up for free tier
- Copy key to
.envasAPI_NINJAS_KEY
Tavily API key (optional for news)
- Visit tavily.com
- Sign up for free tier
- Copy key to
.envasTAVILY_API_KEY
Troubleshooting
Server won't start - missing dependencies
Server won't start - missing dependencies
Ensure Python 3.9+ and all dependencies are installed:
Database connection errors
Database connection errors
Verify PostgreSQL is running and connection string is correct:
No data returned for queries
No data returned for queries
You need to ingest data first. See the Installation guide for data ingestion steps, or use the live platform at stratalens.ai.
API key errors
API key errors
Check that all required keys are set in
.env: