Environment Variables Reference¶
ToolUniverse can be configured through environment variables for cache behavior, logging, LLM integration, performance tuning, and more.
Quick Reference¶
Most commonly used:
TOOLUNIVERSE_CACHE_ENABLED- Enable/disable caching (default:true)TOOLUNIVERSE_LOG_LEVEL- Set logging level (default:INFO)NCBI_API_KEY- Faster PubMed/NCBI access (3x rate limit increase)
For API keys configuration, see API Keys and Authentication.
Cache Configuration¶
Control ToolUniverse’s two-tier caching system (in-memory LRU + SQLite persistence).
Variable |
Default |
Description |
|---|---|---|
|
|
Master switch for all caching. Set to |
|
|
Enable SQLite persistence. Cached results survive Python restarts. |
|
(see below) |
Full path to SQLite cache file. If unset, uses |
|
|
Directory for cache file when |
|
|
Maximum entries in in-memory LRU cache. Increase for batch workflows (e.g., |
|
|
Time-to-live in seconds for cached entries. |
|
|
Deduplicate concurrent identical requests. Prevents redundant API calls when multiple threads request same data. |
|
|
Write to SQLite on background thread for non-blocking I/O. Set to |
Examples:
# Disable caching entirely
export TOOLUNIVERSE_CACHE_ENABLED=false
# Custom cache location with 1-hour expiration
export TOOLUNIVERSE_CACHE_PATH=/tmp/my_cache.sqlite
export TOOLUNIVERSE_CACHE_DEFAULT_TTL=3600
# Large-scale batch processing (5M entries in memory)
export TOOLUNIVERSE_CACHE_MEMORY_SIZE=5000000
# Synchronous writes for critical data
export TOOLUNIVERSE_CACHE_ASYNC_PERSIST=false
See also: Result Caching for complete caching guide.
Logging & Debugging¶
Control log output verbosity and destinations.
Variable |
Default |
Description |
|---|---|---|
|
|
Logging level: |
|
|
Internal flag. Set to |
|
|
Enable verbose output for tool generation and debugging. Set to |
Examples:
# Debug mode for troubleshooting
export TOOLUNIVERSE_LOG_LEVEL=DEBUG
# Verbose tool generation
export TOOLUNIVERSE_VERBOSE=1
See also: Logging Tutorial for logging configuration.
Loading & Import Control¶
Optimize startup time and memory usage by controlling how tools are loaded.
Variable |
Default |
Description |
|---|---|---|
|
|
Defer tool loading until first use. Improves startup speed. |
|
|
Minimal imports on package import. Reduces memory footprint for embedded use. |
Examples:
# Disable lazy loading (load all tools at startup)
export TOOLUNIVERSE_LAZY_LOADING=false
# Minimal imports for embedded systems
export TOOLUNIVERSE_LIGHT_IMPORT=true
When to use:
Lazy loading (default): Best for most use cases. Fast startup, tools load on-demand.
Eager loading: Set
LAZY_LOADING=falseif you need all tools pre-loaded (e.g., warming cache).Light import: Embedded systems or when ToolUniverse is imported but not immediately used.
LLM Configuration¶
Configure Large Language Model providers for agentic tools and LLM-powered features.
Variable |
Default |
Description |
|---|---|---|
|
(none) |
Default LLM provider: |
|
|
LLM configuration mode. Use |
|
(varies) |
Temperature for LLM sampling (0.0-1.0). Higher = more creative. |
|
(provider default) |
Default model ID when not task-specific. |
|
(none) |
Task-specific model. |
Examples:
# Use OpenAI for all LLM tasks
export TOOLUNIVERSE_LLM_DEFAULT_PROVIDER=openai
export TOOLUNIVERSE_LLM_MODEL_DEFAULT=gpt-4o-mini
# Task-specific models
export TOOLUNIVERSE_LLM_MODEL_SUMMARIZATION=gpt-4o-mini
export TOOLUNIVERSE_LLM_MODEL_EXTRACTION=gpt-4o
# Adjust temperature
export TOOLUNIVERSE_LLM_TEMPERATURE=0.2
Use cases:
Agentic Tools: Tools that use LLMs internally (e.g., Tool_Finder_LLM, summarization tools)
Hooks: LLM-powered output processing hooks
Custom Tools: Your own tools that leverage LLM capabilities
See also: Provider-specific API keys in API Keys and Authentication.
Performance & System¶
Tune system resources and performance characteristics.
Variable |
Default |
Description |
|---|---|---|
|
|
Thread pool size for HTTP API server concurrent requests. |
|
(system temp) |
Override temporary directory location. Useful for systems with custom temp partitions. |
Examples:
# Increase HTTP API concurrency
export TOOLUNIVERSE_THREAD_POOL_SIZE=50
# Custom temporary directory
export TOOLUNIVERSE_TMPDIR=/mnt/fast-ssd/tmp
Development & Tool Generation¶
Control tool code generation and development workflows.
Variable |
Default |
Description |
|---|---|---|
|
|
Skip code formatting during tool generation. Set to |
|
|
Force regeneration of all tool files even if unchanged. Set to |
Examples:
# Fast tool generation (skip formatting)
export TOOLUNIVERSE_SKIP_FORMAT=1
# Force complete regeneration
export TOOLUNIVERSE_FORCE_REGENERATE=1
Use cases:
Development: When iterating on tool generation scripts
CI/CD: Ensure clean generation in automated builds
Embedding Provider Configuration¶
For tu-datastore and semantic search features.
Variable |
Description |
|---|---|
|
Embedding provider: |
|
Embedding model name (e.g., |
|
OpenAI API key (if using OpenAI embeddings) |
|
Hugging Face token (if using HF embeddings) |
|
Azure-specific configuration variables |
Examples:
# OpenAI embeddings
export EMBED_PROVIDER=openai
export EMBED_MODEL=text-embedding-3-small
export OPENAI_API_KEY=sk-...
# Hugging Face embeddings
export EMBED_PROVIDER=huggingface
export EMBED_MODEL=sentence-transformers/all-MiniLM-L6-v2
export HF_TOKEN=hf_...
See also: tu-datastore command in CLI Tools Reference.
API Keys¶
API keys for external scientific databases and services.
For complete API key documentation including:
Required vs optional keys
Rate limits and performance benefits
Configuration methods
Troubleshooting
See: API Keys and Authentication
Common API keys:
# NCBI (3x faster PubMed access)
NCBI_API_KEY=your_key_here
# Semantic Scholar (no rate limits)
SEMANTIC_SCHOLAR_API_KEY=your_key_here
# NVIDIA NIM (protein structure prediction)
NVIDIA_API_KEY=your_key_here
# Many more available - see api_keys.rst
Configuration File Support¶
You can set environment variables in a .env file at project root:
Example .env file:
# Cache configuration
TOOLUNIVERSE_CACHE_ENABLED=true
TOOLUNIVERSE_CACHE_MEMORY_SIZE=1024
TOOLUNIVERSE_CACHE_DEFAULT_TTL=3600
# Logging
TOOLUNIVERSE_LOG_LEVEL=INFO
# API Keys
NCBI_API_KEY=your_key_here
SEMANTIC_SCHOLAR_API_KEY=your_key_here
# LLM Configuration
TOOLUNIVERSE_LLM_DEFAULT_PROVIDER=openai
OPENAI_API_KEY=sk-...
To use:
Automatic: ToolUniverse automatically loads
.envfrom current directoryManual: Use python-dotenv:
from dotenv import load_dotenv load_dotenv() from tooluniverse import ToolUniverse
See also: Template at .env.template in project root.
Precedence Order¶
When the same configuration is specified in multiple places, ToolUniverse uses this precedence order (highest to lowest):
Environment variables (highest priority) - Set in shell:
export TOOLUNIVERSE_CACHE_ENABLED=false- Set in code:os.environ["TOOLUNIVERSE_CACHE_ENABLED"] = "false"``.env`` file in current directory - Loaded automatically by ToolUniverse
Default values (lowest priority) - Built-in defaults in code
Example:
# .env file
TOOLUNIVERSE_CACHE_MEMORY_SIZE=512
# Shell export (overrides .env)
export TOOLUNIVERSE_CACHE_MEMORY_SIZE=1024
# Result: Uses 1024 (environment variable wins)
Platform-Specific Notes¶
Linux/macOS¶
Use shell export:
export TOOLUNIVERSE_CACHE_ENABLED=true
Permanent (add to ~/.bashrc or ~/.zshrc):
echo 'export TOOLUNIVERSE_CACHE_ENABLED=true' >> ~/.bashrc
Windows (PowerShell)¶
$env:TOOLUNIVERSE_CACHE_ENABLED = "true"
Permanent:
[System.Environment]::SetEnvironmentVariable('TOOLUNIVERSE_CACHE_ENABLED', 'true', 'User')
Windows (Command Prompt)¶
set TOOLUNIVERSE_CACHE_ENABLED=true
Docker¶
In Dockerfile:
ENV TOOLUNIVERSE_CACHE_ENABLED=true \
TOOLUNIVERSE_LOG_LEVEL=INFO
Or docker-compose.yml:
services:
tooluniverse:
environment:
- TOOLUNIVERSE_CACHE_ENABLED=true
- TOOLUNIVERSE_LOG_LEVEL=INFO
Verification¶
Check if environment variables are set correctly:
Python:
import os
print(os.getenv("TOOLUNIVERSE_CACHE_ENABLED")) # Should print 'true' or 'false'
Shell:
echo $TOOLUNIVERSE_CACHE_ENABLED # Linux/macOS
echo %TOOLUNIVERSE_CACHE_ENABLED% # Windows CMD
$env:TOOLUNIVERSE_CACHE_ENABLED # Windows PowerShell
Using tooluniverse-doctor:
tooluniverse-doctor --check-keys
Troubleshooting¶
Environment variable not taking effect¶
Possible causes:
Variable set after importing ToolUniverse - Solution: Set environment variables before
from tooluniverse import ToolUniverseTypo in variable name - Solution: Variable names are case-sensitive. Use exactly as documented.
Value format incorrect - Solution: Boolean values should be
true/false(lowercase). Numbers should be unquoted.Cached Python import - Solution: Restart Python interpreter to reload environment
Values not persisting¶
Problem: Variables reset after terminal closes.
Solution: Add to shell configuration file:
Bash:
~/.bashrcor~/.bash_profileZsh:
~/.zshrcFish:
~/.config/fish/config.fish
See Also¶
CLI Tools Reference - Command-line tools reference
API Keys and Authentication - API keys configuration
Result Caching - Caching system guide
Logging Tutorial - Logging configuration
Troubleshooting Tutorial - Troubleshooting guide
Installation - Installation instructions
Complete Variable List¶
Quick reference table of all documented environment variables:
Variable |
Default |
Category |
|---|---|---|
|
true |
Cache |
|
true |
Cache |
|
(dynamic) |
Cache |
|
~/.tooluniverse |
Cache |
|
256 |
Cache |
|
None |
Cache |
|
true |
Cache |
|
true |
Cache |
|
INFO |
Logging |
|
0 |
Logging |
|
0 |
Logging |
|
true |
Loading |
|
false |
Loading |
|
(none) |
LLM |
|
default |
LLM |
|
(varies) |
LLM |
|
(provider default) |
LLM |
|
(none) |
LLM |
|
20 |
Performance |
|
(system temp) |
Performance |
|
0 |
Development |
|
0 |
Development |
|
(none) |
Embeddings |
|
(none) |
Embeddings |
API keys |
(various) |