Background agents
Background agents are long-running workers that run out-of-band — they don’t block the foreground conversation. Claude Code is still the default, but background tasks can also run through Codex CLI, Gemini CLI, or the openai-compatible provider when that better fits the workload.
When to use background agents
Section titled “When to use background agents”Good use cases:
- Repo-wide refactoring or code analysis
- Large document processing or research
- Tasks that take 5+ minutes and don’t need turn-by-turn interaction
Not appropriate for:
- Quick lookups or calculations (use sub-agents instead)
- Tasks that need access to the conversation history in real time
- Anything that needs to send multiple incremental messages back
How it works
Section titled “How it works”The foreground agent calls background_agent with a task description. Talon spawns the configured provider process, tracks it in SQLite, and returns a task ID immediately. The foreground conversation continues normally.
When the background worker finishes (or times out, or fails), Talon delivers a completion message to the originating thread via the normal queue and channel-send path.
Background workers:
- Inherit the persona’s system prompt and MCP servers from assigned skills
- Get a filtered version of Talon’s host-tools MCP server, based on the persona’s capabilities. The
background_agenttool is always excluded, so a worker cannot spawn more workers - Are subject to
maxConcurrentanddefaultTimeoutMinuteslimits - Have their state persisted — completion/failure/timeout/cancellation are all recorded
Configuration
Section titled “Configuration”backgroundAgent: enabled: true maxConcurrent: 3 defaultTimeoutMinutes: 30 defaultProvider: claude-code providers: claude-code: enabled: true command: claude contextWindowTokens: 200000| Field | Default | Description |
|---|---|---|
enabled | true | Globally enable background workers |
maxConcurrent | 3 | Maximum simultaneous workers (1–10) |
defaultTimeoutMinutes | 30 | Default wall-clock timeout (15–480 min) |
defaultProvider | claude-code | Provider used for workers |
claudePath | — | Legacy shortcut for the Claude Code binary path |
providers.<name>.options | {} | Provider-specific options (for example defaultModel: gpt-5.4 for codex-cli, or baseUrl / providerId for openai-compatible) |
Available providers: claude-code (default), gemini-cli, codex-cli, and openai-compatible. See the Providers guide for configuration details.
Per-persona provider
Section titled “Per-persona provider”A persona can run its background agents on a different provider and model than its foreground runs. Set backgroundProvider and, optionally, backgroundModel:
personas: - name: assistant model: qwen3-coder:30b provider: openai-compatible # foreground stays on Ollama backgroundProvider: claude-code # background runs on Claude Code backgroundModel: claude-sonnet-4-6backgroundProvider must be enabled under backgroundAgent.providers. The daemon refuses to start otherwise. backgroundModel without backgroundProvider is rejected at config load.
Talon picks the provider for a spawn in this order:
- The
providerargument of thebackground_agenttool call - The persona’s
backgroundProvider - The persona’s foreground
provider, only if it is also enabled underbackgroundAgent.providers backgroundAgent.defaultProvider
When a background run takes its provider and model from the persona configuration, Talon also forwards that persona’s reasoningEffort. A run with explicit provider arguments in the tool call does not inherit it.
OpenAI-compatible background workers
Section titled “OpenAI-compatible background workers”openai-compatible works as a background provider. Configure it like this:
backgroundAgent: enabled: true maxConcurrent: 2 defaultTimeoutMinutes: 30 defaultProvider: claude-code providers: claude-code: enabled: true command: claude contextWindowTokens: 200000 openai-compatible: enabled: true command: node contextWindowTokens: 256000 options: baseUrl: ${OLLAMA_BASE_URL} defaultModel: glm-5.1 providerId: ollamaNotes:
- background
openai-compatibleruns use the same tool bridge and capability filtering as the foreground path - they do not live-stream intermediate output back into the channel
- credentials are resolved from
auth.providers.<providerId>first, thenauth.providers.openai-compatible
Enabling for a persona
Section titled “Enabling for a persona”Grant subagent.background in the persona’s capabilities:
personas: - name: assistant capabilities: allow: - subagent.background - channel.send:my-telegramProfiles
Section titled “Profiles”A profile is a loaded persona. When the agent passes profile on spawn, the worker uses that persona’s system prompt, skills, model, and provider instead of those of the persona that owns the thread. The agent can call background_agent action="profiles" to discover available profiles before spawning. The list shows each persona name plus the optional description from its system.md frontmatter.
Without a profile, the worker gets the full prompt of the persona that owns the thread. A lean persona used as profile keeps background agents small.
To check what profiles are available, instruct the agent to do so in the system prompt:
## Background Agents
You can delegate work to specialized background agents. Use`background_agent action="profiles"` to discover what profiles are available.When asked about your capabilities or what agents you can use, always checkprofiles first rather than guessing.The background_agent tool
Section titled “The background_agent tool”| Parameter | Description |
|---|---|
action | spawn, status, cancel, result, or profiles |
prompt | Task prompt for spawn |
taskId | Task ID for status, cancel, and result |
profile | Persona name to use as profile for spawn |
provider | Optional provider override for spawn |
workingDirectory | Optional working directory for the worker |
timeoutMinutes | Optional timeout override for spawn, in minutes |
Example interaction
Section titled “Example interaction”User sends: “Analyze all TypeScript files in /home/user/project and produce a dependency graph.”
The foreground agent:
- Calls
background_agent action="profiles"to check available profiles - Selects an appropriate profile
- Calls
background_agent action="spawn"with the task description and timeout - Immediately responds to the user: “Started analysis. I’ll let you know when it’s done — this should take about 15 minutes.”
When the worker finishes, the user receives a completion message with results.
Limits and constraints
Section titled “Limits and constraints”- Workers cannot spawn additional background agents
- Results arrive in the originating thread via the daemon after completion
- If a worker exceeds its timeout (
defaultTimeoutMinutesunless the spawn call setstimeoutMinutes), it’s killed and the originating thread is notified - The daemon enforces
maxConcurrent. If the limit is reached, a new spawn request fails with a concurrency-limit error. The agent can retry when a worker has finished
Monitoring
Section titled “Monitoring”Check running background workers via daemon status:
npx talonctl statusThe status output includes active background worker count and any recently completed/failed tasks.