File size: 2,663 Bytes
0c591a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Configuration Guide

## Quick Start

```bash
cp .env.example .env
# Edit .env with your API keys
```

## Environment Variables

### LLM Providers (at least one required)

The system uses a fallback chain: Groq → Gemini → OpenRouter

| Variable | Description | Required |
|----------|-------------|----------|
| `GROQ_API_KEY` | Groq API key (primary, fastest) | Recommended |
| `GROQ_MODEL` | Model name (default: `llama-3.1-8b-instant`) | No |
| `GEMINI_API_KEY` | Google Gemini API key (fallback 1) | No |
| `GEMINI_MODEL` | Model name (default: `gemini-2.0-flash-exp`) | No |
| `OPENROUTER_API_KEY` | OpenRouter API key (fallback 2) | No |
| `OPENROUTER_MODEL` | Model name (default: `google/gemini-2.0-flash-exp:free`) | No |

### Search API

| Variable | Description | Required |
|----------|-------------|----------|
| `TAVILY_API_KEY` | Tavily search API for live company data | Yes |

### MCP Server APIs (optional)

| Variable | Description | Source |
|----------|-------------|--------|
| `FRED_API_KEY` | Federal Reserve data (VIX) | [fred.stlouisfed.org](https://fred.stlouisfed.org/docs/api/api_key.html) |
| `ALPHA_VANTAGE_API_KEY` | Options implied volatility | [alphavantage.co](https://www.alphavantage.co/support/#api-key) |
| `FINNHUB_API_KEY` | News sentiment data | [finnhub.io](https://finnhub.io/register) |

### A2A Protocol (optional)

| Variable | Default | Description |
|----------|---------|-------------|
| `USE_A2A_RESEARCHER` | `false` | Enable A2A mode for Researcher |
| `A2A_RESEARCHER_URL` | HuggingFace Spaces URL | Researcher A2A server endpoint |
| `A2A_TIMEOUT` | `60` | Request timeout in seconds |

### Observability (optional)

| Variable | Description |
|----------|-------------|
| `LANGCHAIN_API_KEY` | LangSmith API key |
| `LANGCHAIN_TRACING_V2` | Enable tracing (`true`/`false`) |
| `LANGCHAIN_PROJECT` | Project name in LangSmith |

## Deployment Environments

### Local Development

```bash
cp .env.example .env
# Add your API keys

# Run Streamlit UI
streamlit run streamlit_app.py

# Or run FastAPI backend (serves React frontend at localhost:8002)
python -m src.main api
```

### Docker

```bash
docker run --env-file .env -p 7860:7860 ai-strategy-copilot
```

### Hugging Face Spaces

Add secrets in Space Settings → Repository secrets:
- `GROQ_API_KEY`
- `TAVILY_API_KEY`
- (other optional keys)

## Troubleshooting

| Error | Solution |
|-------|----------|
| `No LLM provider configured` | Set at least one of: GROQ_API_KEY, GEMINI_API_KEY, OPENROUTER_API_KEY |
| `TAVILY_API_KEY missing` | Required for live company research |
| `MCP server timeout` | Check individual API keys for MCP servers |