Skip to content

Configuration

The agent is configured through two files. Every value can also be overridden via environment variables.

Configuration Files

FilePurposeCommitted?
.envSecrets (API keys, tokens)No (gitignored)
agent.tomlEverything elseYes

Environment variables take precedence over agent.toml values.

Sections Reference

[agent]

Core agent settings.

KeyEnv VarDefaultDescription
working_dirAGENT_HOME~/.agentWorking directory for the agent
default_personaAGENT_DEFAULT_PERSONAdefaultDefault persona name
timezoneAGENT_TIMEZONEUTCTimezone for cron, DND, and time-aware features
restrict_to_working_dirAGENT_RESTRICT_TO_WORKING_DIRfalseRestrict file access to working directory

[api]

LLM API configuration.

KeyEnv VarDefaultDescription
base_urlOPENAI_BASE_URLhttps://api.deepseek.com/v1OpenAI-compatible API endpoint
modelOPENAI_MODELModel name
temperatureOPENAI_TEMPERATURE0.7Sampling temperature
max_tokensOPENAI_MAX_TOKENS4096Max response tokens
tool_choiceOPENAI_TOOL_CHOICEautoTool choice mode
max_tool_roundsMAX_TOOL_ROUNDS50Max tool-calling rounds per turn
context_window_warn_percentCONTEXT_WINDOW_WARN_PERCENT50Warn when context window is this percent full

[api.retry]

Retry policy for transient failures.

KeyEnv VarDefaultDescription
max_retriesOPENAI_MAX_RETRIES3Max retry attempts
delay_msOPENAI_RETRY_DELAY_MS1000Initial delay in ms
backoff_multiplierOPENAI_RETRY_BACKOFF_MULTIPLIER2.0Exponential backoff multiplier

[bash]

Bash tool settings.

KeyEnv VarDefaultDescription
default_workdirBASH_DEFAULT_WORKDIR/tmpDefault working directory
output_limitBASH_OUTPUT_LIMIT4000Max output characters
clear_envBASH_CLEAR_ENVtrueClear environment variables before execution
foreground_max_msBASH_FOREGROUND_MAX_MS300000Max foreground execution time
background_detectionBASH_BACKGROUND_DETECTIONtrueDetect nohup/disown/& wrappers

[web]

Web fetch tool settings.

KeyEnv VarDefaultDescription
response_limitWEB_RESPONSE_LIMIT8000Max response characters
ssrf_protectionWEB_SSRF_PROTECTIONtrueEnable SSRF protection
url_secret_scanWEB_URL_SECRET_SCANtrueScan URLs for embedded secrets

[browser]

Browser automation tool settings.

KeyEnv VarDefaultDescription
commandBROWSER_COMMANDnpx agent-browserBrowser CLI command
headlessBROWSER_HEADLESStrueRun in headless mode
engineBROWSER_ENGINEautoBrowser engine (chromium/firefox/webkit/auto)

[memory]

Memory plugin settings.

KeyEnv VarDefaultDescription
max_entry_charsMEMORY_MAX_ENTRY_CHARS2200Max characters per memory entry
max_user_charsMEMORY_MAX_USER_CHARS1375Max characters for user-provided content
scan_enabledMEMORY_SCAN_ENABLEDtrueEnable content validation scanning
dedup_enabledMEMORY_DEDUP_ENABLEDtrueEnable duplicate detection

[session]

Session lifecycle settings.

KeyEnv VarDefaultDescription
auto_titleSESSION_AUTO_TITLEtrueAuto-generate titles via LLM
retention_daysSESSION_RETENTION_DAYS90Auto-prune ended sessions after N days
crash_recoverySESSION_CRASH_RECOVERYtrueRecover active sessions on daemon restart

[guardrails.tool_loop]

Circuit breaker for stuck tool loops.

KeyEnv VarDefaultDescription
enabledGUARDRAILS_ENABLEDtrueEnable circuit breaker
warn_thresholdGUARDRAILS_WARN_THRESHOLD3Consecutive loops before warning
block_thresholdGUARDRAILS_BLOCK_THRESHOLD5Consecutive loops before blocking
halt_thresholdGUARDRAILS_HALT_THRESHOLD10Consecutive loops before halting
no_progress_detectionGUARDRAILS_NO_PROGRESStrueDetect idempotent tool calls

[context.compression]

Context window compression settings.

KeyEnv VarDefaultDescription
enabledCONTEXT_COMPRESSION_ENABLEDtrueEnable compression
trigger_percentCONTEXT_COMPRESSION_TRIGGER70Trigger at this percent of context window
protected_headCONTEXT_COMPRESSION_HEAD2Messages to protect at the head
protected_tailCONTEXT_COMPRESSION_TAIL6Messages to protect at the tail

[gateway.telegram]

Telegram gateway settings.

KeyEnv VarDefaultDescription
notify_chat_idTELEGRAM_NOTIFY_CHAT_IDDefault notification chat ID
dedup_window_msTELEGRAM_DEDUP_WINDOW_MS10000Deduplication window
polling_timeoutTELEGRAM_POLLING_TIMEOUT30Long-poll timeout in seconds
http_timeout_msTELEGRAM_HTTP_TIMEOUT_MS90000HTTP client timeout

[pulse], [reflection], [cron], [harness]

Autonomy features. Each has an enabled flag and feature-specific settings. See the Architecture page for context on how these fit together.

Environment Variable Precedence

The config loader checks, in order:

  1. .env file
  2. agent.toml defaults
  3. Actual environment variables (highest priority)

This means you can override any agent.toml value at runtime:

sh
OPENAI_MODEL=deepseek-v4-pro MAX_TOOL_ROUNDS=30 gleam run

Built with Gleam on the BEAM/Erlang VM.