| title | Session Modes |
|---|---|
| description | How agents can operate in different modes |
Agents can provide a set of modes they can operate in. Modes often affect the system prompts used, the availability of tools, and whether they request permission before running.
During Session Setup the Agent MAY return a list of modes it can operate in and the currently active mode:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"sessionId": "sess_abc123def456",
"modes": {
"currentModeId": "ask",
"availableModes": [
{
"id": "ask",
"name": "Ask",
"description": "Request permission before making any changes"
},
{
"id": "architect",
"name": "Architect",
"description": "Design and plan software systems without implementation"
},
{
"id": "code",
"name": "Code",
"description": "Write and modify code with full tool access"
}
]
}
}
}The current mode can be changed at any point during a session, whether the Agent is idle or generating a response.
Typically, Clients display the available modes to the user and allow them to change the current one, which they can do by calling the session/set_mode method.
{
"jsonrpc": "2.0",
"id": 2,
"method": "session/set_mode",
"params": {
"sessionId": "sess_abc123def456",
"modeId": "code"
}
}The Agent can also change its own mode and let the Client know by sending the current_mode_update session notification:
{
"jsonrpc": "2.0",
"method": "session/update",
"params": {
"sessionId": "sess_abc123def456",
"update": {
"sessionUpdate": "current_mode_update",
"modeId": "code"
}
}
}A common case where an Agent might switch modes is from within a special "exit mode" tool that can be provided to the language model during plan/architect modes. The language model can call this tool when it determines it's ready to start implementing a solution.
This "switch mode" tool will usually request permission before running, which it can do just like any other tool:
{
"jsonrpc": "2.0",
"id": 3,
"method": "session/request_permission",
"params": {
"sessionId": "sess_abc123def456",
"toolCall": {
"toolCallId": "call_switch_mode_001",
"title": "Ready for implementation",
"kind": "switch_mode",
"status": "pending",
"content": [
{
"type": "text",
"text": "## Implementation Plan..."
}
]
},
"options": [
{
"optionId": "code",
"name": "Yes, and auto-accept all actions",
"kind": "allow_always"
},
{
"optionId": "ask",
"name": "Yes, and manually accept actions",
"kind": "allow_once"
},
{
"optionId": "reject",
"name": "No, stay in architect mode",
"kind": "reject_once"
}
]
}
}When an option is chosen, the tool runs, setting the mode and sending the current_mode_update notification mentioned above.