Skip to main content
AFK is configured primarily through code. Environment variables provide fallback defaults for LLM settings, memory backends, queues, and prompt directories. Runtime configuration APIs always take precedence.
All variables are optional. If unset, AFK uses the defaults listed below.

LLM defaults

These variables configure the default LLM provider and behavior. They are read by LLMSettings.from_env() at startup.
API keys for specific providers (e.g. OPENAI_API_KEY, ANTHROPIC_API_KEY) are read by the underlying provider libraries, not by AFK directly. Set AFK_LLM_API_KEY only if you want a single key shared across providers.

Memory

Configure the persistent memory backend for thread-based conversations.

Queue

Configure the task queue backend for async agent execution.
The inmemory queue backend does not persist across restarts. Use redis for production workloads that need reliable task delivery.

Prompts

Agents resolve instruction_file paths relative to this directory. See System Prompts for details.

Runner and tool command defaults

Runner constructors and RunnerConfig fields remain the preferred way to set command policy. Use this environment variable only for process-wide defaults.

MCP server

These variables are read by the MCP server configuration helpers in afk.config.

A2A

No default environment variables are required. Configure A2A host and authentication in code for an explicit security posture. See A2A for details.

Precedence

Configuration is resolved in this order (highest priority first):
  1. Constructor argumentsRunner(memory_store=...), Agent(model=...)
  2. RunnerConfig / LLMSettings objects — passed to constructors
  3. Environment variables — fallback defaults listed on this page
  4. Built-in defaults — hardcoded in the source

Next steps

Configuration Reference

Full reference for all configurable fields across Agent, Runner, and more.

Core Runner

Runner lifecycle and configuration options.