Note: I have a bunch of kinks I need to iron out with this project (I'll do them over the next few days), but the main structure is mostly done
Here is a quick video overview of the project: https://github.com/baibhavbista/autodidact-agent
Autodidact is an AI-powered personalized learning assistant that creates custom study plans, provides interactive tutoring sessions, and tracks your learning progress.
- π Deep Research: AI investigates your topic and creates comprehensive study plans
- π Knowledge Graphs: Visual representation of concepts and their prerequisites
- π¨βπ« AI Tutoring: Personalized 30-minute learning sessions with an AI tutor
- π Progress Tracking: Monitor your mastery of each concept over time
- π Session Recovery: Resume interrupted learning sessions
The easiest way to run Autodidact is using Docker:
- Clone the repository:
git clone https://github.com/yourusername/autodidact.git
cd autodidact- Build the Docker image locally (since it is not published on Docker Hub):
docker build -t autodidact-agent .- Run with Docker Compose:
docker compose upThe application will be available at http://localhost:8501
Note: Your data (database, configuration, projects) will be persisted in a Docker volume called autodidact_data, so it will be preserved across container restarts.
- Clone the repository:
git clone https://github.com/yourusername/autodidact.git
cd autodidact- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the application:
streamlit run app.pyAlternative: Use the wrapper script for additional features like debug mode:
python run.pyOn first run, you'll need to choose an AI provider and provide your API key. The app supports:
- OpenRouter: Access to multiple models (Claude, Gemini, Perplexity) with deep research via Perplexity Sonar
- OpenAI: Full features including deep research with web search
The app will guide you through the setup process and store your configuration securely at ~/.autodidact/.env.json.
The application uses SQLite with the following schema:
- project: Learning projects with topics and metadata
- node: Knowledge graph nodes (concepts to learn)
- edge: Relationships between concepts
- learning_objective: Specific objectives for each concept
- session: Learning sessions linking projects and nodes
- transcript: Conversation history for each session
If you're upgrading from an earlier version, run the migration script:
python backend/migrate_db.pyThis will update your database schema to include the new session tracking features.
Autodidact supports multiple AI providers to give you flexibility in model choice and cost. You can configure multiple providers and switch between them seamlessly.
| Feature | OpenRouter | OpenAI |
|---|---|---|
| Deep Research | β Perplexity Sonar Deep Research | β o4-mini-deep-research |
| Web Search | β Built-in via Perplexity | β Built-in |
| Chat Models | Claude 3.5 Sonnet/Haiku, Gemini | GPT-4o-mini |
| Cost Range | $0.001-0.05 per request | $0.50-2.00 (research), $0.02-0.05 (chat) |
| Best For | Model diversity, cost optimization, access to latest models | OpenAI-specific features and workflows |
- Features: Access to Claude, Gemini, Perplexity and other top models with deep research capabilities
- Models:
perplexity/sonar-deep-researchfor comprehensive research with web searchanthropic/claude-3.5-haikufor fast, cost-effective conversations- Many other models available (Gemini, GPT variants, etc.)
- Setup: Get API key from OpenRouter
- API Key Format: Starts with
sk-or- - Best for: Users who want model diversity, potentially lower costs, or prefer Claude/Gemini/Perplexity
- Features: Full deep research with web search capabilities
- Models:
o4-mini-deep-research-2025-06-26for comprehensive researchgpt-4o-minifor interactive tutoring sessions
- Setup: Get API key from OpenAI Platform
- API Key Format: Starts with
sk- - Best for: Users who need OpenAI-specific features and models
When you first run Autodidact, you'll see a provider selection dialog:
- Choose OpenRouter for model diversity, cost optimization, and access to the latest models
- Choose OpenAI for OpenAI-specific features and workflows
- Enter your API key when prompted
- The app validates your key and saves the configuration
You can configure multiple providers and switch between them:
# Your config will be stored at ~/.autodidact/.env.json
{
"provider": "openrouter",
"openrouter_api_key": "sk-or-your-openrouter-key",
"openai_api_key": "sk-your-openai-key"
}You can change providers anytime through the Settings page:
- Go to Settings in the sidebar
- Select your preferred provider
- Configure API keys for any new providers
- Changes take effect immediately
The provider system is designed to work seamlessly in code:
from utils.providers import create_client, get_model_for_task
# Works with your currently configured provider
client = create_client()
model = get_model_for_task("chat")
# Make API calls (same interface regardless of provider)
response = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": "Explain quantum physics"}]
)from utils.providers import create_client, get_model_for_task, get_provider_info
from utils.config import get_current_provider, set_current_provider
# Check current provider capabilities
current = get_current_provider()
info = get_provider_info(current)
if info.get("supports_deep_research"):
# Use deep research model
model = get_model_for_task("deep_research")
print(f"Using {model} for comprehensive research")
else:
# Fall back to chat model for research-style queries
model = get_model_for_task("chat")
print(f"Using {model} for research (no deep research available)")
# Switch providers programmatically
set_current_provider("openrouter") # Switch to OpenRouter
set_current_provider("openai") # Switch to OpenAIfrom utils.providers import create_client
from utils.config import set_current_provider
# Use OpenRouter for research phase (Perplexity Sonar Deep Research)
set_current_provider("openrouter")
research_client = create_client()
research_response = research_client.chat.completions.create(
model="perplexity/sonar-deep-research",
messages=[{"role": "user", "content": "Research latest developments in AI"}]
)
# Switch to OpenAI for alternative approach
set_current_provider("openai")
openai_client = create_client()
openai_response = openai_client.chat.completions.create(
model="o4-mini-deep-research-2025-06-26",
messages=[{"role": "user", "content": "Research latest developments in AI"}]
)- Start with OpenRouter if you want access to multiple top models and cost-effective deep research
- Start with OpenAI if you prefer OpenAI-specific models and workflows
- Research Phase: Use OpenRouter for comprehensive research with Perplexity Sonar
- Learning Phase: Continue with OpenRouter for interactive tutoring sessions with Claude
- Monitor usage in your provider dashboards to track costs
- Configure both providers to access different model families
- OpenRouter: Access to Claude, Gemini, Perplexity Sonar, and many other models
- OpenAI: Access to latest GPT models and o4 deep research
- API Key Invalid: Ensure key format matches provider (sk- vs sk-or-)
- Provider Switch Failed: Check that API keys are configured for target provider
- Model Not Available: Some models may not be available in your region
- Check your API key format matches the provider requirements
- Verify your account has credits/billing set up with the provider
- See the OpenRouter Guide for detailed OpenRouter setup
You can configure multiple providers and switch between them anytime in Settings.
-
For model diversity and cost optimization: Choose OpenRouter
# Get API key from https://openrouter.ai/keys # Format: sk-or-...
-
For OpenAI-specific features: Choose OpenAI
# Get API key from https://platform.openai.com/api-keys # Format: sk-...
-
Run the application:
streamlit run app.py
-
Follow the setup wizard to configure your chosen provider
- Go to Settings in the sidebar
- Click "Configure Additional Provider"
- Enter API key for new provider
- Switch between providers anytime
- Start a New Project: Enter a topic you want to learn
- Review the Plan: Examine the generated knowledge graph and report
- Begin Learning: Start tutoring sessions for available topics
- Track Progress: Monitor your mastery levels across concepts
Autodidact supports debug mode for troubleshooting and development. There are two ways to enable it:
python run.py --debugAUTODIDACT_DEBUG=true streamlit run app.pyWhen debug mode is enabled, you'll see:
- π A red debug banner at the top of the app
- Enhanced logging to
~/.autodidact/debug-YYYYMMDD-HHMMSS.log - Detailed error information and system state
Note: The original streamlit run app.py --debug command won't work because Streamlit doesn't recognize the --debug flag. Use one of the methods above instead.
autodidact/
βββ app.py # Main Streamlit application
βββ backend/
β βββ db.py # Database operations
β βββ jobs.py # AI job processing
β βββ graph.py # LangGraph tutor implementation
β βββ deep_research.py # Deep research module
β βββ migrate_db.py # Database migration script
βββ components/
β βββ graph_viz.py # Graph visualization
βββ utils/
β βββ config.py # Configuration management
β βββ providers.py # AI provider abstraction layer
β βββ deep_research.py # Deep research utilities
βββ OPENROUTER_GUIDE.md # Detailed OpenRouter setup guide
βββ requirements.txt # Python dependencies
To contribute or modify Autodidact:
- Follow the installation steps above
- Make your changes
- Test thoroughly with various topics
- Submit a pull request
- Python 3.8+
- API key from a supported provider:
- OpenAI: For full deep research capabilities (Get API Key)
- OpenRouter: For access to multiple AI models (Get API Key)
- OpenRouter Setup Guide: Detailed setup instructions for OpenRouter
- Architecture Guide: Technical details about the provider system
MIT License - see LICENSE file for details