|
| 1 | +--- |
| 2 | +title: "Boolean Config Option Type" |
| 3 | +--- |
| 4 | + |
| 5 | +- Author(s): [fscarponi](https://github.com/fscarponi) |
| 6 | +- Champion: [benbrandt](https://github.com/benbrandt) |
| 7 | + |
| 8 | +## Elevator pitch |
| 9 | + |
| 10 | +Add a new `boolean` type to session configuration options, enabling agents to expose simple ON/OFF toggles (e.g., "Brave Mode", "Read Only", "Produce Report") as first-class config options alongside the existing `select` type. |
| 11 | + |
| 12 | +## Status quo |
| 13 | + |
| 14 | +Currently, `SessionConfigKind` only supports the `select` type, which allows agents to expose dropdown-style selectors with a list of named values. This works well for choosing models, modes, or reasoning levels. |
| 15 | + |
| 16 | +However, there is no native way to represent a simple boolean on/off toggle. To expose a boolean option today, agents must use a `select` with two artificial options (e.g., "on"/"off"), and clients need custom, non-agnostic logic to detect that a particular select is actually a boolean toggle. This defeats the purpose of a standardized protocol. |
| 17 | + |
| 18 | +## What we propose to do about it |
| 19 | + |
| 20 | +- Add a `SessionConfigBoolean` struct with a `current_value: bool` field |
| 21 | +- Add a `Boolean(SessionConfigBoolean)` variant to the `SessionConfigKind` enum, discriminated by `"type": "boolean"` |
| 22 | +- Add a `SessionConfigOptionValue` enum (untagged: `String` | `Bool`) so that `SetSessionConfigOptionRequest.value` can accept both string values (for `select`) and boolean values (for `flag`) |
| 23 | +- Provide convenience constructors and `From` impls for ergonomic usage |
| 24 | +- Update documentation and regenerate schema files |
| 25 | + |
| 26 | +## Shiny future |
| 27 | + |
| 28 | +Clients can natively render boolean config options as toggle switches or checkboxes, without any custom logic. Agents can expose options like "Brave Mode", "Produce Report", or "Read Only" in a standardized way that any ACP-compliant client understands out of the box. |
| 29 | + |
| 30 | +## Implementation details and plan |
| 31 | + |
| 32 | +### Wire format: declaring a boolean option |
| 33 | + |
| 34 | +In a `session/new` response (or any response containing `configOptions`): |
| 35 | + |
| 36 | +```json |
| 37 | +{ |
| 38 | + "jsonrpc": "2.0", |
| 39 | + "id": 1, |
| 40 | + "result": { |
| 41 | + "sessionId": "sess_abc123", |
| 42 | + "configOptions": [ |
| 43 | + { |
| 44 | + "id": "brave_mode", |
| 45 | + "name": "Brave Mode", |
| 46 | + "description": "Skip confirmation prompts and act autonomously", |
| 47 | + "type": "boolean", |
| 48 | + "currentValue": true |
| 49 | + }, |
| 50 | + { |
| 51 | + "id": "mode", |
| 52 | + "name": "Session Mode", |
| 53 | + "category": "mode", |
| 54 | + "type": "select", |
| 55 | + "currentValue": "code", |
| 56 | + "options": [ |
| 57 | + { "value": "ask", "name": "Ask" }, |
| 58 | + { "value": "code", "name": "Code" } |
| 59 | + ] |
| 60 | + } |
| 61 | + ] |
| 62 | + } |
| 63 | +} |
| 64 | +``` |
| 65 | + |
| 66 | +### Wire format: setting a boolean option |
| 67 | + |
| 68 | +The `session/set_config_option` request uses a string value, consistent with `select` options: |
| 69 | + |
| 70 | +```json |
| 71 | +{ |
| 72 | + "jsonrpc": "2.0", |
| 73 | + "id": 2, |
| 74 | + "method": "session/set_config_option", |
| 75 | + "params": { |
| 76 | + "sessionId": "sess_abc123", |
| 77 | + "configId": "brave_mode", |
| 78 | + "value": true |
| 79 | + } |
| 80 | +} |
| 81 | +``` |
| 82 | + |
| 83 | +The response returns the full set of config options with current values, as with `select`: |
| 84 | + |
| 85 | +```json |
| 86 | +{ |
| 87 | + "jsonrpc": "2.0", |
| 88 | + "id": 2, |
| 89 | + "result": { |
| 90 | + "configOptions": [ |
| 91 | + { |
| 92 | + "id": "brave_mode", |
| 93 | + "name": "Brave Mode", |
| 94 | + "description": "Skip confirmation prompts and act autonomously", |
| 95 | + "type": "boolean", |
| 96 | + "currentValue": true |
| 97 | + }, |
| 98 | + { |
| 99 | + "id": "mode", |
| 100 | + "name": "Session Mode", |
| 101 | + "category": "mode", |
| 102 | + "type": "select", |
| 103 | + "currentValue": "code", |
| 104 | + "options": [..] |
| 105 | + } |
| 106 | + ] |
| 107 | + } |
| 108 | +} |
| 109 | +``` |
| 110 | + |
| 111 | +A working implementation is available at: https://github.com/fscarponi/agent-client-protocol/tree/fabrizio.scarponi/flag-config-option |
| 112 | + |
| 113 | +Key changes: |
| 114 | + |
| 115 | +1. `SessionConfigFlag` struct with `current_value: bool` |
| 116 | +2. `Flag` variant in `SessionConfigKind` (tagged via `"type": "flag"`) |
| 117 | +3. `SessionConfigOptionValue` untagged enum (`String` | `Bool`) replacing `SessionConfigValueId` in `SetSessionConfigOptionRequest.value` |
| 118 | +4. `From` impls ensure backward compatibility — existing code passing strings still compiles |
| 119 | +5. Wire-level backward compatible: existing JSON payloads with string values remain valid |
| 120 | + |
| 121 | +### Client capabilities |
| 122 | + |
| 123 | +Per the existing protocol design, clients that receive a config option with an unrecognized `type` should ignore it. Since the agent is required to have a default value for every option, the agent can function correctly even if the client doesn't render or interact with the boolean option. No new client capability negotiation is needed. |
| 124 | + |
| 125 | +## Frequently asked questions |
| 126 | + |
| 127 | +### What alternative approaches did you consider, and why did you settle on this one? |
| 128 | + |
| 129 | +We considered reusing the existing `select` type with a convention (e.g., options named "on"/"off"), but this would require clients to implement non-agnostic detection logic, which contradicts the goal of a standardized protocol. A dedicated `flag` type is cleaner and lets clients render the appropriate UI control without guessing. |
| 130 | + |
| 131 | +### Is this a breaking change? |
| 132 | + |
| 133 | +On the wire/JSON level: no. `SessionConfigOptionValue` uses `#[serde(untagged)]`, so existing string payloads deserialize correctly. On the Rust API level: the type of `SetSessionConfigOptionRequest.value` changed, but `From` impls ensure source compatibility for users of the `new()` constructor. |
| 134 | + |
| 135 | +## Revision history |
| 136 | + |
| 137 | +- 2026-02-24: Initial proposal |
0 commit comments