TnsAI

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:

VariableUsed byPurpose
ANTHROPIC_API_KEYtnsai-llmClaude (Anthropic) API key
OPENAI_API_KEYtnsai-llmOpenAI / GPT API key
GEMINI_API_KEYtnsai-llmGoogle Gemini API key
NVIDIA_API_KEYtnsai-llmNVIDIA NIM API key (cloud build.nvidia.com or self-hosted)
MISTRAL_API_KEYtnsai-llmMistral La Plateforme key
GROQ_API_KEYtnsai-llmGroq inference key
COHERE_API_KEYtnsai-llmCohere API key
OPENROUTER_API_KEYtnsai-llmOpenRouter aggregator key
HUGGINGFACE_API_KEYtnsai-llmHugging Face Inference API / Endpoints key
XAI_API_KEYtnsai-llmxAI Grok key
DEEPSEEK_API_KEYtnsai-llmDeepSeek key
PERPLEXITY_API_KEYtnsai-llmPerplexity Sonar key
TOGETHER_API_KEYtnsai-llmTogether.ai key
FIREWORKS_API_KEYtnsai-llmFireworks AI key
CEREBRAS_API_KEYtnsai-llmCerebras inference key
REPLICATE_API_TOKENtnsai-llmReplicate API token (note: _TOKEN, not _KEY)
DEEPINFRA_API_KEYtnsai-llmDeepInfra key
DATABRICKS_TOKENtnsai-llmDatabricks Mosaic AI token
WATSONX_API_KEY, WATSONX_PROJECT_IDtnsai-llmIBM watsonx.ai credentials (both required)
MINIMAX_API_KEYtnsai-llmMiniMax key
ZHIPU_API_KEYtnsai-llmZhipu AI key
AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINTtnsai-llmAzure OpenAI (both required)
BRAVE_API_KEYtnsai-toolsBrave Search API key
TAVILY_API_KEYtnsai-toolsTavily Search API key
TELEGRAM_BOT_TOKENtnsai-channelsTelegram Bot API token
EMAIL_IMAP_HOST, EMAIL_IMAP_USER, EMAIL_IMAP_PASSWORD, EMAIL_SMTP_HOSTtnsai-channelsEmail channel (IMAP poll + SMTP send)
SLACK_APP_TOKEN, SLACK_BOT_TOKENtnsai-channelsSlack Socket Mode
DISCORD_BOT_TOKENtnsai-channelsDiscord Gateway
WHATSAPP_ACCESS_TOKEN, WHATSAPP_VERIFY_TOKEN, WHATSAPP_APP_SECRETtnsai-channelsWhatsApp 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:

  • IdentityagentId, agentClass, displayName
  • LLMllm(LLMClient), plus per-call overrides via temperature, topP, maxTokens
  • Role + actionsrole(Role), roles(...), capability(Capability)
  • ToolstoolPojos(Object...) (recommended), dynamicTool(DynamicToolMethod), dynamicTools(List)
  • Memory + RAGmemoryConfig(MemoryConfig) (declarative, mirrors @MemorySpec), memoryStore(MemoryStore) (custom store), maxContextTokens(int), knowledgeBase(KnowledgeBase)
  • ResiliencecancellationToken(CancellationToken), timeoutPolicy(TimeoutPolicy), @Retry / @CircuitBreaker honored from role annotations
  • ValidationrelaxValidation(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.

On this page