Skip to content

feat: support configuring a default_agent across all API/user surfaces#5843

Merged
rekram1-node merged 2 commits intoanomalyco:devfrom
elithrar:support-default-agent
Dec 20, 2025
Merged

feat: support configuring a default_agent across all API/user surfaces#5843
rekram1-node merged 2 commits intoanomalyco:devfrom
elithrar:support-default-agent

Conversation

@elithrar
Copy link
Copy Markdown
Contributor

@elithrar elithrar commented Dec 20, 2025

This PR supports defining a default_agent in opencode config (TUI, CLI, desktop, GitHub) so that opencode uses that from the outset. It also expands existing cases where users can provide an --agent flag to warn if their specified agent isn't found and fall back to "build" (existing behaviour, just not explicit to a user).

Changes

  • adds default_agent field to config schema (Config.Info)
  • adds default field to Agent.Info schema so clients (TUI, desktop) know which agent is the default
  • adds Agent.defaultAgent() helper that resolves the configured default agent
  • updates all hardcoded "build" fallbacks to use Agent.defaultAgent()
  • updates TUI to select the default agent on initialization (was just picking first agent)
  • adds agent input to GitHub Action for per-workflow override
  • updates documentation for config and GitHub Action
  • regenerates SDK types

Validation

  • only primary agents can be set as the default (not subagents like explore)
  • can be a built-in agent (build, plan) or a custom agent defined in config
  • invalid/missing agents log a warning: default agent "{name}" not found. Falling back to "build"

Usage

{
  "$schema": "https://opencode.ai/config.json",
  "default_agent": "plan"
}
# GitHub Action
- uses: sst/opencode/github@latest
  with:
    model: anthropic/claude-sonnet-4-20250514
    agent: docs  # overrides the config default

- Add 'default' field to Agent.Info schema
- Mark the default agent when building agent list in state()
- Simplify Agent.defaultAgent() to use the default flag
- Update TUI to select default agent on initialization
- Regenerate SDK types
@elithrar
Copy link
Copy Markdown
Contributor Author

works in the TUI (default_agent: "triage")

image

@elithrar
Copy link
Copy Markdown
Contributor Author

somehow I missed #5313 - I think I’ve implicitly superseded that PR here though as I covered all API surfaces (incl. github)

@rekram1-node rekram1-node merged commit 21bee38 into anomalyco:dev Dec 20, 2025
2 checks passed
@elithrar elithrar deleted the support-default-agent branch December 20, 2025 18:00
@observerw
Copy link
Copy Markdown
Contributor

sweet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants