Skip to main content

SessionRpc overview

Scope: SessionRpc (per-session operations tied to a Session) For an overview of RPC and the list of all RPC pages, see RPC. This page summarizes SessionRpc methods by category. For usage examples, open the feature pages listed in the RPC index.

Model, mode, name, and plan

Use model() to check or switch the current model and to set reasoning effort, the Auto tier, and allowed models. mode() handles the mode, name() the session name, and plan() reads and writes the plan body and SQLite todos.

Workspaces, instructions, and LSP

workspaces() lets you list, read, write, move, and delete files and work with directories. Use instructions() to get, reload, and discover instructions, and lsp() to initialize, list, start, stop, and diagnose language servers and toggle whether each one is enabled. For usage examples, see Workspaces, agents, Fleet, and skills.

Autopilot objective

autopilotObjective()->getState() returns the session’s current Autopilot objective state as a typed object. If no objective exists, state is null. This API differs from workspaces()->autopilotObjectiveExists(), which checks whether an objective is saved in the workspace. For usage examples, see Workspaces, agents, Fleet, and skills.

Agents, Fleet, and background tasks

Use agent() to list, select, and reload agents, and fleet() to start Fleet. tasks() handles registering background agents and client-owned tasks, getting and updating progress, promotion, sending messages, cancellation, and removal.

MCP, plugins, extensions, and workflow

mcp() handles listing, starting, stopping, and reloading servers, tools, prompts, resources, OAuth, sampling, and updating dynamic headers. plugins() and extensions() manage in-session state, and customizations() reloads customizations. Use workflow() to run and query workflows, and diagnostics() and connectors() to get diagnostics and connectors.

Tools, permissions, commands, and UI

tools() and permissions() handle responses to pending requests delivered via events, as well as settings. To read permissions, use getAllowAll(), getRequired(), managedReviewRequired(), and additionalDirectories()->list(). permissions()->clearResumeEscalation() clears, in memory, the permission escalation restored from history on resume, and returns a typed success result. commands() provides listing commands, running them, and responding to events, and ui() responds to requests such as user input, elicitation, and plan approval. completions() gets input completions. For usage examples, see Tools, permissions, commands, and UI.

Accounts, authentication, and providers

accounts() handles enumerating accounts, providers, and logged-in accounts with enumerate(), get() and set(), and interactive login with begin(), advance(), and cancel(). gitHubAuth() handles the session’s authentication status and credentials, provider() and providers() handle model endpoints and provider adapters, and connectors() handles the session’s connector connections.

History, queue, logs, and usage

history() provides conversation compaction (including compaction settings), aborting, handoff summaries, and truncation, and queue() provides inserting, moving, editing, removing, and immediately sending pending items. Use log(), eventLog(), usage(), quota(), and limitPrediction() to work with logs, events, usage, and limit information. schedule() lets you view and stop scheduled prompts.

Lifecycle, remote, and host integration

sendMessages() runs multiple messages in a single turn, and suspend() and shutdown() stop the session. interruptMainTurn() controls the main turn, and cancelAllBackgroundAgents() controls background agents separately. remote() and visibility() handle remote publication and sharing state, sandbox() the session’s sandbox, managedSettings() session-scoped managed settings, contentExclusion() path checks, metadata() client-owned metadata, and canvas() Canvas integration.
Last modified on November 19, 2026