Skip to content

Class: Session

Overview

The Session module provides methods for creating, managing, and terminating sessions in the AGB cloud environment. Sessions are the foundation for all operations.

Represents an active session in the AGB cloud environment. Provides access to command, file system, code execution, browser, computer, and context modules.

Table of contents

Properties

Methods

Properties

typescript
appInstanceId: `string` = `""`
browser: [`Browser`](capabilities/browser.md)
code: [`Code`](capabilities/code_execution.md)
command: [`Command`](capabilities/shell_commands.md)
computer: [`Computer`](capabilities/computer.md)
context: [`ContextManager`](data_context/context_manager.md)
enableBrowserReplay: `boolean` = `false`
file: [`FileSystem`](capabilities/file_system.md)
imageId: `string` = `""`
resourceId: `string` = `""`
resourceUrl: `string` = `""`

Methods

callMcpTool

callMcpTool(toolName, args, readTimeout?, connectTimeout?): Promise<McpToolResult>

Parameters

NameType
toolNamestring
argsRecord<string, unknown>
readTimeout?number
connectTimeout?number

Returns

Promise<McpToolResult>


delete

delete(syncContext?): Promise<DeleteResult>

Release (delete) this session. Optionally sync context before releasing.

Parameters

NameTypeDefault valueDescription
syncContextbooleanfalseIf true, sync context (e.g. upload browser data) before releasing

Returns

Promise<DeleteResult>

Promise resolving to DeleteResult


getLabels

getLabels(): Promise<OperationResult>

Get labels for the session.

Returns

Promise<OperationResult>

Promise resolving to OperationResult with data containing labels object


getLink(protocolType?, port?): Promise<OperationResult>

Parameters

NameType
protocolType?string
port?number

Returns

Promise<OperationResult>


getMetrics

getMetrics(readTimeout?, connectTimeout?): Promise<SessionMetricsResult>

Parameters

NameType
readTimeout?number
connectTimeout?number

Returns

Promise<SessionMetricsResult>

info

info(): Promise<OperationResult>

Get session resource info (sessionId, resourceUrl, desktopInfo, etc.).

Returns

Promise<OperationResult>

Promise resolving to OperationResult with resource data


keepAlive

keepAlive(): Promise<OperationResult>

Returns

Promise<OperationResult>


listMcpTools

listMcpTools(imageId?): Promise<McpToolsResult>

Parameters

NameType
imageId?string

Returns

Promise<McpToolsResult>


setLabels

setLabels(labels): Promise<OperationResult>

Set labels on the session (key-value metadata).

Parameters

NameTypeDescription
labelsRecord<string, string>Non-empty object of string key-value pairs

Returns

Promise<OperationResult>

Promise resolving to OperationResult


toJSON

toJSON(): Record<string, unknown>

Serialize session to a plain object (sessionId, resourceUrl, imageId, etc.).

Returns

Record<string, unknown>

Plain object with session fields