You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Expose way to set a specific agent of a running instance (sdk/api/keybind) #4531
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
TLDR: Add a way to set the agent of a running opencode instance.
Background
I use opencode both standalone and from within neovim using opencode.nvim which creates or attaches to a running opencode instance.
I would like to be able to set an agent via this plugin. The benefit would for example be:
When I start a new session/conversation from within neovim UI I can also specify what agent should be used. Eg. if I use a simple "spellcheck" prompt i would like to have another agent (and cheaper model) than if I use a "analyze this code and explain what it does".
Current state
It IS possible to set the starting agent for a new opencode instance with the --agent flag to the CLI. But that requires you to kill the instance and start a new one if you want to set it. It is (as far as I can see) not possible to change the agent of a running instance.
It IS possible to list all agents and cycle through the agent list (forwards, reverse). But why not set?
Other considerations
I'm not enought well versed in the opencode codebase yet in order to say exactly where this should be added. But I suppose it would also be good to have the same capability in the TUI itself. Right now you can have a keybinding for cycling agents (agent_cycle) but not setting a specific agent. It feels quite natural to be able to set a specific agent also (agent_set <agent_id>). My usage of Opencode is not so much "switching between the builtin plan/build agents" but much more leveraging my own custom agents. I have many custom agents. I really hope opencode can enable and empower that kind of "bring your own agents"-mindset.
EDIT: One thing I'm not sure about is whether the ACP protocol allows for setting the agent of a running session? But I do think ACP supports "slash commands" and such, so that could perhaps be also resolved by this.
changed the title [-][FEATURE]: Expose endpoint to set agent of running instance (sdk/api)[/-][+][FEATURE]: Expose way to set a specific agent of a running instance (sdk/api/keybind)[/+]on Nov 20, 2025
I also use external tools, it allows me to do everything, except ... switching agents. (sub agents does work)
So I would like to see this feature as well.
Activity
[-][FEATURE]: Expose endpoint to set agent of running instance (sdk/api)[/-][+][FEATURE]: Expose way to set a specific agent of a running instance (sdk/api/keybind)[/+]Alex-CodeLab commentedon Mar 2, 2026
I also use external tools, it allows me to do everything, except ... switching agents. (sub agents does work)
So I would like to see this feature as well.
github-actions commentedon May 2, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.