LemonCore. Config. Tools
(lemon_core v0.1.0)
View Source
Tools configuration for web search, fetch, and WASM tools.
Inspired by Ironclaw's modular config pattern, this module handles tool-specific configuration including web search providers, fetch settings, and WASM runtime configuration.
Configuration
Configuration is loaded from the TOML config file under [agent.tools]:
[agent.tools]
auto_resize_images = true
[agent.tools.web.search]
enabled = true
provider = "brave"
max_results = 5
timeout_seconds = 30
[agent.tools.web.fetch]
enabled = true
max_chars = 50000
readability = true
[agent.tools.wasm]
enabled = false
auto_build = true
default_memory_limit = 10485760Environment variables override file configuration:
LEMON_WEB_SEARCH_ENABLED,LEMON_WEB_SEARCH_PROVIDERLEMON_WEB_FETCH_ENABLED,LEMON_WEB_FETCH_MAX_CHARSLEMON_WASM_ENABLED,LEMON_WASM_AUTO_BUILD
Summary
Functions
Returns the default tools configuration as a map.
Resolves tools configuration from settings and environment variables.
Types
@type t() :: %LemonCore.Config.Tools{ auto_resize_images: boolean(), wasm: wasm_config(), web: %{ search: web_search_config(), fetch: web_fetch_config(), cache: web_cache_config() } }
@type wasm_config() :: %{ enabled: boolean(), auto_build: boolean(), runtime_path: String.t(), tool_paths: [String.t()], default_memory_limit: integer(), default_timeout_ms: integer(), default_fuel_limit: integer(), cache_compiled: boolean(), cache_dir: String.t(), max_tool_invoke_depth: integer() }
@type web_fetch_config() :: %{ enabled: boolean(), max_chars: integer(), timeout_seconds: integer(), cache_ttl_minutes: integer(), max_redirects: integer(), user_agent: String.t(), readability: boolean(), allow_private_network: boolean(), allowed_hostnames: [String.t()], firecrawl: %{ enabled: boolean() | nil, api_key: String.t() | nil, base_url: String.t(), only_main_content: boolean(), max_age_ms: integer(), timeout_seconds: integer() } }
@type web_search_config() :: %{ enabled: boolean(), provider: String.t(), api_key: String.t() | nil, max_results: integer(), timeout_seconds: integer(), cache_ttl_minutes: integer(), failover: %{enabled: boolean(), provider: String.t() | nil}, perplexity: %{ api_key: String.t() | nil, base_url: String.t() | nil, model: String.t() } }
Functions
@spec defaults() :: map()
Returns the default tools configuration as a map.
This is used as the base configuration that gets overridden by user settings.
Resolves tools configuration from settings and environment variables.
Priority: environment variables > TOML config > defaults