View as markdown

SDK API reference

Import every supported runtime value and TypeScript type from @getpaseo/client.

createPaseoClient(config)

Creates a client without opening the connection.

Required configuration:

FieldTypeMeaning
urlstringDaemon WebSocket endpoint, including /ws.

Common optional configuration:

FieldTypeDefaultMeaning
clientIdstringGeneratedStable identifier for logs and subscriptions.
passwordstringUnsetDaemon password.
authHeaderstringUnsetComplete authorization-header value for a proxy.
connectTimeoutMsnumberClient defaultConnection deadline.
reconnect.enabledbooleanClient defaultReconnect after an unexpected disconnect.
reconnect.baseDelayMsnumberClient defaultInitial reconnect delay.
reconnect.maxDelayMsnumberClient defaultMaximum reconnect delay.
loggerPaseoLoggerUnsetDebug, info, warning, and error sink.

Relay E2EE clients can also pass e2ee.enabled and e2ee.daemonPublicKeyB64. appVersion, runtimeGeneration, and runtime-metrics options exist for Paseo client surfaces; ordinary integrations can omit them.

Client lifecycle

MethodResultBehavior
connect()Promise<void>Resolves after the daemon sends its server information.
close()Promise<void>Closes the connection and disposes this client.
ensureConnected()voidThrows unless the client is connected.
getConnectionState()ConnectionStateReturns idle, connecting, connected, disconnected, or disposed.

Create a new client after close().

client.agents

MethodResultBehavior
list(options?)PaseoAgentListResultLists a page of agents. scope, filter, sort, page, and subscribe match the daemon directory query.
create(options)PaseoAgentHandleCreates an agent and a fresh workspace for cwd. Requires config.
ref(agentOrId)PaseoAgentHandleCreates a local handle without fetching.
subscribe(handler)Unsubscribe functionListens for connection-local agent directory updates. Call list({ subscribe }) first.

Creation options include config, cwd, parent, title, prompt, env, outputSchema, images, attachments, git, worktree, autoArchive, and labels.

config accepts:

FieldTypeMeaning
providerstringRequired provider/model selection.
modeIdstringProvider operating or permission mode.
thinkingOptionIdstringProvider reasoning level.
featureValuesRecord<string, unknown>Values for features discovered through providers.listFeatures.
optionsJSON objectProvider-native settings, strictly validated. See Provider options.
systemPromptstringAdditional system or developer instructions.
mcpServersMCP server mapSession-scoped MCP servers.
toolPolicyMCP tool policyExact preapproval rules for MCP tools.

Agent handle

MemberResultBehavior
idstringStable daemon agent ID.
workspaceIdstring | nullCurrent workspace placement.
cwdstring | nullCurrent working directory.
statusAgent status or nullCurrent lifecycle status.
current()PaseoAgent | nullCurrent detailed value observed by this handle; never fetches.
refresh(requestId?)PaseoAgentRefetchResult | nullFetches the current agent and project placement.
send(text, options?)Promise<void>Resolves when the daemon accepts the prompt.
run(text, options?)PaseoAgentRunResultSends a prompt and waits for that turn. timeoutMs controls the wait; it defaults to 10 minutes.
waitForFinish(timeoutMs?)PaseoAgentRunResultWaits for the active turn, including an initial prompt. Default timeout: 10 minutes.
subscribe(handler)Unsubscribe functionFilters agent-directory updates to this ID and refreshes the handle properties.
archive(){ archivedAt }Soft-deletes the agent and closes its runtime.
detach()Promise<void>Removes the parent relationship without stopping the agent.

PaseoAgentRunResult contains status, final, error, and lastMessage. final refreshes the handle when present.

Timeline handle

agent.timeline.refetch(options?) fetches a page. Options are direction, cursor, limit, projection, and requestId.

agent.timeline.subscribe(handler) listens for stream events belonging to the agent and returns a local unsubscribe function.

client.workspaces

MethodResultBehavior
list(options?)PaseoWorkspaceListResultLists, filters, pages, or subscribes to the workspace directory.
open(cwd)PaseoWorkspaceHandleReuses the active workspace for a directory or creates one.
create(options)PaseoWorkspaceHandleAlways creates a fresh directory-backed or Paseo-worktree workspace.
ref(workspaceOrId)PaseoWorkspaceHandleCreates a local handle.
archive(workspaceOrId)PaseoWorkspaceArchiveResultArchives without first creating a handle.
subscribe(handler)Unsubscribe functionListens for connection-local workspace updates. Call list({ subscribe }) first.

A workspace handle exposes id, projectId, directory, name, status, current(), refresh(), archive(), and subscribe(). Use workspace.agents.create(options) to create an agent without repeating the workspace ID or directory.

client.providers

MethodResultBehavior
waitForReady(options?)PaseoProviderSnapshotResultWaits until no provider is loading. Default timeout: 60 seconds. Rejects with an update-host error when the daemon cannot correlate workspace snapshots.
snapshot(options?)PaseoProviderSnapshotResultReturns the current catalog immediately.
refresh(options?)AcknowledgementForces catalog refresh for all or selected providers.
listAvailable()Availability resultReports installed provider availability.
listModels(provider, options?)Models resultDiscovers models for one provider and directory.
listModes(provider, options?)Modes resultDiscovers permission or operating modes.
listFeatures(draftConfig)Features resultDiscovers features for the current draft provider configuration.
diagnostic(provider)Diagnostic resultReturns human-readable setup diagnostics.
subscribe(handler)Unsubscribe functionListens for catalog updates.

client.config

config.get(requestId?) returns the daemon's mutable configuration.

config.patch(patch, requestId?) validates, persists, and returns an updated configuration. Use this administrative surface for host configuration, not per-agent choices. A patch affects every client and future agent using that daemon.

Errors and cleanup

Connection, validation, rejection, and timeout failures reject their promise. Turn outcomes are returned through PaseoAgentRunResult.status because permission and provider errors are expected agent states.

Always close the client in finally. Closing a client removes its local listeners and network connection; it does not stop agents or archive workspaces.