Skip to main content

Properties

DevinApiClient
required
Escape hatch: the full generated v3 API client.
The agent’s cognition.ai/* capability flags (agentCapabilities._meta).
JsonRpcConnection
required
The agent’s initialize response (capabilities, auth methods).
undefined | AgentRequestHandler
required
Type: AgentRequestHandlerAnswer agent → client requests the SDK does not handle itself (anything but session/request_permission). Without a handler — or when the handler returns undefined — built-in defaults apply (diagnostics report none) and other methods are declined with method not found.
undefined | (notification: CognitionExtensionNotification) => void
required
Type: CognitionExtensionNotificationObserve connection-scoped _cognition.ai/* notifications — those without a sessionId (or one that matches no tracked session), e.g. mcp/serversChanged and plugins/changed. Session-scoped notifications go to the owning session’s onExtension instead.
Which session/prompt content blocks the agent accepts, and the cloud size limits.
number
required
The ACP protocol version the agent settled on (1 or 2).

Methods

[asyncDispose]()

await using devin = … closes the client at scope exit, once the connection has shut down.

Returns

Promise<void>

assertNotOpen()

Throw unless no session with this id is open on this client.

Parameters

string
required

attach()

Join an existing cloud session without replaying its transcript (replay: "none" unless overridden).

Parameters

string
required

Returns

CloudSession

attachTo()

Attach to an already-open ACP WebSocket. Exposed for tests and custom transports; most callers want connect. Closes ws if the handshake fails.

Parameters

WebSocketLike
required

Returns

CloudDevin

close()

Shut down the connection. In-flight prompts reject.

closePullRequest()

Close a pull request without merging (github.com/owner/repo/pull/123).

Parameters

string
required

Returns

PrCloseResponse

closeSession()

Detach from a session on this connection (ACP v2 session/close): the agent cancels any turn this client started and stops sending it updates. On v1 agents this only releases the session locally.

Parameters

string
required

Returns

Promise<void>

connect()

Open the ACP WebSocket and perform the initialize handshake.

Parameters

Returns

CloudDevin

createSecret()

Create an organization or user secret Devin can use in sessions.

Parameters

Returns

SecretCreateResponse

createSession()

Create a new cloud session. The Devin session itself is created lazily on the first prompt; orgId and repos are applied to the pending session before that (in one request when both are given).

Parameters

Returns

CloudSession

extNotify()

Send a connection-scoped _cognition.ai/* notification (no response).

Parameters

M
required
CognitionRequestParams<M>
required
Send a connection-scoped _cognition.ai/* notification (no response).

Parameters

string
required
unknown

extRequest()

Send a connection-scoped _cognition.ai/* request. Typed when the method is in the generated registry (CognitionAgentResponseMap); any other _cognition.ai/* method is accepted untyped. For session-scoped methods prefer AcpSession.extRequest, which fills in the session id.

Parameters

M
required
CognitionRequestParams<M>
required

Returns

CognitionRequestResult
Send a connection-scoped _cognition.ai/* request. Typed when the method is in the generated registry (CognitionAgentResponseMap); any other _cognition.ai/* method is accepted untyped. For session-scoped methods prefer AcpSession.extRequest, which fills in the session id.

Parameters

string
required
unknown

Returns

Promise<T>

handshake()

Offer the selected version. V2 offers include v1 initialization fields so v1-only agents can still negotiate v1.

Parameters

JsonRpcConnection
required

Returns

InitializeResult

launchSession()

Create a session and submit its first turn. Resolves on turn.accepted, not the turn’s outcome. Cancel explicitly with session.cancel(). Startup errors after creation preserve sessionId; never retry blindly.

Parameters

required
LaunchSessionOptions<CloudSessionOptions, T> & { turn: RunOptions<T> & { output…
required

Returns

LaunchedSessionCloudSession
Create a session and submit its first turn. Resolves on turn.accepted, not the turn’s outcome. Cancel explicitly with session.cancel(). Startup errors after creation preserve sessionId; never retry blindly.

Parameters

required
LaunchSessionOptions<CloudSessionOptions, unknown> & { turn: Omit<RunOptions<un…

Returns

LaunchedSessionCloudSession
Create a session and submit its first turn. Resolves on turn.accepted, not the turn’s outcome. Cancel explicitly with session.cancel(). Startup errors after creation preserve sessionId; never retry blindly.

Parameters

required
LaunchSessionOptions<CloudSessionOptions, T>
required

Returns

LaunchedSessionCloudSession

listSessions()

List the user’s cloud sessions, most recently updated first. Returns the first page only (the agent’s page size); use listSessionsPage to paginate with cursor.

Parameters

Returns

SessionInfo

listSessionsPage()

One page of the user’s cloud sessions plus the cursor for the next.

Parameters

Returns

CloudSessionsPage

loadSession()

Resume an existing cloud session by id (devin-…). On ACP v2 this is session/resume (with replayFrom chosen by options.replay); on v1 it is session/load, which always replays the whole transcript.

Parameters

string
required

Returns

LoadedCloudSession

mcpServers()

Parameters

Returns

McpServer

mergePullRequest()

Merge a pull request Devin opened, via Devin’s GitHub integration. prPath is github.com/owner/repo/pull/123.

Parameters

string
required

Returns

PrMergeResponse

openSession()

Bring a freshly constructed session live: wire its permission handler, route notifications to it, and run the agent request that establishes it (session/new follow-ups such as choosing the model or organization). A failing request releases the session and surfaces as a SessionStartupError carrying the allocated id.

Parameters

required
() => Promise<unknown>

Returns

CloudSession

pullRequestMergeStatus()

Mergeability / CI state of a pull request (github.com/owner/repo/pull/123).

Parameters

string
required

Returns

PrMergeStatusResponse

pullRequestReviewJob()

One Devin Review job (with findings) for a pull request.

Parameters

string
required
string
required
string
required

Returns

PrReviewJobResponse

pullRequestReviewJobs()

Devin Review jobs that ran against a pull request.

Parameters

string
required

Returns

PrReviewJobsResponse

releaseSession()

Detach a session: active turns reject, observers end, and the handle cannot send requests.

Parameters

string
required

resumeSession()

Resume an existing session: like openSession, but the agent replays history as session/update notifications before load settles; those are captured and returned instead of being delivered live. Refuses a session that is already open on this client, since loading it again would steal its notification routing.

Parameters

required
() => Promise<unknown>
required

Returns

LoadedSessionCloudSession

supports()

Whether the agent advertised a cognition.ai/* capability, e.g. devin.supports("cognition.ai/sessionRename") before calling session.rename().

Parameters

string
required

Returns

boolean

track()

Register a session so its notifications are routed to it.

Parameters

required

untrack()

Stop routing notifications to a session (e.g. after deleting it).

Parameters

string
required