Skip to main content

Configuration

Toolpack SDK supports a hierarchical configuration system with multiple layers.

Configuration Hierarchy

Configuration is loaded and merged in the following priority order (highest priority first):

PriorityLocationDescription
1 (highest).toolpack/config/toolpack.config.jsonWorkspace-local config
2~/.toolpack/config/toolpack.config.jsonGlobal user config
3 (lowest)toolpack.config.jsonProject root config

Values from higher-priority configs override lower-priority ones. Objects are deep-merged, arrays are replaced.

Example

~/.toolpack/config/toolpack.config.json (global)
{
"tools": { "enabled": true, "maxToolRounds": 5 }
}

.toolpack/config/toolpack.config.json (local)
{
"tools": { "maxToolRounds": 20 }
}

# Result: tools.enabled = true, tools.maxToolRounds = 20

Configuration File

Create toolpack.config.json in your project root (or use the hierarchy above):

{
"systemPrompt": "You are a helpful coding assistant.",
"baseContext": true,
"tools": {
"enabled": true,
"autoExecute": true,
"maxToolRounds": 10
},
"logging": {
"enabled": false,
"level": "info"
}
}

Top-Level Options

OptionTypeDefaultDescription
systemPromptstring-Custom system prompt for all requests
baseContextbooleantrueInclude working directory and tool info in context
disableBaseContextbooleanfalseDisable base context injection
modeOverridesobject-Override system prompts per mode
loggingobject-Logging configuration

Tools Configuration

{
"tools": {
"enabled": true,
"autoExecute": true,
"maxToolRounds": 10,
"toolChoicePolicy": "auto",
"enabledTools": [],
"enabledToolCategories": [],
"intelligentToolDetection": {
"enabled": false,
"maxFollowUpMessages": 5
},
"toolSearch": {
"enabled": false,
"alwaysLoadedTools": [],
"alwaysLoadedCategories": [],
"searchResultLimit": 5,
"cacheDiscoveredTools": true
},
"additionalConfigurations": {
"MY_CUSTOM_API_KEY": "123456"
}
}
}

Tools Options

OptionTypeDefaultDescription
enabledbooleantrueEnable tool system
autoExecutebooleantrueAutomatically execute tool calls
maxToolRoundsnumber5Max tool execution rounds per request
toolChoicePolicystring"auto""auto", "required", or "required_for_actions"
enabledToolsstring[][]Specific tools to enable (empty = all)
enabledToolCategoriesstring[][]Categories to enable (empty = all)
additionalConfigurationsobjectKey-value config passed dynamically to custom tools via ToolContext

Tool Categories

CategoryDescription
filesystemFile system operations
executionCommand execution
systemSystem information
networkHTTP and web tools
codingCode analysis tools
version-controlGit operations
diffDiff and patch tools
databaseDatabase operations
cloudCloud deployment

Intelligent Tool Detection

When enabled, the SDK analyzes conversation context to decide if tools are needed:

{
"tools": {
"intelligentToolDetection": {
"enabled": true,
"maxFollowUpMessages": 5
}
}
}

For large tool sets, enable on-demand tool discovery:

{
"tools": {
"toolSearch": {
"enabled": true,
"alwaysLoadedTools": ["fs.read_file", "exec.run"],
"alwaysLoadedCategories": ["filesystem"],
"searchResultLimit": 5,
"cacheDiscoveredTools": true
}
}
}

Logging Configuration

{
"logging": {
"enabled": true,
"filePath": "./toolpack-sdk.log",
"verbose": true
}
}
OptionTypeDefaultDescription
enabledbooleanfalseEnable file logging
filePathstring./toolpack-sdk.logLog file path
levelstringinfoLog level (error, warn, info, debug, trace)

You can also enable logging via environment variables:

# Set a log file path (also enables logging)
export TOOLPACK_SDK_LOG_FILE="./toolpack-sdk.log"

# Override log level
export TOOLPACK_SDK_LOG_LEVEL="debug"

Mode Overrides

Override system prompts for specific modes:

{
"modeOverrides": {
"agent": {
"systemPrompt": "You are a careful coding assistant. Always explain before making changes."
},
"chat": {
"systemPrompt": "You are a friendly research assistant."
}
}
}

Environment Variables

VariableDescription
OPENAI_API_KEYOpenAI API key
ANTHROPIC_API_KEYAnthropic API key
GEMINI_API_KEYGoogle Gemini API key
TOOLPACK_OPENAI_KEYAlternative OpenAI key
TOOLPACK_ANTHROPIC_KEYAlternative Anthropic key
TOOLPACK_GEMINI_KEYAlternative Gemini key
TOOLPACK_SDK_LOG_FILELog file path (enables logging)
TOOLPACK_SDK_LOG_LEVELLog level override (error, warn, info, debug, trace)
NETLIFY_AUTH_TOKENNetlify deployment token

Programmatic Configuration

All options can also be set programmatically:

const toolpack = await Toolpack.init({
provider: 'openai',
apiKey: 'sk-...',
model: 'gpt-4o',
tools: true,
customModes: [...],
defaultMode: 'agent',
modeOverrides: {
agent: { systemPrompt: '...' }
},
});

See ToolpackInitConfig for all options.