Configuration Reference
A consolidated reference for the knobs you can set on TnsAI from outside the code (env vars) or through builders. This page indexes the canonical sources rather than duplicating them — the goal is to tell you where to look, not to mirror state that will drift.
Environment Variables
The framework reads environment variables for credentials. Each LLM provider has its own:
| Variable | Used by | Purpose |
|---|---|---|
ANTHROPIC_API_KEY | tnsai-llm | Claude (Anthropic) API key |
OPENAI_API_KEY | tnsai-llm | OpenAI / GPT API key |
GEMINI_API_KEY | tnsai-llm | Google Gemini API key |
NVIDIA_API_KEY | tnsai-llm | NVIDIA NIM API key (cloud build.nvidia.com or self-hosted) |
MISTRAL_API_KEY | tnsai-llm | Mistral La Plateforme key |
GROQ_API_KEY | tnsai-llm | Groq inference key |
COHERE_API_KEY | tnsai-llm | Cohere API key |
OPENROUTER_API_KEY | tnsai-llm | OpenRouter aggregator key |
HUGGINGFACE_API_KEY | tnsai-llm | Hugging Face Inference API / Endpoints key |
XAI_API_KEY | tnsai-llm | xAI Grok key |
DEEPSEEK_API_KEY | tnsai-llm | DeepSeek key |
PERPLEXITY_API_KEY | tnsai-llm | Perplexity Sonar key |
TOGETHER_API_KEY | tnsai-llm | Together.ai key |
FIREWORKS_API_KEY | tnsai-llm | Fireworks AI key |
CEREBRAS_API_KEY | tnsai-llm | Cerebras inference key |
REPLICATE_API_TOKEN | tnsai-llm | Replicate API token (note: _TOKEN, not _KEY) |
DEEPINFRA_API_KEY | tnsai-llm | DeepInfra key |
DATABRICKS_TOKEN | tnsai-llm | Databricks Mosaic AI token |
WATSONX_API_KEY, WATSONX_PROJECT_ID | tnsai-llm | IBM watsonx.ai credentials (both required) |
MINIMAX_API_KEY | tnsai-llm | MiniMax key |
ZHIPU_API_KEY | tnsai-llm | Zhipu AI key |
AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT | tnsai-llm | Azure OpenAI (both required) |
BRAVE_API_KEY | tnsai-tools | Brave Search API key |
TAVILY_API_KEY | tnsai-tools | Tavily Search API key |
TELEGRAM_BOT_TOKEN | tnsai-channels | Telegram Bot API token |
EMAIL_IMAP_HOST, EMAIL_IMAP_USER, EMAIL_IMAP_PASSWORD, EMAIL_SMTP_HOST | tnsai-channels | Email channel (IMAP poll + SMTP send) |
SLACK_APP_TOKEN, SLACK_BOT_TOKEN | tnsai-channels | Slack Socket Mode |
DISCORD_BOT_TOKEN | tnsai-channels | Discord Gateway |
WHATSAPP_ACCESS_TOKEN, WHATSAPP_VERIFY_TOKEN, WHATSAPP_APP_SECRET | tnsai-channels | WhatsApp Cloud API |
Self-hosted endpoints typically expose a *_BASE_URL companion variable (e.g. NVIDIA_BASE_URL, OLLAMA_BASE_URL) for pointing the client at your container.
The ProviderEnvVarConsistencyTest in tnsai-llm is the authoritative list — it fails CI on any drift between the variable name a client reads and what the module's README documents.
AgentBuilder options
AgentBuilder is the canonical entry point for constructing agents. Read its Javadoc for the full method surface — every public method on the builder is a configurable option. The categories:
- Identity —
agentId,agentClass,displayName - LLM —
llm(LLMClient), plus per-call overrides viatemperature,topP,maxTokens - Role + actions —
role(Role),roles(...),capability(Capability) - Tools —
toolPojos(Object...)(recommended),dynamicTool(DynamicToolMethod),dynamicTools(List) - Memory + RAG —
memoryConfig(MemoryConfig)(declarative, mirrors@MemorySpec),memoryStore(MemoryStore)(custom store),maxContextTokens(int),knowledgeBase(KnowledgeBase) - Resilience —
cancellationToken(CancellationToken),timeoutPolicy(TimeoutPolicy),@Retry/@CircuitBreakerhonored from role annotations - Validation —
relaxValidation(String code)to skip a specific build-time check
LLMClient configuration
Each tnsai-llm client has its own builder with provider-specific options (caching, beta headers, base-URL overrides, etc.). See the module's README for the per-provider matrix.
Server configuration
tnsai-server reads its bind address, port, auth mode, and tool-approval channel config either programmatically or from a server.yml file. See the server module README.
Related
- Installation — initial env setup.
- Help / FAQ — common credential / configuration questions.
- Troubleshooting — diagnosing missing-credential failures.