- Environment variables (
.env) — API keys, model names, provider bindings, and ports. These are the authoritative source for secrets and model selection. - YAML files (
config/) — system behavior, tool settings, agent LLM parameters, and module-specific options. Never put secrets here.
Environment variables
Copy.env.example to .env and fill in the values before starting DeepTutor.
Server ports
| Variable | Required | Default | Description |
|---|---|---|---|
BACKEND_PORT | No | 8001 | Port for the FastAPI backend server. |
FRONTEND_PORT | No | 3782 | Port for the Next.js frontend server. |
LLM settings
The primary language model used across all AI operations — chat, research, solving, and writing.| Variable | Required | Example | Description |
|---|---|---|---|
LLM_BINDING | Yes | openai | Provider identifier. See supported values below. |
LLM_MODEL | Yes | gpt-4o | Model name as recognized by the provider API. |
LLM_API_KEY | Yes | sk-... | API key for your LLM provider. |
LLM_HOST | Yes | https://api.openai.com/v1 | API endpoint URL. |
LLM_API_VERSION | No | 2024-02-15-preview | API version string. Required for Azure OpenAI only. |
LLM_BINDING values:
openai, azure_openai, anthropic, deepseek, openrouter, groq, together, mistral, ollama, lm_studio, vllm, llama_cpp
Embedding settings
The embedding model powers the RAG vector store used by every retrieval operation.| Variable | Required | Example | Description |
|---|---|---|---|
EMBEDDING_BINDING | Yes | openai | Provider identifier. See supported values below. |
EMBEDDING_MODEL | Yes | text-embedding-3-small | Embedding model name. |
EMBEDDING_API_KEY | Yes | sk-... | API key for the embedding provider. |
EMBEDDING_HOST | Yes | https://api.openai.com/v1 | Embedding API endpoint URL. |
EMBEDDING_DIMENSION | Yes | 1536 | Vector output dimension. Must match your model exactly. |
EMBEDDING_API_VERSION | No | 2024-02-15-preview | API version. Required for Azure OpenAI only. |
EMBEDDING_BINDING values:
openai, azure_openai, jina, cohere, huggingface, google, ollama, lm_studio
TTS settings
Text-to-speech settings power the Co-writer’s narration feature. All TTS variables are optional.| Variable | Required | Default | Example | Description |
|---|---|---|---|---|
TTS_BINDING | No | — | openai | Provider: openai or azure_openai. |
TTS_MODEL | No | — | tts-1 | TTS model name. |
TTS_API_KEY | No | — | sk-... | TTS provider API key. Can be the same as LLM_API_KEY for OpenAI. |
TTS_URL | No | — | https://api.openai.com/v1 | TTS API endpoint URL. |
TTS_VOICE | No | alloy | nova | Default voice. Options: alloy, echo, fable, onyx, nova, shimmer. |
TTS_BINDING_API_VERSION | No | — | 2024-05-01-preview | API version for Azure OpenAI TTS. |
Search settings
Web search is optional. When configured, it enables real-time web results in the solver, deep research, and co-writer modules.| Variable | Required | Default | Example | Description |
|---|---|---|---|---|
SEARCH_PROVIDER | No | perplexity | tavily | Search provider. Options: perplexity, tavily, serper, jina, exa. |
SEARCH_API_KEY | No | — | pplx-... | API key for your chosen search provider. |
Cloud and remote access
| Variable | Required | Example | Description |
|---|---|---|---|
NEXT_PUBLIC_API_BASE_EXTERNAL | No | https://your-server.com:8001 | Public backend URL for cloud deployments. The frontend browser uses this to reach the API. |
NEXT_PUBLIC_API_BASE | No | http://192.168.1.100:8001 | Direct API base URL. Use this for LAN access from another device. |
When running locally with a single device, you do not need to set either of these. They are only required when the browser accessing the frontend is not on the same machine as the server.
Development and HuggingFace
| Variable | Required | Default | Description |
|---|---|---|---|
DISABLE_SSL_VERIFY | No | false | Disable SSL certificate verification. Not recommended for production. |
HF_ENDPOINT | No | — | HuggingFace mirror endpoint URL. Useful in regions where huggingface.co is restricted. |
HF_HOME | No | — | HuggingFace model cache directory. Mount this path in Docker to reuse downloads across restarts. |
HF_HUB_OFFLINE | No | — | Set to 1 to force offline mode. Requires models already present in HF_HOME. |
config/main.yaml
config/main.yaml controls system behavior, paths, tool settings, and module-specific parameters. This file is read at startup and does not require a restart to take effect during development.
System
Paths
All paths are relative to the project root.Tools
Root directory for all knowledge base data.
Default knowledge base name used when no KB is explicitly selected.
Sandbox directory for code execution artifacts.
Global switch for web search across all modules. Setting this to
false disables web search everywhere, regardless of module-level settings.Active search provider. Can also be set via
SEARCH_PROVIDER in .env. The .env value takes precedence.Enable the entity lookup tool (queries the knowledge graph for structured items like definitions and theorems).
Maximum number of items returned per query_item call.
Logging
Question module
Solve module
Research module
The research module has the most configuration options due to its multi-phase pipeline.Research presets
Presets are applied on top of the base research configuration. Select a preset from the UI or CLI with--preset.
| Preset | Subtopics | Max iterations | Min section length | Description |
|---|---|---|---|---|
quick | 1 | 1 | 300 chars | Fast overview with minimal depth. |
medium | 5 | 4 | 500 chars | Balanced depth for most topics. |
deep | 8 | 7 | 800 chars | Thorough research with maximum coverage. |
auto | Up to 8 | Up to 6 | 500 chars | Agent decides depth within configured limits. |
config/agents.yaml
agents.yaml is the single source of truth for LLM temperature and max_tokens across all agent modules. Every agent in a given module shares the same settings.
Do not hardcode temperature or max_tokens in agent code. Always modify this file to change LLM behavior.
Module parameters
| Module | temperature | max_tokens | Agents included |
|---|---|---|---|
solve | 0.3 | 8192 | InvestigateAgent, NoteAgent, ManagerAgent, SolveAgent, ToolAgent, ResponseAgent, PrecisionAnswerAgent |
research | 0.5 | 12000 | RephraseAgent, DecomposeAgent, ManagerAgent, ResearchAgent, NoteAgent, ReportingAgent |
question | 0.7 | 4096 | QuestionGenerationAgent, QuestionValidationAgent |
guide | 0.5 | 16192 | LocateAgent, InteractiveAgent, ChatAgent, SummaryAgent |
ideagen | 0.7 | 4096 | MaterialOrganizerAgent, IdeaGenerationWorkflow |
co_writer | 0.7 | 4096 | EditAgent |
narrator | 0.7 | 4000 | NarratorAgent (TTS script generation — limited by TTS character constraints) |
Example: reducing research verbosity
To make research reports more concise, lowermax_tokens and reduce temperature:
Example: more creative question generation
To generate more varied questions, raise the temperature for the question module:Configuration hierarchy
When the same setting exists at multiple levels, the higher-priority source wins:- Environment variables (
.env) — highest priority. Override everything. config/agents.yaml— LLM parameters only.config/main.yaml— all other system and module settings.