Autonomous research agent with web search, source analysis, and report synthesis. Built on Pi agent core. Available as CLI, programmatic API, and MCP server. Features: - 4 built-in tools: web_search, read_url, save_note, synthesize_report - CLI with TUI and print modes - Programmatic API via ResearchAgent class - MCP server with 3 tools: research, quick_search, read_url - Skills system for custom research behavior - Automatic .env file loading for API keys - Configurable max turns, output formats (markdown/JSON/bullet) - Automatic report saving to research-output/
1.7 KiB
1.7 KiB
Environment Variables Setup
Quick Start
-
Copy the example file:
cp packages/research-agent/.env.example packages/research-agent/.env -
Edit with your API keys:
nano packages/research-agent/.env -
Add your keys:
TAVILY_API_KEY=*** OPENROUTER_API_KEY=*** LLM_MODEL=minimax/minimax-m3 -
Run the agent:
node packages/research-agent/dist/cli.js "your research topic"
How It Works
The research agent automatically loads environment variables from .env files in this order:
./.env(current working directory)./packages/research-agent/.env
Important:
- Environment variables (set via
export) take precedence over.envfile values - The
.envfile is in.gitignoreand will not be committed - You can also use Node.js 22+ built-in support:
node --env-file=.env ...
Alternative: Export Variables
You can also set variables directly in your shell:
export TAVILY_API_KEY=***
export OPENROUTER_API_KEY=***
export LLM_MODEL=openai/gpt-4o
node packages/research-agent/dist/cli.js "your topic"
Getting API Keys
Tavily API Key
- Go to https://tavily.com/
- Sign up for an account
- Get your API key from the dashboard
- Free tier: 1000 searches/month
OpenRouter API Key
- Go to https://openrouter.ai/
- Sign up for an account
- Add credits to your account
- Create an API key in settings
- Pay-per-use pricing for various models
Supported Models
Default: minimax/minimax-m3
Other popular options:
openai/gpt-4oanthropic/claude-3.5-sonnetgoogle/gemini-pro-1.5meta-llama/llama-3.1-70b-instruct
See all available models at https://openrouter.ai/models