Summary
Add a /model Discord slash command that dynamically lists available models from the ACP agent backend (e.g. Kiro CLI) and lets users switch models via an interactive Discord Select Menu — all driven by the ACP configOptions protocol.
Motivation
Currently, OpenAB binds to a single agent backend configured in config.toml. There is no way for users to discover or switch models at runtime from Discord. The ACP spec already defines session/configOptions with category: "model" for exactly this purpose — OpenAB just needs to bridge it to Discord UI.
Proposed Flow
User types /model in Discord
↓
OpenAB reads configOptions from the current ACP session
(category: "model" → list of available models)
↓
OpenAB renders a Discord Select Menu with the model options
↓
User picks a model (e.g. "opus-4")
↓
OpenAB sends session/set_config_option to the ACP agent
{ configId: "model", value: "opus-4" }
↓
Agent confirms → OpenAB updates the Discord message
"✅ Switched to Opus 4"
Implementation Details
1. Discord Slash Command Registration
Register /model as a guild command on bot startup (EventHandler::ready):
guild_id.set_commands(&ctx.http, vec![
CreateCommand::new("model")
.description("Select the AI model for this session")
]).await?;
2. ACP configOptions Parsing
After session/create, parse the configOptions array from the response and cache options with category: "model".
3. Discord Select Menu
Convert ACP configOptions into a Discord StringSelectMenu:
- Each
ConfigOptionValue → one select menu option
currentValue → default selection
custom_id → acp_config_{configOption.id}
4. Interaction Handler
On interaction_create for component interactions with custom_id starting with acp_config_:
interaction.defer_update()
- Send
session/set_config_option via ACP JSON-RPC
- Update the Discord message with confirmation
5. Agent-Initiated Updates
Handle config_option_update notifications from the agent (e.g. model fallback due to rate limits) and optionally notify the Discord thread.
Extensibility
The same mechanism can be reused for other ACP config categories:
| Slash Command |
ACP Category |
Purpose |
/model |
model |
Switch AI model |
/mode |
mode |
Switch session mode (ask/code) |
/thinking |
thought_level |
Set reasoning level |
References
Summary
Add a
/modelDiscord slash command that dynamically lists available models from the ACP agent backend (e.g. Kiro CLI) and lets users switch models via an interactive Discord Select Menu — all driven by the ACPconfigOptionsprotocol.Motivation
Currently, OpenAB binds to a single agent backend configured in
config.toml. There is no way for users to discover or switch models at runtime from Discord. The ACP spec already definessession/configOptionswithcategory: "model"for exactly this purpose — OpenAB just needs to bridge it to Discord UI.Proposed Flow
Implementation Details
1. Discord Slash Command Registration
Register
/modelas a guild command on bot startup (EventHandler::ready):2. ACP configOptions Parsing
After
session/create, parse theconfigOptionsarray from the response and cache options withcategory: "model".3. Discord Select Menu
Convert ACP
configOptionsinto a DiscordStringSelectMenu:ConfigOptionValue→ one select menu optioncurrentValue→ default selectioncustom_id→acp_config_{configOption.id}4. Interaction Handler
On
interaction_createfor component interactions withcustom_idstarting withacp_config_:interaction.defer_update()session/set_config_optionvia ACP JSON-RPC5. Agent-Initiated Updates
Handle
config_option_updatenotifications from the agent (e.g. model fallback due to rate limits) and optionally notify the Discord thread.Extensibility
The same mechanism can be reused for other ACP config categories:
/modelmodel/modemode/thinkingthought_levelReferences