|
| 1 | +--- |
| 2 | +title: "Logout Method" |
| 3 | +--- |
| 4 | + |
| 5 | +- Author(s): [@anna239](https://github.com/anna239) |
| 6 | + |
| 7 | +## Elevator pitch |
| 8 | + |
| 9 | +> What are you proposing to change? |
| 10 | +
|
| 11 | +Add a `logout` method that allows clients to terminate an authenticated session with an agent. This is the counterpart to the existing `authenticate` method and enables proper session cleanup and credential invalidation. |
| 12 | + |
| 13 | +## Status quo |
| 14 | + |
| 15 | +> How do things work today and what problems does this cause? Why would we change things? |
| 16 | +
|
| 17 | +Currently, ACP provides an `authenticate` method for establishing authenticated sessions, but there is no standardized way to: |
| 18 | + |
| 19 | +- Log out of an authenticated session |
| 20 | +- Invalidate credentials or tokens |
| 21 | +- Signal to the agent that the user wants to end their authenticated state |
| 22 | + |
| 23 | +Users who want to switch accounts, revoke access, or simply log out must rely on: |
| 24 | + |
| 25 | +- Manually clearing credentials outside of ACP |
| 26 | +- Agent-specific workarounds |
| 27 | + |
| 28 | +This creates inconsistent user experiences and potential security concerns when credentials should be invalidated but aren't. |
| 29 | + |
| 30 | +## Shiny future |
| 31 | + |
| 32 | +> How will things play out once this feature exists? |
| 33 | +
|
| 34 | +Clients will be able to offer a proper "Log out" button that: |
| 35 | + |
| 36 | +1. Cleanly terminates the authenticated session |
| 37 | +2. Allows the agent to invalidate tokens/credentials as needed |
| 38 | +3. Returns the connection to an unauthenticated state |
| 39 | +4. Enables the user to re-authenticate with different credentials |
| 40 | + |
| 41 | +## Implementation details and plan |
| 42 | + |
| 43 | +> Tell me more about your implementation. What is your detailed implementation plan? |
| 44 | +
|
| 45 | +### New Method: `logout` |
| 46 | + |
| 47 | +A new method that terminates the current authenticated session. |
| 48 | + |
| 49 | +#### LogoutRequest |
| 50 | + |
| 51 | +```typescript |
| 52 | +interface LogoutRequest { |
| 53 | + /** Extension metadata */ |
| 54 | + _meta?: Record<string, unknown>; |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +#### LogoutResponse |
| 59 | + |
| 60 | +```typescript |
| 61 | +interface LogoutResponse { |
| 62 | + /** Extension metadata */ |
| 63 | + _meta?: Record<string, unknown>; |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +### Capability Advertisement |
| 68 | + |
| 69 | +The `logout` capability should be advertised within a new `authCapabilities` object in `AgentCapabilities`: |
| 70 | + |
| 71 | +```typescript |
| 72 | +interface AgentCapabilities { |
| 73 | + // ... existing fields ... |
| 74 | + |
| 75 | + /** Authentication-related capabilities */ |
| 76 | + authCapabilities?: AuthCapabilities; |
| 77 | +} |
| 78 | + |
| 79 | +interface AuthCapabilities { |
| 80 | + /** Extension metadata */ |
| 81 | + _meta?: Record<string, unknown>; |
| 82 | + |
| 83 | + /** Agent supports the logout method */ |
| 84 | + logout?: boolean; |
| 85 | +} |
| 86 | +``` |
| 87 | + |
| 88 | +### JSON Schema Additions |
| 89 | + |
| 90 | +```json |
| 91 | +{ |
| 92 | + "$defs": { |
| 93 | + "AuthCapabilities": { |
| 94 | + "description": "Authentication-related capabilities supported by the agent.", |
| 95 | + "properties": { |
| 96 | + "_meta": { |
| 97 | + "additionalProperties": true, |
| 98 | + "type": ["object", "null"] |
| 99 | + }, |
| 100 | + "logout": { |
| 101 | + "type": "boolean", |
| 102 | + "default": false, |
| 103 | + "description": "Whether the agent supports the logout method." |
| 104 | + } |
| 105 | + }, |
| 106 | + "type": "object" |
| 107 | + }, |
| 108 | + "LogoutRequest": { |
| 109 | + "description": "Request to terminate the current authenticated session.", |
| 110 | + "properties": { |
| 111 | + "_meta": { |
| 112 | + "additionalProperties": true, |
| 113 | + "type": ["object", "null"] |
| 114 | + } |
| 115 | + }, |
| 116 | + "type": "object", |
| 117 | + "x-method": "logout", |
| 118 | + "x-side": "agent" |
| 119 | + }, |
| 120 | + "LogoutResponse": { |
| 121 | + "description": "Response to the logout method.", |
| 122 | + "properties": { |
| 123 | + "_meta": { |
| 124 | + "additionalProperties": true, |
| 125 | + "type": ["object", "null"] |
| 126 | + } |
| 127 | + }, |
| 128 | + "type": "object", |
| 129 | + "x-method": "logout", |
| 130 | + "x-side": "agent" |
| 131 | + } |
| 132 | + } |
| 133 | +} |
| 134 | +``` |
| 135 | + |
| 136 | +### Example Exchange |
| 137 | + |
| 138 | +**Request:** |
| 139 | + |
| 140 | +```json |
| 141 | +{ |
| 142 | + "jsonrpc": "2.0", |
| 143 | + "id": 1, |
| 144 | + "method": "logout", |
| 145 | + "params": {} |
| 146 | +} |
| 147 | +``` |
| 148 | + |
| 149 | +**Response:** |
| 150 | + |
| 151 | +```json |
| 152 | +{ |
| 153 | + "jsonrpc": "2.0", |
| 154 | + "id": 1, |
| 155 | + "result": {} |
| 156 | +} |
| 157 | +``` |
| 158 | + |
| 159 | +### Behavior |
| 160 | + |
| 161 | +1. **Pre-condition**: The client should only call `logout` if: |
| 162 | + - The agent advertises `authCapabilities.logout: true` |
| 163 | + |
| 164 | +2. **Agent responsibilities**: |
| 165 | + - Invalidate any stored tokens or credentials as appropriate |
| 166 | + - Clean up any session state associated with the authenticated user |
| 167 | + - Return the connection to an unauthenticated state |
| 168 | + |
| 169 | +3. **Post-condition**: After a successful `logout`: |
| 170 | + - Subsequent requests that require authentication should return `auth_required` error |
| 171 | + - The client can call `authenticate` again to establish a new authenticated session |
| 172 | + |
| 173 | +4. **Active sessions**: If there are active sessions when `logout` is called, the agent should either: |
| 174 | + - Terminate them gracefully |
| 175 | + - Throw an `auth_required` error |
| 176 | + |
| 177 | +## Frequently asked questions |
| 178 | + |
| 179 | +> What questions have arisen over the course of authoring this document? |
| 180 | +
|
| 181 | +### Should logout affect active sessions? |
| 182 | + |
| 183 | +This is left as implementation-defined. Some agents may want to: |
| 184 | + |
| 185 | +- Automatically terminate all sessions (strict security) |
| 186 | +- Keep sessions running |
| 187 | + |
| 188 | +The RFD intentionally does not mandate a specific behavior to allow flexibility. |
| 189 | + |
| 190 | +## Revision history |
| 191 | + |
| 192 | +- 2026-02-02: Initial draft |
0 commit comments