Answers, comparisons, and interactive study sessions powered by Gemini and LangGraph.
- Features
- 30-second Quick Start (Windows)
- Full Setup (Windows)
- Usage
- Output Examples
- CLI Options
- Environment Variables
- Demo Media (Screenshots and Video)
- Project Structure
- Data and Checkpoints
- Running Tests
- Troubleshooting
- Security Notes
- LangGraph Workflow
- Contributing
- License
- Acknowledgements
| Command | What it does |
|---|---|
| ana "QUESTION" | Plan -> generate -> reflect loop that answers any question |
| ana compare "A" "B" | Structured comparison table + narrative + when-to-use guidance |
| ana study "TOPIC" --quiz N | Lesson + key takeaways + N-question interactive quiz with grading |
All modes share:
- configurable revision loops via --revisions
- optional Tavily web research via --research
- SQLite checkpointing
- output formats: text, markdown, JSON
PowerShell:
cd ana_agent
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .
$env:GOOGLE_API_KEY = "AIza...your-key..."
ana "What is the difference between TCP and UDP?"- Python 3.10-3.12 (recommended and tested)
- A Google AI Studio API key (free tier available): https://aistudio.google.com/app/apikey
- Optional OpenRouter API key if using --provider openrouter: https://openrouter.ai/developers
# Clone / enter repo
cd ana_agent
# Create and activate virtual environment
python -m venv .venv
.\.venv\Scripts\Activate.ps1
# Install package in editable mode
pip install -e .CMD:
set GOOGLE_API_KEY=AIza...your-key...
set TAVILY_API_KEY=tvly-...
set OPENROUTER_API_KEY=or-...PowerShell:
$env:GOOGLE_API_KEY = "AIza...your-key..."
$env:TAVILY_API_KEY = "tvly-..."
$env:OPENROUTER_API_KEY = "or-..."Persistent .env file in project root:
GOOGLE_API_KEY=AIza...your-key...
# Optional
TAVILY_API_KEY=tvly-...
OPENROUTER_API_KEY=or-...
OPENROUTER_SITE_URL=https://github.com/OWNER/REPO
OPENROUTER_APP_NAME=anaana "What is the difference between TCP and UDP?"
ana "Explain gradient descent" --revisions 2 --show-plan --show-critiqueana compare "React" "Vue"
ana compare "PostgreSQL" "MongoDB" --revisions 2 --format md --saveana study "async/await in Python" --quiz 5
ana study "Docker containers" --quiz 3 --revisions 2CMD:
set TAVILY_API_KEY=tvly-...
ana "Latest LLM benchmarks 2025" --research --show-sourcesPowerShell:
$env:TAVILY_API_KEY = "tvly-..."
ana compare "Claude" "GPT-4" --research --format md --savePowerShell:
$env:OPENROUTER_API_KEY = "or-..."
ana "Summarize latest Llama news" --provider openrouter --model openrouter/autoOptional OpenRouter headers:
- OPENROUTER_SITE_URL -> HTTP-Referer
- OPENROUTER_APP_NAME -> X-Title
ana "Explain event loops"Example:
Event loops are the mechanism that lets a program handle many tasks without
starting one OS thread per task...
ana compare "Redis" "Memcached" --format md --saveana "What is overfitting?" --format jsonExample shape:
{
"mode": "answer",
"question": "What is overfitting?",
"output": "...",
"sources": [
{
"title": "...",
"url": "...",
"snippet": "..."
}
]
}All commands:
| Option | Default | Description |
|---|---|---|
--revisions N |
1 |
Number of generate->reflect loops |
--thread-id ID |
auto | Checkpoint group ID |
--research |
off | Enable Tavily web search |
--show-plan |
off | Print planner steps |
--show-critique |
off | Print reflector critique |
--show-sources |
off | Print source table after output |
--format text|md|json |
text |
Output format |
--provider gemini|ollama|openai|openrouter |
gemini |
LLM provider |
--model NAME |
provider default | Override model name |
--save |
off | Save output to ~/.ana/outputs/<thread>.md |
Study-only option:
| Option | Default | Description |
|---|---|---|
--quiz N |
3 |
Number of quiz questions (0 means skip quiz) |
| Variable | Required | Purpose |
|---|---|---|
| GOOGLE_API_KEY | Yes for default provider | Gemini API key |
| TAVILY_API_KEY | Only with --research | Tavily search API key |
| OPENAI_API_KEY | Only with --provider openai | OpenAI API key |
| OPENROUTER_API_KEY | Only with --provider openrouter | OpenRouter API key |
| OPENROUTER_SITE_URL | Optional | Sets HTTP-Referer header |
| OPENROUTER_APP_NAME | Optional | Sets X-Title header |
ana_agent/
|- pyproject.toml
|- README.md
|- src/
| \- ana/
| |- __init__.py
| |- cli.py
| |- graph.py
| |- state.py
| |- nodes.py
| |- prompts.py
| |- render.py
| |- study.py
| \- llm.py
\- tests/
\- test_render.py
| Path | Contents |
|---|---|
| %USERPROFILE%/.ana/ana.sqlite | LangGraph checkpoint database |
| %USERPROFILE%/.ana/outputs/.md | Saved outputs |
pip install -e ".[dev]"
pytestSymptoms:
- dependency installation failures
- runtime import/type errors with newer Python versions
Fix:
- use Python 3.10-3.12 for this project
- recreate the virtual environment if needed
Symptoms:
- provider authentication errors
- research mode exits with key warning
Fix:
- set required key in your current shell or .env
- verify variable names exactly match docs
Symptoms:
- model not found or provider-specific errors
Fix:
- use a model valid for your selected provider
- for OpenRouter, openrouter/auto is a safe default
Symptoms:
- pip cannot download packages
Fix:
- retry after network stabilizes
- verify proxy/firewall settings if in a corporate environment
START
|
v
planner ---------------------------------------------+
| | (--research)
|-( no research )--> generator |
| | v
+-( --research )--> research_plan --> generator (same)
|
v
reflector
|
revision_count < max_revisions?
|- YES -------------------------------+
| |-( no research )--> generator ----+
| +-( --research )--> research_critique --> generator
+- NO --> END
Contributions are welcome.
- Fork the repo.
- Create a feature branch.
- Run tests locally.
- Open a pull request with a clear description.
No license file is included yet. Add a LICENSE file before publishing if you want explicit reuse terms.
This project is inspired by planning, reflection, and revision-loop patterns taught in the AI Agents in LangGraph course by DeepLearning.AI.









